Skip to content

Commit

Permalink
remove: Makefile
Browse files Browse the repository at this point in the history
And add justfile

Signed-off-by: jay-dee7 <[email protected]>
  • Loading branch information
jay-dee7 committed Feb 5, 2024
1 parent e13c85e commit 09d76e8
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 67 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/oci-dist-spec-content-discovery.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand All @@ -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" \
Expand Down Expand Up @@ -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
Expand Down
17 changes: 6 additions & 11 deletions .github/workflows/oci-dist-spec-content-management.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand All @@ -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" \
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/oci-dist-spec-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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" \
Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/oci-dist-spec-push.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand All @@ -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" \
Expand Down Expand Up @@ -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
Expand Down
57 changes: 30 additions & 27 deletions docs/contributing/development-environment-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
## Clone the repository

We recommend using the Git method to clone the repository:

```bash
git clone [email protected]: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.
Expand All @@ -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: <access-key>
secret_key: <access-secret-key>
endpoint: <s3-compatible-api-endpoint>
bucket_name: <s3-bucket-name>
dfs_link_resolver: <optional-dfs-link-resolver-url>
s3_any:
access_key: <access-key>
secret_key: <access-secret-key>
endpoint: <s3-compatible-api-endpoint>
bucket_name: <s3-bucket-name>
dfs_link_resolver: <optional-dfs-link-resolver-url>
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
Expand All @@ -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)
Expand All @@ -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
Expand Down
6 changes: 1 addition & 5 deletions Makefile → justfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
POSTGRESQL_URL='postgres://postgres:[email protected]:5432/open_registry?sslmode=disable'
POSTGRESQL_URL := 'postgres://postgres:[email protected]: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;'

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 \
Expand Down
2 changes: 1 addition & 1 deletion registry/v2/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ func (r *registry) Catalog(ctx echo.Context) error {
})
r.logger.Log(ctx, echoErr).Send()
return echoErr

}

// ListTags Content discovery
Expand Down Expand Up @@ -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")
}
Expand Down

0 comments on commit 09d76e8

Please sign in to comment.