From 50a212dfb239b65ed67e5eb17fab2c104afddc02 Mon Sep 17 00:00:00 2001 From: Guy Owen Date: Wed, 22 Jul 2026 15:32:32 +1000 Subject: [PATCH 01/10] feat: added AWS registry for db seeding on Marina. --- .docker/Dockerfile.seed | 2 + .github/workflows/run_db_trigger.yml | 57 +++++++++++++++++++++++----- 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/.docker/Dockerfile.seed b/.docker/Dockerfile.seed index 381d99f3..c7e9d9c3 100644 --- a/.docker/Dockerfile.seed +++ b/.docker/Dockerfile.seed @@ -1,8 +1,10 @@ FROM ghcr.io/dpc-sdp/bay/mariadb:6.x ARG DATA_DIR=/tmp/data +ARG DB_FILE=db.sql COPY $DATA_DIR /var/lib/mysql +COPY $DB_FILE /var/tmp/db.sql USER root diff --git a/.github/workflows/run_db_trigger.yml b/.github/workflows/run_db_trigger.yml index c6086b4f..2c101adb 100644 --- a/.github/workflows/run_db_trigger.yml +++ b/.github/workflows/run_db_trigger.yml @@ -23,6 +23,21 @@ on: type: string required: false default: ubuntu-latest + aws-region: + description: 'AWS region' + required: false + type: string + default: ap-southeast-4 + ecr-registry: + description: 'ECR registry' + required: true + type: string + default: 734101502693.dkr.ecr.ap-southeast-4.amazonaws.com + ecr-push-role-arn: + description: 'ECR push role ARN' + required: true + type: string + default: arn:aws:iam::734101502693:role/GithubEcrPushRole secrets: AWS_ACCESS_KEY_ID: @@ -49,7 +64,6 @@ jobs: packages: write id-token: write env: - REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }}/mariadb TMP_DATA_DIR: data DB_FILE: db.sql @@ -107,40 +121,65 @@ jobs: fi - name: Download the DB image dockerfile - run: curl -o Dockerfile.seed https://raw.githubusercontent.com/dpc-sdp/github-actions/main/.docker/Dockerfile.seed + run: curl -o Dockerfile.seed https://github.com/dpc-sdp/github-actions/blob/feat/PENG-1779--push-to-ecr/.docker/Dockerfile.seed # Login against a Docker registry except on PR # https://github.com/docker/login-action - name: Log into registry ghcr.io uses: docker/login-action@v3 with: - registry: ${{ env.REGISTRY }} + registry: ghcr.io username: ${{ secrets.REGISTRY_USER }} password: ${{ secrets.REGISTRY_TOKEN }} + - name: Configure AWS credentials for registry push + uses: aws-actions/configure-aws-credentials@v6 + with: + role-to-assume: ${{ inputs.ecr-push-role-arn }} + aws-region: ${{ inputs.aws-region }} + + - name: Login to Amazon ECR + uses: aws-actions/amazon-ecr-login@v2 + # Extract metadata (tags, labels) for Docker # https://github.com/docker/metadata-action - name: Extract Docker metadata id: meta uses: docker/metadata-action@v5 with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=branch - + images: | + ghcr.io/${{ env.IMAGE_NAME }} + ${{ inputs.ecr-registry }}/marina-platform/databases/${{ github.event.repository.name }}/mariadb + flavor: | + latest=true - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Validate DB file is present in build context + run: | + if [ ! -s "${{ env.DB_FILE }}" ]; then + echo "Expected database file '${{ env.DB_FILE }}' is missing or empty in build context." + echo "Current directory: $(pwd)" + echo "Directory contents:" + ls -la + exit 1 + fi + + echo "Found '${{ env.DB_FILE }}' in build context." + ls -lh "${{ env.DB_FILE }}" + - name: Build and push the database image uses: docker/build-push-action@v5 with: file: Dockerfile.seed context: . - build-args: DATA_DIR=${{ env.TMP_DATA_DIR }} - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + build-args: | + DATA_DIR=${{ env.TMP_DATA_DIR }} + DB_FILE=${{ env.DB_FILE }} + tags: ${{ steps.meta.outputs.tags }} platforms: linux/amd64,linux/arm64 labels: ${{ steps.meta.outputs.labels }} annotations: ${{ steps.meta.outputs.annotations }} From 2a448eb996b9fc41f852969647511fa73d44de65 Mon Sep 17 00:00:00 2001 From: Guy Owen Date: Wed, 22 Jul 2026 21:42:53 +1000 Subject: [PATCH 02/10] feat: added AWS registry for db seeding on Marina. --- .github/workflows/run_db_trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_db_trigger.yml b/.github/workflows/run_db_trigger.yml index 2c101adb..d355cf90 100644 --- a/.github/workflows/run_db_trigger.yml +++ b/.github/workflows/run_db_trigger.yml @@ -121,7 +121,7 @@ jobs: fi - name: Download the DB image dockerfile - run: curl -o Dockerfile.seed https://github.com/dpc-sdp/github-actions/blob/feat/PENG-1779--push-to-ecr/.docker/Dockerfile.seed + run: curl -o Dockerfile.seed https://raw.githubusercontent.com/dpc-sdp/github-actions/refs/heads/feat/PENG-1779--push-to-ecr/.docker/Dockerfile.seed # Login against a Docker registry except on PR # https://github.com/docker/login-action From 67ca69f3da13018afe902945d50736188a23e3c9 Mon Sep 17 00:00:00 2001 From: Guy Owen Date: Thu, 23 Jul 2026 18:18:01 +1000 Subject: [PATCH 03/10] debug: switch Docker context to facilitate cnf inclusion --- .docker/01-marina.cnf | 5 +++++ .docker/Dockerfile.seed | 1 + .github/workflows/run_db_trigger.yml | 6 +++--- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .docker/01-marina.cnf diff --git a/.docker/01-marina.cnf b/.docker/01-marina.cnf new file mode 100644 index 00000000..e7e33e81 --- /dev/null +++ b/.docker/01-marina.cnf @@ -0,0 +1,5 @@ +# Marina specific cli settings +[mysql] +# Enable maximal verbose tracing for the mysql CLI tool +debug = d +verbose \ No newline at end of file diff --git a/.docker/Dockerfile.seed b/.docker/Dockerfile.seed index c7e9d9c3..86ab2ba8 100644 --- a/.docker/Dockerfile.seed +++ b/.docker/Dockerfile.seed @@ -5,6 +5,7 @@ ARG DB_FILE=db.sql COPY $DATA_DIR /var/lib/mysql COPY $DB_FILE /var/tmp/db.sql +COPY 01-marina.cnf /etc/mysql/conf.d/ USER root diff --git a/.github/workflows/run_db_trigger.yml b/.github/workflows/run_db_trigger.yml index d355cf90..c82fc96d 100644 --- a/.github/workflows/run_db_trigger.yml +++ b/.github/workflows/run_db_trigger.yml @@ -120,8 +120,8 @@ jobs: exit 1 fi - - name: Download the DB image dockerfile - run: curl -o Dockerfile.seed https://raw.githubusercontent.com/dpc-sdp/github-actions/refs/heads/feat/PENG-1779--push-to-ecr/.docker/Dockerfile.seed +# - name: Download the DB image dockerfile +# run: curl -o Dockerfile.seed https://raw.githubusercontent.com/dpc-sdp/github-actions/refs/heads/feat/PENG-1779--push-to-ecr/.docker/Dockerfile.seed # Login against a Docker registry except on PR # https://github.com/docker/login-action @@ -175,7 +175,7 @@ jobs: uses: docker/build-push-action@v5 with: file: Dockerfile.seed - context: . + context: ./.docker build-args: | DATA_DIR=${{ env.TMP_DATA_DIR }} DB_FILE=${{ env.DB_FILE }} From ad0e0cacd9dc6adf932682b294affec8fcb372ba Mon Sep 17 00:00:00 2001 From: Guy Owen Date: Thu, 23 Jul 2026 18:29:49 +1000 Subject: [PATCH 04/10] debug: switch Docker context to facilitate cnf inclusion --- .github/workflows/run_db_trigger.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run_db_trigger.yml b/.github/workflows/run_db_trigger.yml index c82fc96d..e8ddc5a4 100644 --- a/.github/workflows/run_db_trigger.yml +++ b/.github/workflows/run_db_trigger.yml @@ -120,8 +120,11 @@ jobs: exit 1 fi -# - name: Download the DB image dockerfile -# run: curl -o Dockerfile.seed https://raw.githubusercontent.com/dpc-sdp/github-actions/refs/heads/feat/PENG-1779--push-to-ecr/.docker/Dockerfile.seed + - name: Download the DB image dockerfile + run: curl -o Dockerfile.seed https://raw.githubusercontent.com/dpc-sdp/github-actions/refs/heads/feat/PENG-1779--push-to-ecr/.docker/Dockerfile.seed + + - name: Download the DB image dockerfile + run: curl -o 01-marina.cnf https://raw.githubusercontent.com/dpc-sdp/github-actions/refs/heads/feat/PENG-1779--push-to-ecr/.docker/01-marina.cnf # Login against a Docker registry except on PR # https://github.com/docker/login-action @@ -175,7 +178,7 @@ jobs: uses: docker/build-push-action@v5 with: file: Dockerfile.seed - context: ./.docker + context: . build-args: | DATA_DIR=${{ env.TMP_DATA_DIR }} DB_FILE=${{ env.DB_FILE }} From 1d0e80bf55c0ce7a681b659b8f0bab83c4848414 Mon Sep 17 00:00:00 2001 From: Guy Owen Date: Thu, 23 Jul 2026 20:20:50 +1000 Subject: [PATCH 05/10] chore: changed requirement for inputs to avoid downstream updates. --- .github/workflows/run_db_trigger.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_db_trigger.yml b/.github/workflows/run_db_trigger.yml index e8ddc5a4..126d3c7f 100644 --- a/.github/workflows/run_db_trigger.yml +++ b/.github/workflows/run_db_trigger.yml @@ -30,12 +30,12 @@ on: default: ap-southeast-4 ecr-registry: description: 'ECR registry' - required: true + required: false type: string default: 734101502693.dkr.ecr.ap-southeast-4.amazonaws.com ecr-push-role-arn: description: 'ECR push role ARN' - required: true + required: false type: string default: arn:aws:iam::734101502693:role/GithubEcrPushRole From ef2502f412685a8a0af98d5f541e32891f4304a8 Mon Sep 17 00:00:00 2001 From: Guy Owen Date: Thu, 23 Jul 2026 20:25:26 +1000 Subject: [PATCH 06/10] chore: reverted file path in prep for merge. --- .github/workflows/run_db_trigger.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_db_trigger.yml b/.github/workflows/run_db_trigger.yml index 126d3c7f..bd5693f3 100644 --- a/.github/workflows/run_db_trigger.yml +++ b/.github/workflows/run_db_trigger.yml @@ -121,10 +121,10 @@ jobs: fi - name: Download the DB image dockerfile - run: curl -o Dockerfile.seed https://raw.githubusercontent.com/dpc-sdp/github-actions/refs/heads/feat/PENG-1779--push-to-ecr/.docker/Dockerfile.seed + run: curl -o Dockerfile.seed https://raw.githubusercontent.com/dpc-sdp/github-actions/main/.docker/Dockerfile.seed - name: Download the DB image dockerfile - run: curl -o 01-marina.cnf https://raw.githubusercontent.com/dpc-sdp/github-actions/refs/heads/feat/PENG-1779--push-to-ecr/.docker/01-marina.cnf + run: curl -o 01-marina.cnf https://raw.githubusercontent.com/dpc-sdp/github-actions/main/.docker/01-marina.cnf # Login against a Docker registry except on PR # https://github.com/docker/login-action From de64b9b8b33ff311d7d05c5e4cb03f78665e0835 Mon Sep 17 00:00:00 2001 From: Guy Owen Date: Thu, 23 Jul 2026 20:32:12 +1000 Subject: [PATCH 07/10] chore: updated step name. --- .github/workflows/run_db_trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_db_trigger.yml b/.github/workflows/run_db_trigger.yml index bd5693f3..2d5cfe8a 100644 --- a/.github/workflows/run_db_trigger.yml +++ b/.github/workflows/run_db_trigger.yml @@ -123,7 +123,7 @@ jobs: - name: Download the DB image dockerfile run: curl -o Dockerfile.seed https://raw.githubusercontent.com/dpc-sdp/github-actions/main/.docker/Dockerfile.seed - - name: Download the DB image dockerfile + - name: Download Marina config file run: curl -o 01-marina.cnf https://raw.githubusercontent.com/dpc-sdp/github-actions/main/.docker/01-marina.cnf # Login against a Docker registry except on PR From b444fed2f8f2f7fd5b3f334cb39230006acc8cc2 Mon Sep 17 00:00:00 2001 From: Guy Owen Date: Mon, 27 Jul 2026 16:13:03 +1000 Subject: [PATCH 08/10] fix(PENG-1779): removed setting of disabled flag. --- .docker/01-marina.cnf | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.docker/01-marina.cnf b/.docker/01-marina.cnf index e7e33e81..743d013f 100644 --- a/.docker/01-marina.cnf +++ b/.docker/01-marina.cnf @@ -1,5 +1,4 @@ # Marina specific cli settings [mysql] -# Enable maximal verbose tracing for the mysql CLI tool -debug = d -verbose \ No newline at end of file +# Increase verbosity of CLI tool +verbose From bd898b7ee0302f7184d4883cab04f2b741aa90cb Mon Sep 17 00:00:00 2001 From: Guy Owen Date: Mon, 27 Jul 2026 16:27:01 +1000 Subject: [PATCH 09/10] Reverted branch ref update for testing. --- .github/workflows/run_db_trigger.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_db_trigger.yml b/.github/workflows/run_db_trigger.yml index 2d5cfe8a..a8aba9ce 100644 --- a/.github/workflows/run_db_trigger.yml +++ b/.github/workflows/run_db_trigger.yml @@ -121,10 +121,10 @@ jobs: fi - name: Download the DB image dockerfile - run: curl -o Dockerfile.seed https://raw.githubusercontent.com/dpc-sdp/github-actions/main/.docker/Dockerfile.seed + run: curl -o Dockerfile.seed https://raw.githubusercontent.com/dpc-sdp/github-actions/refs/heads/feat/PENG-1779--push-to-ecr/.docker/Dockerfile.seed - name: Download Marina config file - run: curl -o 01-marina.cnf https://raw.githubusercontent.com/dpc-sdp/github-actions/main/.docker/01-marina.cnf + run: curl -o 01-marina.cnf https://raw.githubusercontent.com/dpc-sdp/github-actions/refs/heads/feat/PENG-1779--push-to-ecr/.docker/01-marina.cnf # Login against a Docker registry except on PR # https://github.com/docker/login-action From da2ec346a35825d3366c0d777291234551775bf4 Mon Sep 17 00:00:00 2001 From: Guy Owen Date: Mon, 27 Jul 2026 16:43:43 +1000 Subject: [PATCH 10/10] fix: updated perms after copy --- .docker/Dockerfile.seed | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.docker/Dockerfile.seed b/.docker/Dockerfile.seed index 86ab2ba8..10f7a1ac 100644 --- a/.docker/Dockerfile.seed +++ b/.docker/Dockerfile.seed @@ -9,6 +9,8 @@ COPY 01-marina.cnf /etc/mysql/conf.d/ USER root +RUN fix-permissions /etc/mysql/conf.d/ + RUN chown -R mysql /var/lib/mysql \ && chgrp -R mysql /var/lib/mysql \ && /bin/fix-permissions /var/lib/mysql