Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "feat(store): Migration overhaul (bun orm)" #474

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Dispatch workflows"
on: push

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
call-lint:
name: "Lint"
uses: ./.github/workflows/golangci-lint.yml

call-image-push:
name: OCI Distribution Spec
uses: ./.github/workflows/oci-dist-spec-push.yml
needs: call-lint
secrets: inherit
call-image-pull:
name: OCI Distribution Spec
uses: ./.github/workflows/oci-dist-spec-pull.yml
needs: call-lint
secrets: inherit
call-image-content-discovery:
name: OCI Distribution Spec
uses: ./.github/workflows/oci-dist-spec-content-discovery.yml
needs: call-lint
secrets: inherit
call-image-content-management:
name: OCI Distribution Spec
uses: ./.github/workflows/oci-dist-spec-content-management.yml
needs: call-lint
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: golangci-lint
on:
pull_request:
workflow_call:

concurrency:
group: linter-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down
75 changes: 35 additions & 40 deletions .github/workflows/oci-dist-spec-content-discovery.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: OCI Distribution Spec - Content Discovery
name: OCI Distribution Spec

on:
pull_request:
workflow_dispatch:
workflow_call:
inputs:
debug_enabled:
type: boolean
Expand All @@ -14,23 +13,17 @@ 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:
content-discovery:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
PGUSER: postgres
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_DB: open_registry
POSTGRES_PASSWORD: Qwerty@123
POSTGRES_USER: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
Expand All @@ -40,53 +33,55 @@ jobs:
- 5432:5432
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Install Migrate CLI
run: |
curl -L https://github.com/golang-migrate/migrate/releases/download/v4.15.1/migrate.linux-amd64.tar.gz | tar xvz
sudo mv migrate /usr/bin/migrate
- name: Setup PostgreSQL Database
run: |
IP=`hostname -I | awk '{print $1}'`
POSTGRESQL_URL=postgres://$PGUSER:$PGPASSWORD@$IP:5432/$PGDATABASE?sslmode=disable
migrate -database ${POSTGRESQL_URL} -path db/migrations up
env:
PGDATABASE: open_registry
PGPASSWORD: Qwerty@123
PGUSER: postgres
- name: Build and configure OpenRegistry container image
run: |
IP=`hostname -I | awk '{print $1}'`
echo "IP=$IP" >> $GITHUB_ENV
echo "OCI_ROOT_URL=http://$IP:5000" >> $GITHUB_ENV
cp config.example.yaml config.yaml
yq e -i '.environment = "ci"' config.yaml
IP=$IP yq e -i '.database.host = env(IP)' config.yaml
yq e -i '.dfs.mock.enabled = "true"' config.yaml
yq e -i '.dfs.mock.type = "FS"' config.yaml
go mod download
go build
echo "IP=$IP" >> $GITHUB_ENV
echo "OCI_ROOT_URL=http://$IP:5000" >> $GITHUB_ENV
DISTRIBUTION_REF="local-distribution:v$(date +%Y%m%d%H%M%S)"
docker build -f ./Dockerfile -t "${DISTRIBUTION_REF}" .
make certs
./OpenRegistry migrations init \
--admin-db="postgres" \
--admin-db-username="postgres" \
--admin-db-password=${POSTGRES_PASSWORD} \
--database=${POSTGRES_DB} \
--host=${IP} \
--password=${POSTGRES_PASSWORD} \
--insecure=true
nohup ./OpenRegistry start >> openregistry.log &
sleep 3
curl -XPOST -d '{"email": "[email protected]", "username": "johndoe", "password": "Qwerty@123"}' "http://${IP}:5000/auth/signup"
cat openregistry.log
docker run --rm -p 5000:5000 -p 8080:8080 \
--mount="type=bind,source=${PWD}/config.yaml,target=/home/runner/.openregistry/config.yaml" \
-v "$PWD/.certs:/home/runner/.certs" \
--env="CI_SYS_ADDR=$IP:5000" -d "${DISTRIBUTION_REF}"
sleep 5
curl -XPOST -d ${{ secrets.OPENREGISTRY_SIGNUP_PAYLOAD }} "http://${IP}:5000/auth/signup"
- name: Run OCI Distribution Spec conformance tests
if: always()
run: |
cd ../
git clone https://github.com/opencontainers/distribution-spec.git
pushd distribution-spec/conformance
git checkout v1.1.0-rc.3
git checkout 235fa1b
go test -c
./conformance.test
popd
mkdir -p .out/ && mv {distribution-spec/conformance/report.html,distribution-spec/conformance/junit.xml} .out/
env:
OCI_ROOT_URL: ${{ env.OCI_ROOT_URL }}
OCI_USERNAME: johndoe
OCI_PASSWORD: Qwerty@123
OCI_NAMESPACE: johndoe/distribution-test
OCI_USERNAME: ${{ secrets.OPENREGISTRY_USERNAME }}
OCI_PASSWORD: ${{ secrets.OPENREGISTRY_PASSWORD }}
OCI_NAMESPACE: ${{ secrets.OPENREGISTRY_USERNAME }}/distribution-test
OCI_TEST_PUSH: 1
OCI_HIDE_SKIPPED_WORKFLOWS: 1
OCI_CROSSMOUNT_NAMESPACE: johndoe/distribution-cross-mount
OCI_CROSSMOUNT_NAMESPACE: ${{secrets.OPENREGISTRY_USERNAME}}/distribution-cross-mount
OCI_DEBUG: 0
- name: Setup tmate session if mode is debug and OpenRegistry or OCI Tests Fail
uses: mxschmitt/action-tmate@v3
Expand All @@ -99,4 +94,4 @@ jobs:
with:
name: oci-distribution-content-discovery-report-${{ steps.vars.outputs.short_commit_hash }}
path: .out/
if: success()
if: always()
74 changes: 35 additions & 39 deletions .github/workflows/oci-dist-spec-content-management.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: OCI Distribution Spec - Content Management
name: OCI Distribution Spec

on:
pull_request:
workflow_dispatch:
workflow_call:
inputs:
debug_enabled:
type: boolean
Expand All @@ -14,23 +13,17 @@ 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:
content-management:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
PGUSER: postgres
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_DB: open_registry
POSTGRES_PASSWORD: Qwerty@123
POSTGRES_USER: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
Expand All @@ -39,53 +32,56 @@ jobs:
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- uses: actions/checkout@v4
- name: Install Migrate CLI
run: |
curl -L https://github.com/golang-migrate/migrate/releases/download/v4.15.1/migrate.linux-amd64.tar.gz | tar xvz
sudo mv migrate /usr/bin/migrate
- name: Setup PostgreSQL Database
run: |
IP=`hostname -I | awk '{print $1}'`
POSTGRESQL_URL=postgres://$PGUSER:$PGPASSWORD@$IP:5432/$PGDATABASE?sslmode=disable
migrate -database ${POSTGRESQL_URL} -path db/migrations up
env:
PGDATABASE: open_registry
PGPASSWORD: Qwerty@123
PGUSER: postgres
- name: Build and configure OpenRegistry container image
run: |
IP=`hostname -I | awk '{print $1}'`
echo "IP=$IP" >> $GITHUB_ENV
echo "OCI_ROOT_URL=http://$IP:5000" >> $GITHUB_ENV
cp config.example.yaml config.yaml
yq e -i '.environment = "ci"' config.yaml
IP=$IP yq e -i '.database.host = env(IP)' config.yaml
yq e -i '.dfs.mock.enabled = "true"' config.yaml
yq e -i '.dfs.mock.type = "FS"' config.yaml
go mod download
go build
echo "IP=$IP" >> $GITHUB_ENV
echo "OCI_ROOT_URL=http://$IP:5000" >> $GITHUB_ENV
DISTRIBUTION_REF="local-distribution:v$(date +%Y%m%d%H%M%S)"
docker build -f ./Dockerfile -t "${DISTRIBUTION_REF}" .
make certs
./OpenRegistry migrations init \
--admin-db="postgres" \
--admin-db-username="postgres" \
--admin-db-password=${POSTGRES_PASSWORD} \
--database=${POSTGRES_DB} \
--host=${IP} \
--password=${POSTGRES_PASSWORD} \
--insecure=true
nohup ./OpenRegistry start >> openregistry.log &
sleep 3
curl -XPOST -d '{"email": "[email protected]", "username": "johndoe", "password": "Qwerty@123"}' "http://${IP}:5000/auth/signup"
cat openregistry.log
docker run --rm -p 5000:5000 -p 8080:8080 \
--mount="type=bind,source=${PWD}/config.yaml,target=/home/runner/.openregistry/config.yaml" \
-v "$PWD/.certs:/home/runner/.certs" \
--env="CI_SYS_ADDR=$IP:5000" -d "${DISTRIBUTION_REF}"
sleep 5
curl -XPOST -d ${{ secrets.OPENREGISTRY_SIGNUP_PAYLOAD }} "http://${IP}:5000/auth/signup"
- name: Run OCI Distribution Spec conformance tests
if: always()
run: |
git clone https://github.com/opencontainers/distribution-spec.git
pushd distribution-spec/conformance
git checkout v1.1.0-rc.3
git checkout 235fa1b
go test -c
./conformance.test
popd
mkdir -p .out/ && mv {distribution-spec/conformance/report.html,distribution-spec/conformance/junit.xml} .out/
env:
OCI_ROOT_URL: ${{ env.OCI_ROOT_URL }}
OCI_USERNAME: johndoe
OCI_PASSWORD: Qwerty@123
OCI_NAMESPACE: johndoe/distribution-test
OCI_USERNAME: ${{ secrets.OPENREGISTRY_USERNAME }}
OCI_PASSWORD: ${{ secrets.OPENREGISTRY_PASSWORD }}
OCI_NAMESPACE: ${{ secrets.OPENREGISTRY_USERNAME }}/distribution-test
OCI_TEST_PUSH: 1
OCI_HIDE_SKIPPED_WORKFLOWS: 1
OCI_CROSSMOUNT_NAMESPACE: johndoe/distribution-cross-mount
OCI_CROSSMOUNT_NAMESPACE: ${{secrets.OPENREGISTRY_USERNAME}}/distribution-cross-mount
OCI_DEBUG: 0
- name: Setup tmate session if mode is debug and OpenRegistry or OCI Tests Fail
uses: mxschmitt/action-tmate@v3
Expand Down
67 changes: 32 additions & 35 deletions .github/workflows/oci-dist-spec-pull.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: OCI Distribution Spec - Pull Image
name: OCI Distribution Spec

on:
pull_request:
workflow_dispatch:
workflow_call:
inputs:
debug_enabled:
type: boolean
Expand All @@ -14,23 +13,17 @@ concurrency:
group: pull-${{ 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:
pull:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
PGUSER: postgres
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_DB: open_registry
POSTGRES_PASSWORD: Qwerty@123
POSTGRES_USER: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
Expand All @@ -39,41 +32,45 @@ jobs:
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- uses: actions/checkout@v4
- name: Install Migrate CLI
run: |
curl -L https://github.com/golang-migrate/migrate/releases/download/v4.15.1/migrate.linux-amd64.tar.gz | tar xvz
sudo mv migrate /usr/bin/migrate
- name: Setup PostgreSQL Database
run: |
IP=`hostname -I | awk '{print $1}'`
POSTGRESQL_URL=postgres://$PGUSER:$PGPASSWORD@$IP:5432/$PGDATABASE?sslmode=disable
migrate -database ${POSTGRESQL_URL} -path db/migrations up
env:
PGDATABASE: open_registry
PGPASSWORD: Qwerty@123
PGUSER: postgres
- name: Build and configure OpenRegistry container image
run: |
IP=`hostname -I | awk '{print $1}'`
echo "IP=$IP" >> $GITHUB_ENV
echo "OCI_ROOT_URL=http://$IP:5000" >> $GITHUB_ENV
cp config.example.yaml config.yaml
yq e -i '.environment = "ci"' config.yaml
IP=$IP yq e -i '.database.host = env(IP)' config.yaml
yq e -i '.dfs.mock.enabled = "true"' config.yaml
yq e -i '.dfs.mock.type = "FS"' config.yaml
go mod download
go build
echo "IP=$IP" >> $GITHUB_ENV
echo "OCI_ROOT_URL=http://$IP:5000" >> $GITHUB_ENV
DISTRIBUTION_REF="local-distribution:v$(date +%Y%m%d%H%M%S)"
docker build -f ./Dockerfile -t "${DISTRIBUTION_REF}" .
make certs
./OpenRegistry migrations init \
--admin-db="postgres" \
--admin-db-username="postgres" \
--admin-db-password=${POSTGRES_PASSWORD} \
--database=${POSTGRES_DB} \
--host=${IP} \
--password=${POSTGRES_PASSWORD} \
--insecure=true
nohup ./OpenRegistry start >> openregistry.log &
sleep 3
curl -XPOST -d '{"email": "[email protected]", "username": "johndoe", "password": "Qwerty@123"}' "http://${IP}:5000/auth/signup"
cat openregistry.log
docker run --rm -p 5000:5000 -p 8080:8080 \
--mount="type=bind,source=${PWD}/config.yaml,target=/home/runner/.openregistry/config.yaml" \
-v "$PWD/.certs:/home/runner/.certs" \
--env="CI_SYS_ADDR=$IP:5000" --name openregistry -d "${DISTRIBUTION_REF}"
sleep 5
curl -XPOST -d ${{ secrets.OPENREGISTRY_SIGNUP_PAYLOAD }} "http://${IP}:5000/auth/signup"
docker logs openregistry
- name: Run OCI Distribution Spec conformance tests
if: always()
run: |
git clone https://github.com/opencontainers/distribution-spec.git
pushd distribution-spec/conformance
git checkout v1.1.0-rc.3
git checkout 235fa1b
go test -c
./conformance.test
popd
Expand Down
Loading
Loading