diff --git a/.github/workflows/oci-dist-spec-content-discovery.yml b/.github/workflows/oci-dist-spec-content-discovery.yml index 9a30cf28..16461087 100644 --- a/.github/workflows/oci-dist-spec-content-discovery.yml +++ b/.github/workflows/oci-dist-spec-content-discovery.yml @@ -1,28 +1,23 @@ name: OCI Distribution Spec - Content Discovery - on: pull_request: push: - branches: - - main + branches: [main] workflow_dispatch: inputs: debug_enabled: type: boolean - description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' + description: Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate) required: false default: false - concurrency: group: content-discovery-${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true - env: PGUSER: postgres POSTGRES_DB: open_registry POSTGRES_PASSWORD: Qwerty@123 POSTGRES_USER: postgres - jobs: conformance: runs-on: ubuntu-latest @@ -39,9 +34,9 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 - ports: - - 5432:5432 + ports: [5432:5432] steps: + - run: sudo snap install --edge --classic just - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: @@ -58,7 +53,7 @@ jobs: yq e -i '.dfs.mock.type = "FS"' config.yaml go mod download go build - make certs + just certs ./OpenRegistry migrations init \ --admin-db="postgres" \ --admin-db-username="postgres" \ @@ -93,7 +88,7 @@ jobs: OCI_DEBUG: 0 - name: Setup tmate session if mode is debug and OpenRegistry or OCI Tests Fail uses: mxschmitt/action-tmate@v3 - if: ${{ always() && (github.event_name == 'workflow_dispatch') && inputs.debug_enabled }} + if: ${{ always() && (github.event_name == 'workflow_dispatch') && inputs.debug_enabled }} - name: Set output report name id: vars run: echo "short_commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT diff --git a/.github/workflows/oci-dist-spec-content-management.yml b/.github/workflows/oci-dist-spec-content-management.yml index 9d8f17c3..6a3e73d3 100644 --- a/.github/workflows/oci-dist-spec-content-management.yml +++ b/.github/workflows/oci-dist-spec-content-management.yml @@ -1,28 +1,23 @@ name: OCI Distribution Spec - Content Management - on: pull_request: push: - branches: - - main + branches: [main] workflow_dispatch: inputs: debug_enabled: type: boolean - description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' + description: Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate) required: false default: false - concurrency: group: content-management-${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true - env: PGUSER: postgres POSTGRES_DB: open_registry POSTGRES_PASSWORD: Qwerty@123 POSTGRES_USER: postgres - jobs: conformance: runs-on: ubuntu-latest @@ -39,9 +34,9 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 - ports: - - 5432:5432 + ports: [5432:5432] steps: + - run: sudo snap install --edge --classic just - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: @@ -58,7 +53,7 @@ jobs: yq e -i '.dfs.mock.type = "FS"' config.yaml go mod download go build - make certs + just certs ./OpenRegistry migrations init \ --admin-db="postgres" \ --admin-db-username="postgres" \ @@ -92,7 +87,7 @@ jobs: OCI_DEBUG: 0 - name: Setup tmate session if mode is debug and OpenRegistry or OCI Tests Fail uses: mxschmitt/action-tmate@v3 - if: ${{ always() && (github.event_name == 'workflow_dispatch') && inputs.debug_enabled }} + if: ${{ always() && (github.event_name == 'workflow_dispatch') && inputs.debug_enabled }} - name: Set output report name id: vars run: echo "short_commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT diff --git a/.github/workflows/oci-dist-spec-pull.yml b/.github/workflows/oci-dist-spec-pull.yml index 187691eb..8a551d13 100644 --- a/.github/workflows/oci-dist-spec-pull.yml +++ b/.github/workflows/oci-dist-spec-pull.yml @@ -42,6 +42,7 @@ jobs: ports: - 5432:5432 steps: + - run: sudo snap install --edge --classic just - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: @@ -58,7 +59,7 @@ jobs: yq e -i '.dfs.mock.type = "FS"' config.yaml go mod download go build - make certs + just certs ./OpenRegistry migrations init \ --admin-db="postgres" \ --admin-db-username="postgres" \ diff --git a/.github/workflows/oci-dist-spec-push.yml b/.github/workflows/oci-dist-spec-push.yml index fd7e31ba..223a377a 100644 --- a/.github/workflows/oci-dist-spec-push.yml +++ b/.github/workflows/oci-dist-spec-push.yml @@ -1,28 +1,24 @@ +--- name: OCI Distribution Spec - Push Image - on: pull_request: push: - branches: - - main + branches: [main] workflow_dispatch: inputs: debug_enabled: type: boolean - description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' + description: Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate) required: false default: false - concurrency: group: push-${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true - env: PGUSER: postgres POSTGRES_DB: open_registry POSTGRES_PASSWORD: Qwerty@123 POSTGRES_USER: postgres - jobs: conformance: runs-on: ubuntu-latest @@ -39,9 +35,9 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 - ports: - - 5432:5432 + ports: [5432:5432] steps: + - run: sudo snap install --edge --classic just - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: @@ -58,7 +54,7 @@ jobs: yq e -i '.dfs.mock.type = "FS"' config.yaml go mod download go build - make certs + just certs ./OpenRegistry migrations init \ --admin-db="postgres" \ --admin-db-username="postgres" \ @@ -93,7 +89,7 @@ jobs: OCI_DEBUG: 0 - name: Setup tmate session if mode is debug and OpenRegistry or OCI Tests Fail uses: mxschmitt/action-tmate@v3 - if: ${{ always() && (github.event_name == 'workflow_dispatch') && inputs.debug_enabled }} + if: ${{ always() && (github.event_name == 'workflow_dispatch') && inputs.debug_enabled }} - name: Set output report name id: vars run: echo "short_commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT diff --git a/docs/contributing/development-environment-setup.md b/docs/contributing/development-environment-setup.md index 56dfe460..ba2a8460 100644 --- a/docs/contributing/development-environment-setup.md +++ b/docs/contributing/development-environment-setup.md @@ -3,12 +3,14 @@ ## Clone the repository We recommend using the Git method to clone the repository: + ```bash git clone git@github.com:containerish/OpenRegistry.git cd OpenRegistry ``` ## Configuration File + OpenRegistry uses the standard yaml based configuration. This configuration file is named `config.yaml` and can be either in the current directory or `$HOME/.openregistry/config.yaml` directory. Some of the features are disabled by default just to keep the on-boarding process simple. @@ -22,39 +24,39 @@ web_app_url: "http://localhost:3000" web_app_redirect_url: "/" web_app_error_redirect_path: "/auth/unhandled" registry: - dns_address: registry.local - version: master - fqdn: registry.local - host: registry.local - port: 5000 - tls: - enabled: true - key: .certs/openregistry.key - cert: .certs/openregistry.cert - services: - - github - - token + dns_address: registry.local + version: master + fqdn: registry.local + host: registry.local + port: 5000 + tls: + enabled: true + key: .certs/openregistry.key + cert: .certs/openregistry.cert + services: + - github + - token dfs: - s3_any: - access_key: - secret_key: - endpoint: - bucket_name: - dfs_link_resolver: + s3_any: + access_key: + secret_key: + endpoint: + bucket_name: + dfs_link_resolver: database: - kind: postgres - host: 0.0.0.0 - port: 5432 - username: postgres - password: Qwerty@123 - name: open_registry + kind: postgres + host: 0.0.0.0 + port: 5432 + username: postgres + password: Qwerty@123 + name: open_registry ``` If you check the `registry.tls` section, you'll notice that we have enabled the TLS configuration, but we need to generate the TLS certificates before we move forward: ```bash -make certs +just certs ``` ## Database Setup @@ -79,12 +81,13 @@ Exit the Postgres shell. ### Create the tables We have a simple Makefile, which exposes the following commands: + - `migup` - Populate all the migrations, create tables, schema changes - `migdown` - Teardown all the tables, schemas, etc - `cleanup` - Runs `migdown` first and then `migup` Before we begin setting up tables in our database, we need to use another tool called `golang-migrate`. -This is a database migration tool that makes database migrations dead simple. Use either of the following links to +This is a database migration tool that makes database migrations dead simple. Use either of the following links to install `golang-migrate`: - [Homebrew Link](https://formulae.brew.sh/formula/golang-migrate#default) @@ -93,7 +96,7 @@ install `golang-migrate`: To make sure that OpenRegistry can find all the required tables, schemas, etc, run the following command: ```bash -make migup +just migup ``` ```bash diff --git a/Makefile b/justfile similarity index 83% rename from Makefile rename to justfile index 67811ca6..36e1e295 100644 --- a/Makefile +++ b/justfile @@ -1,4 +1,4 @@ -POSTGRESQL_URL='postgres://postgres:postgres@0.0.0.0:5432/open_registry?sslmode=disable' +POSTGRESQL_URL := 'postgres://postgres:postgres@0.0.0.0:5432/open_registry?sslmode=disable' psql_grants: @psql -d open_registry -c 'GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO open_registry_user;' @@ -6,10 +6,6 @@ psql_grants: mock-images: bash ./scripts/mock-images.sh -tools: - pip3 install ggshield pre-commit - pre-commit install - certs: mkdir .certs openssl req -x509 -newkey rsa:4096 -keyout .certs/registry.local -out .certs/registry.local.crt -sha256 -days 365 \ diff --git a/registry/v2/registry.go b/registry/v2/registry.go index 0a8c15c8..2d8fbd44 100644 --- a/registry/v2/registry.go +++ b/registry/v2/registry.go @@ -158,7 +158,6 @@ func (r *registry) Catalog(ctx echo.Context) error { }) r.logger.Log(ctx, echoErr).Send() return echoErr - } // ListTags Content discovery @@ -201,6 +200,7 @@ func (r *registry) ListTags(ctx echo.Context) error { r.logger.Log(ctx, echoErr).Send() return echoErr } + func (r *registry) List(ctx echo.Context) error { return fmt.Errorf("not implemented") }