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

feat(store): Migration overhaul (bun orm) #396

Merged
merged 31 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
19defdc
feat(store): Migration overhaul (bun orm)
jay-dee7 Aug 11, 2023
4e9bc49
refactor: Migration commands flags for db dsn
jay-dee7 Aug 12, 2023
92cbd2a
refactor(ci): New migration commands in OCI Push action
jay-dee7 Aug 12, 2023
8455b47
refactor: Split & organize migration commands
jay-dee7 Aug 13, 2023
21f6206
refactor: Switch to uuid.UUID for Primary identifiers
jay-dee7 Aug 14, 2023
97654ec
refactor: Command reorganization
jay-dee7 Aug 14, 2023
1021e3d
refactor: Change RepositoryVisibility enum to string typed
jay-dee7 Aug 15, 2023
22f9245
feat: Build automation store rewrite
jay-dee7 Oct 15, 2023
c43936e
refactor: Use store v2 in Protobuf handlers
jay-dee7 Oct 21, 2023
3fba6a9
remove: Skynet references
jay-dee7 Oct 22, 2023
cee7abc
feat: Zerolog writers for axiom.co & fluent-bit
jay-dee7 Oct 24, 2023
49cbd18
fix: Migration cmd flags
jay-dee7 Oct 26, 2023
c171ceb
feat: Add "subject" column to ImageManifest table
jay-dee7 Oct 26, 2023
0f9ae1b
remove: Old database migration/setup files
jay-dee7 Oct 26, 2023
9656269
feat: Add the OCI Referrers API
jay-dee7 Oct 26, 2023
7e83644
feat: Mock storage backends - FS & MemMapped
jay-dee7 Oct 28, 2023
bbc7828
feat(oci): Run OCI conformance from v1.1.0-rc.2
jay-dee7 Oct 30, 2023
a31341f
fix: Migration commands & re-organize commands
jay-dee7 Oct 30, 2023
16e874d
fix: Mutex lock for layer size setting
jay-dee7 Oct 30, 2023
213b621
add: Enums for OCI MediaTypes
jay-dee7 Oct 30, 2023
d2bd487
feat: OCI Image Referrers API
jay-dee7 Oct 30, 2023
68e7564
fix: Update mock storage type in OCI GHA
jay-dee7 Oct 30, 2023
adbdafb
fix: Logging request start time
jay-dee7 Nov 8, 2023
4b1b835
fix: Referrers list query
jay-dee7 Nov 15, 2023
5ae8601
chore: Bump OCI workflows to v1.1.0-rc.3
jay-dee7 Nov 15, 2023
7312ff4
add: Annotations to image manifests & index
jay-dee7 Nov 17, 2023
478ed4a
chore: Update GHA run status badges
jay-dee7 Nov 17, 2023
b515f75
chore(ci): Move GHA for OCI Spec outside of workflow dispatcher
jay-dee7 Nov 17, 2023
3b26104
chore: Fix README.md GHA badges
jay-dee7 Nov 17, 2023
c34b4ed
remove: Old store implementation
jay-dee7 Nov 17, 2023
b1cb2c5
refactor: Store file structure
jay-dee7 Nov 17, 2023
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: 0 additions & 32 deletions .github/workflows/dispatch.yml

This file was deleted.

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:
workflow_call:
pull_request:

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

on:
workflow_call:
pull_request:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
Expand All @@ -13,17 +14,23 @@ 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:
content-discovery:
conformance:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
PGUSER: postgres
POSTGRES_DB: open_registry
POSTGRES_PASSWORD: Qwerty@123
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: Qwerty@123
options: >-
--health-cmd pg_isready
--health-interval 10s
Expand All @@ -33,55 +40,53 @@ jobs:
- 5432:5432
steps:
- 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
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- 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
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}" .
yq e -i '.dfs.mock.type = "FS"' config.yaml
go mod download
go build
make certs
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"
./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
- 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 235fa1b
git checkout v1.1.0-rc.3
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: ${{ secrets.OPENREGISTRY_USERNAME }}
OCI_PASSWORD: ${{ secrets.OPENREGISTRY_PASSWORD }}
OCI_NAMESPACE: ${{ secrets.OPENREGISTRY_USERNAME }}/distribution-test
OCI_USERNAME: johndoe
OCI_PASSWORD: Qwerty@123
OCI_NAMESPACE: johndoe/distribution-test
OCI_TEST_PUSH: 1
OCI_HIDE_SKIPPED_WORKFLOWS: 1
OCI_CROSSMOUNT_NAMESPACE: ${{secrets.OPENREGISTRY_USERNAME}}/distribution-cross-mount
OCI_CROSSMOUNT_NAMESPACE: johndoe/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 @@ -94,4 +99,4 @@ jobs:
with:
name: oci-distribution-content-discovery-report-${{ steps.vars.outputs.short_commit_hash }}
path: .out/
if: always()
if: success()
74 changes: 39 additions & 35 deletions .github/workflows/oci-dist-spec-content-management.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: OCI Distribution Spec
name: OCI Distribution Spec - Content Management

on:
workflow_call:
pull_request:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
Expand All @@ -13,17 +14,23 @@ 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:
content-management:
conformance:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
PGUSER: postgres
POSTGRES_DB: open_registry
POSTGRES_PASSWORD: Qwerty@123
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: Qwerty@123
options: >-
--health-cmd pg_isready
--health-interval 10s
Expand All @@ -32,56 +39,53 @@ jobs:
ports:
- 5432:5432
steps:
- 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
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- 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
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}" .
yq e -i '.dfs.mock.type = "FS"' config.yaml
go mod download
go build
make certs
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"
./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
- 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 235fa1b
git checkout v1.1.0-rc.3
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: ${{ secrets.OPENREGISTRY_USERNAME }}
OCI_PASSWORD: ${{ secrets.OPENREGISTRY_PASSWORD }}
OCI_NAMESPACE: ${{ secrets.OPENREGISTRY_USERNAME }}/distribution-test
OCI_USERNAME: johndoe
OCI_PASSWORD: Qwerty@123
OCI_NAMESPACE: johndoe/distribution-test
OCI_TEST_PUSH: 1
OCI_HIDE_SKIPPED_WORKFLOWS: 1
OCI_CROSSMOUNT_NAMESPACE: ${{secrets.OPENREGISTRY_USERNAME}}/distribution-cross-mount
OCI_CROSSMOUNT_NAMESPACE: johndoe/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: 35 additions & 32 deletions .github/workflows/oci-dist-spec-pull.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: OCI Distribution Spec
name: OCI Distribution Spec - Pull Image

on:
workflow_call:
pull_request:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
Expand All @@ -13,17 +14,23 @@ 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:
pull:
conformance:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
PGUSER: postgres
POSTGRES_DB: open_registry
POSTGRES_PASSWORD: Qwerty@123
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: Qwerty@123
options: >-
--health-cmd pg_isready
--health-interval 10s
Expand All @@ -32,45 +39,41 @@ jobs:
ports:
- 5432:5432
steps:
- 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
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- 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
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}" .
yq e -i '.dfs.mock.type = "FS"' config.yaml
go mod download
go build
make certs
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
./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
- 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 235fa1b
git checkout v1.1.0-rc.3
go test -c
./conformance.test
popd
Expand Down
Loading
Loading