From be4f651a37477d0df48d3c17c9729263e6963a6c Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 12:29:08 -0800 Subject: [PATCH 01/55] ci: scrub for changed Dockerfiles --- .github/workflows/pr-open.yml | 157 ++++++++++++++++++---------------- 1 file changed, 85 insertions(+), 72 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 1bfaaba2..0e1bd01c 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -10,83 +10,96 @@ concurrency: cancel-in-progress: true jobs: - # https://github.com/bcgov-nr/action-builder-ghcr - builds: - name: Builds - if: "!github.event.pull_request.head.repo.fork" - permissions: - packages: write + scrub: + name: Scrub for changed Dockerfiles runs-on: ubuntu-22.04 - strategy: - matrix: - include: - - package: bitnami/pgpool - major_tag: 4 - - package: bitnami/postgresql - major_tag: 12 - - package: bitnami/postgresql - major_tag: 13 - - package: bitnami/postgresql - major_tag: 14 - - package: bitnami/postgresql - major_tag: 15 - - package: bitnami/postgresql - major_tag: 16 - - package: bitnami/postgresql-ha - major_tag: 12 - - package: bitnami/postgresql-ha - major_tag: 13 - - package: bitnami/postgresql-ha - major_tag: 14 - - package: bitnami/postgresql-ha - major_tag: 15 - - package: bitnami/postgresql-ha - major_tag: 16 - - package: mongo - major_tag: 6 - - package: mongo - major_tag: 7 - - package: postgres - major_tag: 12 - - package: postgres - major_tag: 13 - - package: postgres - major_tag: 14 - - package: postgres - major_tag: 15 - - package: postgres - major_tag: 16 - timeout-minutes: 10 steps: - uses: actions/checkout@v4 - - name: Get tag - id: tag + - name: Get Dockerfiles + id: dockerfiles run: | - TAG=$(grep '^FROM' ${{ matrix.package }}/${{ matrix.major_tag }}/Dockerfile | cut -d':' -f2) - echo "full_tag=${TAG}" >> $GITHUB_OUTPUT + # Get all Dockerfiles that have changed + DOCKERFILES=$(git diff --name-only ${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) + echo "dockerfiles=${DOCKERFILES}" >> $GITHUB_OUTPUT + echo -e "Dockerfiles: \n $DOCKERFILES" - - name: Build or import - uses: bcgov-nr/action-builder-ghcr@v2.0.0 - with: - build_context: ${{ matrix.package }}/${{ matrix.major_tag }} - package: ${{ matrix.package }} - tag: ${{ steps.tag.outputs.full_tag }} - triggers: ${{ matrix.package}}/${{ matrix.triggers }} + # # https://github.com/bcgov-nr/action-builder-ghcr + # builds: + # name: Builds + # if: "!github.event.pull_request.head.repo.fork" + # permissions: + # packages: write + # runs-on: ubuntu-22.04 + # strategy: + # matrix: + # include: + # - package: bitnami/pgpool + # major_tag: 4 + # - package: bitnami/postgresql + # major_tag: 12 + # - package: bitnami/postgresql + # major_tag: 13 + # - package: bitnami/postgresql + # major_tag: 14 + # - package: bitnami/postgresql + # major_tag: 15 + # - package: bitnami/postgresql + # major_tag: 16 + # - package: bitnami/postgresql-ha + # major_tag: 12 + # - package: bitnami/postgresql-ha + # major_tag: 13 + # - package: bitnami/postgresql-ha + # major_tag: 14 + # - package: bitnami/postgresql-ha + # major_tag: 15 + # - package: bitnami/postgresql-ha + # major_tag: 16 + # - package: mongo + # major_tag: 6 + # - package: mongo + # major_tag: 7 + # - package: postgres + # major_tag: 12 + # - package: postgres + # major_tag: 13 + # - package: postgres + # major_tag: 14 + # - package: postgres + # major_tag: 15 + # - package: postgres + # major_tag: 16 + # timeout-minutes: 10 + # steps: + # - uses: actions/checkout@v4 + # - name: Get tag + # id: tag + # run: | + # TAG=$(grep '^FROM' ${{ matrix.package }}/${{ matrix.major_tag }}/Dockerfile | cut -d':' -f2) + # echo "full_tag=${TAG}" >> $GITHUB_OUTPUT - pr-description-add: - name: PR Description Add - needs: [builds] - runs-on: ubuntu-22.04 - permissions: - pull-requests: write - timeout-minutes: 1 - steps: - - uses: bcgov-nr/action-pr-description-add@v1.1.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - add_markdown: | - --- + # - name: Build or import + # uses: bcgov-nr/action-builder-ghcr@v2.0.0 + # with: + # build_context: ${{ matrix.package }}/${{ matrix.major_tag }} + # package: ${{ matrix.package }} + # tag: ${{ steps.tag.outputs.full_tag }} + # triggers: ${{ matrix.package}}/${{ matrix.triggers }} + + # pr-description-add: + # name: PR Description Add + # needs: [builds] + # runs-on: ubuntu-22.04 + # permissions: + # pull-requests: write + # timeout-minutes: 1 + # steps: + # - uses: bcgov-nr/action-pr-description-add@v1.1.0 + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # add_markdown: | + # --- - Thanks for the PR! + # Thanks for the PR! - Any new images should be viewable with [our repo packages](https://github.com/orgs/bcgov/packages?repo_name=nr-containers). :) + # Any new images should be viewable with [our repo packages](https://github.com/orgs/bcgov/packages?repo_name=nr-containers). :) From 84812718ed8cbe358aab9a60fe13552b4139bf09 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 15 Nov 2023 20:16:14 +0000 Subject: [PATCH 02/55] chore(deps): update bitnami/postgresql docker tag to v16.1.0 --- bitnami/postgresql/12/Dockerfile | 2 +- bitnami/postgresql/13/Dockerfile | 2 +- bitnami/postgresql/14/Dockerfile | 2 +- bitnami/postgresql/15/Dockerfile | 2 +- bitnami/postgresql/16/Dockerfile | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bitnami/postgresql/12/Dockerfile b/bitnami/postgresql/12/Dockerfile index 69091c61..d431563a 100644 --- a/bitnami/postgresql/12/Dockerfile +++ b/bitnami/postgresql/12/Dockerfile @@ -1,4 +1,4 @@ -FROM bitnami/postgresql:12.17.0 +FROM bitnami/postgresql:16.1.0 # Health check and non-privileged user HEALTHCHECK --interval=15s --timeout=5s --retries=3 CMD [ "pg_isready" ] diff --git a/bitnami/postgresql/13/Dockerfile b/bitnami/postgresql/13/Dockerfile index 206b820c..d431563a 100644 --- a/bitnami/postgresql/13/Dockerfile +++ b/bitnami/postgresql/13/Dockerfile @@ -1,4 +1,4 @@ -FROM bitnami/postgresql:13.13.0 +FROM bitnami/postgresql:16.1.0 # Health check and non-privileged user HEALTHCHECK --interval=15s --timeout=5s --retries=3 CMD [ "pg_isready" ] diff --git a/bitnami/postgresql/14/Dockerfile b/bitnami/postgresql/14/Dockerfile index f0ccdc03..d431563a 100644 --- a/bitnami/postgresql/14/Dockerfile +++ b/bitnami/postgresql/14/Dockerfile @@ -1,4 +1,4 @@ -FROM bitnami/postgresql:14.10.0 +FROM bitnami/postgresql:16.1.0 # Health check and non-privileged user HEALTHCHECK --interval=15s --timeout=5s --retries=3 CMD [ "pg_isready" ] diff --git a/bitnami/postgresql/15/Dockerfile b/bitnami/postgresql/15/Dockerfile index 919d65f4..d431563a 100644 --- a/bitnami/postgresql/15/Dockerfile +++ b/bitnami/postgresql/15/Dockerfile @@ -1,4 +1,4 @@ -FROM bitnami/postgresql:15.5.0 +FROM bitnami/postgresql:16.1.0 # Health check and non-privileged user HEALTHCHECK --interval=15s --timeout=5s --retries=3 CMD [ "pg_isready" ] diff --git a/bitnami/postgresql/16/Dockerfile b/bitnami/postgresql/16/Dockerfile index e61c6d61..d431563a 100644 --- a/bitnami/postgresql/16/Dockerfile +++ b/bitnami/postgresql/16/Dockerfile @@ -1,4 +1,4 @@ -FROM bitnami/postgresql:16.0.0 +FROM bitnami/postgresql:16.1.0 # Health check and non-privileged user HEALTHCHECK --interval=15s --timeout=5s --retries=3 CMD [ "pg_isready" ] From 6b5b42bab12ad8c2d870da2bf06a91b397479c6c Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 12:34:22 -0800 Subject: [PATCH 03/55] Test --- .github/workflows/pr-open.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 0e1bd01c..96eeb609 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -19,7 +19,7 @@ jobs: id: dockerfiles run: | # Get all Dockerfiles that have changed - DOCKERFILES=$(git diff --name-only ${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) + DOCKERFILES=$(git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) echo "dockerfiles=${DOCKERFILES}" >> $GITHUB_OUTPUT echo -e "Dockerfiles: \n $DOCKERFILES" From 6c97a5a05bbe637eb7dc5fb9aa9f68bb63429fb1 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 12:36:38 -0800 Subject: [PATCH 04/55] Test --- .github/workflows/pr-open.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 96eeb609..4dd09ac3 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -19,9 +19,11 @@ jobs: id: dockerfiles run: | # Get all Dockerfiles that have changed - DOCKERFILES=$(git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) - echo "dockerfiles=${DOCKERFILES}" >> $GITHUB_OUTPUT - echo -e "Dockerfiles: \n $DOCKERFILES" + git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} + + # DOCKERFILES=$(git diff --name-only origin/${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) + # echo "dockerfiles=${DOCKERFILES}" >> $GITHUB_OUTPUT + # echo -e "Dockerfiles: \n $DOCKERFILES" # # https://github.com/bcgov-nr/action-builder-ghcr # builds: From d04307f7e0c25e7463e79295781b339e5757081d Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 12:37:33 -0800 Subject: [PATCH 05/55] Test --- .github/workflows/pr-open.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 4dd09ac3..8f470e66 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -19,6 +19,7 @@ jobs: id: dockerfiles run: | # Get all Dockerfiles that have changed + git fetch origin ${{ inputs.diff_branch }} git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} # DOCKERFILES=$(git diff --name-only origin/${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) From 01520de1c83361ea44f5990ac9f315a6e79627cb Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 12:38:35 -0800 Subject: [PATCH 06/55] Test --- .github/workflows/pr-open.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 8f470e66..12701578 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -22,7 +22,7 @@ jobs: git fetch origin ${{ inputs.diff_branch }} git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} - # DOCKERFILES=$(git diff --name-only origin/${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) + # DOCKERFILES=$(git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) # echo "dockerfiles=${DOCKERFILES}" >> $GITHUB_OUTPUT # echo -e "Dockerfiles: \n $DOCKERFILES" From 1dee0128e2b69ccf8c2a36aa19693ddffd9b5694 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 12:40:04 -0800 Subject: [PATCH 07/55] Test --- .github/workflows/pr-open.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 12701578..d2ac2cda 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -15,6 +15,8 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Get Dockerfiles id: dockerfiles run: | From 8ba77f232baae2676f803a425869094158c3f8c0 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 12:41:33 -0800 Subject: [PATCH 08/55] Test --- .github/workflows/pr-open.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index d2ac2cda..fab95267 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -20,9 +20,11 @@ jobs: - name: Get Dockerfiles id: dockerfiles run: | + git diff --name-only origin/feat/smartWorkflows origin/main + # Get all Dockerfiles that have changed - git fetch origin ${{ inputs.diff_branch }} - git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} + # git fetch origin ${{ inputs.diff_branch }} + # git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} # DOCKERFILES=$(git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) # echo "dockerfiles=${DOCKERFILES}" >> $GITHUB_OUTPUT From 602ed1c3b16263693dbbb2cc443338b1ddcab747 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 12:42:17 -0800 Subject: [PATCH 09/55] Test --- .github/workflows/pr-open.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index fab95267..6647ee70 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -20,7 +20,7 @@ jobs: - name: Get Dockerfiles id: dockerfiles run: | - git diff --name-only origin/feat/smartWorkflows origin/main + git diff --name-only origin/main # Get all Dockerfiles that have changed # git fetch origin ${{ inputs.diff_branch }} From 22d33024c5e17dd1aed5b3825bada2c4f510116e Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 12:43:08 -0800 Subject: [PATCH 10/55] Test --- .github/workflows/pr-open.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 6647ee70..e8895e77 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -15,15 +15,13 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Get Dockerfiles id: dockerfiles run: | + # git fetch origin ${{ inputs.diff_branch }} git diff --name-only origin/main # Get all Dockerfiles that have changed - # git fetch origin ${{ inputs.diff_branch }} # git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} # DOCKERFILES=$(git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) From d76726f00e0018dccfcfe07198c3b1ab333cbafe Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 12:43:42 -0800 Subject: [PATCH 11/55] Test --- .github/workflows/pr-open.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index e8895e77..d8d46865 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -18,7 +18,7 @@ jobs: - name: Get Dockerfiles id: dockerfiles run: | - # git fetch origin ${{ inputs.diff_branch }} + git fetch origin ${{ inputs.diff_branch }} git diff --name-only origin/main # Get all Dockerfiles that have changed From 3fbca1828b09239d50fee11ea25bf8b404ddc065 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 12:44:26 -0800 Subject: [PATCH 12/55] Test --- .github/workflows/pr-open.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index d8d46865..9e0c347d 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -18,7 +18,7 @@ jobs: - name: Get Dockerfiles id: dockerfiles run: | - git fetch origin ${{ inputs.diff_branch }} + git fetch origin ${{ github.event.repository.default_branch }} git diff --name-only origin/main # Get all Dockerfiles that have changed From f438f6a4899f3a72d90f08ad7d37c7152d9ed303 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 12:45:38 -0800 Subject: [PATCH 13/55] .github/Test --- .github/workflows/pr-open.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 9e0c347d..a974cfef 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -18,15 +18,11 @@ jobs: - name: Get Dockerfiles id: dockerfiles run: | - git fetch origin ${{ github.event.repository.default_branch }} - git diff --name-only origin/main - # Get all Dockerfiles that have changed - # git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} - - # DOCKERFILES=$(git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) - # echo "dockerfiles=${DOCKERFILES}" >> $GITHUB_OUTPUT - # echo -e "Dockerfiles: \n $DOCKERFILES" + git fetch origin ${{ github.event.repository.default_branch }} + DOCKERFILES=$(git diff --name-only ${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) + echo "dockerfiles=${DOCKERFILES}" >> $GITHUB_OUTPUT + echo -e "Dockerfiles: \n $DOCKERFILES" # # https://github.com/bcgov-nr/action-builder-ghcr # builds: From e121afe6f783a53e01ad430aba5876fa9bd7ecca Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 12:46:13 -0800 Subject: [PATCH 14/55] .github/Test --- .github/workflows/pr-open.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index a974cfef..3d1dcd3b 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -20,7 +20,7 @@ jobs: run: | # Get all Dockerfiles that have changed git fetch origin ${{ github.event.repository.default_branch }} - DOCKERFILES=$(git diff --name-only ${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) + DOCKERFILES=$(git diff --name-only origin/${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) echo "dockerfiles=${DOCKERFILES}" >> $GITHUB_OUTPUT echo -e "Dockerfiles: \n $DOCKERFILES" From 0d1b4fb7757700906b91a9b82a519b3d5d578697 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 12:50:04 -0800 Subject: [PATCH 15/55] .github/Test --- .github/workflows/pr-open.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 3d1dcd3b..6647ee70 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -15,14 +15,20 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Get Dockerfiles id: dockerfiles run: | + git diff --name-only origin/main + # Get all Dockerfiles that have changed - git fetch origin ${{ github.event.repository.default_branch }} - DOCKERFILES=$(git diff --name-only origin/${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) - echo "dockerfiles=${DOCKERFILES}" >> $GITHUB_OUTPUT - echo -e "Dockerfiles: \n $DOCKERFILES" + # git fetch origin ${{ inputs.diff_branch }} + # git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} + + # DOCKERFILES=$(git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) + # echo "dockerfiles=${DOCKERFILES}" >> $GITHUB_OUTPUT + # echo -e "Dockerfiles: \n $DOCKERFILES" # # https://github.com/bcgov-nr/action-builder-ghcr # builds: From 3da3f92c3e1461d1766fdf2944aa8b01181c79db Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 12:50:41 -0800 Subject: [PATCH 16/55] .github/Test --- .github/workflows/pr-open.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 6647ee70..d8d46865 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -15,15 +15,13 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Get Dockerfiles id: dockerfiles run: | + git fetch origin ${{ inputs.diff_branch }} git diff --name-only origin/main # Get all Dockerfiles that have changed - # git fetch origin ${{ inputs.diff_branch }} # git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} # DOCKERFILES=$(git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) From cb2e43142f1e50660b0f303de80d0dc1dd99f656 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 12:51:46 -0800 Subject: [PATCH 17/55] .github/Test --- .github/workflows/pr-open.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index d8d46865..9e0c347d 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -18,7 +18,7 @@ jobs: - name: Get Dockerfiles id: dockerfiles run: | - git fetch origin ${{ inputs.diff_branch }} + git fetch origin ${{ github.event.repository.default_branch }} git diff --name-only origin/main # Get all Dockerfiles that have changed From ad3835571467a58908a3873ee2eb60c22034506c Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 12:52:45 -0800 Subject: [PATCH 18/55] .github/Test --- .github/workflows/pr-open.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 9e0c347d..3babf75b 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -18,11 +18,9 @@ jobs: - name: Get Dockerfiles id: dockerfiles run: | - git fetch origin ${{ github.event.repository.default_branch }} - git diff --name-only origin/main - # Get all Dockerfiles that have changed - # git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} + git fetch origin/${{ github.event.repository.default_branch }} + git diff --name-only origin/${{ github.event.repository.default_branch }} # DOCKERFILES=$(git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) # echo "dockerfiles=${DOCKERFILES}" >> $GITHUB_OUTPUT From dc09b0471c1f026270b19b239f1381be379b50bd Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 12:54:08 -0800 Subject: [PATCH 19/55] .github/Test --- .github/workflows/pr-open.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 3babf75b..5039afa6 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -19,7 +19,7 @@ jobs: id: dockerfiles run: | # Get all Dockerfiles that have changed - git fetch origin/${{ github.event.repository.default_branch }} + git fetch origin ${{ github.event.repository.default_branch }} git diff --name-only origin/${{ github.event.repository.default_branch }} # DOCKERFILES=$(git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) From cd8cc1100bbe10bbdb4702dbaf32e513a52251bd Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 13:05:19 -0800 Subject: [PATCH 20/55] Test --- .github/workflows/pr-open.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 5039afa6..aff669d9 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -20,11 +20,23 @@ jobs: run: | # Get all Dockerfiles that have changed git fetch origin ${{ github.event.repository.default_branch }} - git diff --name-only origin/${{ github.event.repository.default_branch }} + DOCKERFILES=$(git diff --name-only origin/${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) + echo "dockerfiles=${DOCKERFILES}" >> $GITHUB_OUTPUT + echo -e "Dockerfiles: \n $DOCKERFILES" + + parse: + name: Parse Dockerfiles + needs: [scrub] + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Parse Dockerfiles + id: parse + run: | + # Parse the Dockerfiles + echo "Dockerfiles?" + echo ${{ needs.scrub.outputs.dockerfiles }}} - # DOCKERFILES=$(git diff --name-only ${{ github.head_ref || github.ref_name }} ${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) - # echo "dockerfiles=${DOCKERFILES}" >> $GITHUB_OUTPUT - # echo -e "Dockerfiles: \n $DOCKERFILES" # # https://github.com/bcgov-nr/action-builder-ghcr # builds: From a147c5498d4713cd393ca01c01350a8312c7703a Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 14:10:16 -0800 Subject: [PATCH 21/55] Fix regex --- .github/workflows/pr-open.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index aff669d9..72813bc0 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -20,7 +20,7 @@ jobs: run: | # Get all Dockerfiles that have changed git fetch origin ${{ github.event.repository.default_branch }} - DOCKERFILES=$(git diff --name-only origin/${{ github.event.repository.default_branch }} | grep -E '^[^/]+/[^/]+/Dockerfile$' | sort -u) + DOCKERFILES=$(git diff --name-only origin/${{ github.event.repository.default_branch }} | grep -E '^.*/.*/Dockerfile$' | sort -u) echo "dockerfiles=${DOCKERFILES}" >> $GITHUB_OUTPUT echo -e "Dockerfiles: \n $DOCKERFILES" @@ -35,7 +35,7 @@ jobs: run: | # Parse the Dockerfiles echo "Dockerfiles?" - echo ${{ needs.scrub.outputs.dockerfiles }}} + echo ${{ needs.scrub.outputs.dockerfiles }} # # https://github.com/bcgov-nr/action-builder-ghcr From d46728ca5056d6e895781613d84b447ceed7e9e7 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 14:14:42 -0800 Subject: [PATCH 22/55] Array --- .github/workflows/pr-open.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 72813bc0..ff3de088 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -20,9 +20,9 @@ jobs: run: | # Get all Dockerfiles that have changed git fetch origin ${{ github.event.repository.default_branch }} - DOCKERFILES=$(git diff --name-only origin/${{ github.event.repository.default_branch }} | grep -E '^.*/.*/Dockerfile$' | sort -u) - echo "dockerfiles=${DOCKERFILES}" >> $GITHUB_OUTPUT + DOCKERFILES=($(git diff --name-only origin/${{ github.event.repository.default_branch }} | grep -E '^.*/.*/Dockerfile$' | sort -u)) echo -e "Dockerfiles: \n $DOCKERFILES" + echo "dockerfiles=${DOCKERFILES}" >> $GITHUB_OUTPUT parse: name: Parse Dockerfiles From 1ccbb18c712d4c7632c0ca1fb3ece471742377e0 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:06:41 -0800 Subject: [PATCH 23/55] Test --- .github/workflows/pr-open.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index ff3de088..34fef043 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -20,9 +20,18 @@ jobs: run: | # Get all Dockerfiles that have changed git fetch origin ${{ github.event.repository.default_branch }} - DOCKERFILES=($(git diff --name-only origin/${{ github.event.repository.default_branch }} | grep -E '^.*/.*/Dockerfile$' | sort -u)) - echo -e "Dockerfiles: \n $DOCKERFILES" - echo "dockerfiles=${DOCKERFILES}" >> $GITHUB_OUTPUT + DOCKERFILES=($(git diff --name-only main | grep Dockerfile)) + JSON=$(echo "[" + for d in "${DOCKERFILES[@]}"; do + BASE=${d%/*} + VERSION=${BASE##*/} + PACKAGE=${BASE%/*} + echo -e "{\"package\": \"$PACKAGE\", \"major_tag\": \"$VERSION\"}," + done + echo -e "]" + ) + # Clip extra comma and send to output + echo "json=${JSON} | sed 's/\(.*\),/\1 /'" >> $GITHUB_OUTPUT parse: name: Parse Dockerfiles @@ -35,7 +44,7 @@ jobs: run: | # Parse the Dockerfiles echo "Dockerfiles?" - echo ${{ needs.scrub.outputs.dockerfiles }} + echo ${{ needs.scrub.outputs.json }} # # https://github.com/bcgov-nr/action-builder-ghcr From 583adc1535f079a02fa1e0e789e61bfbf3acd1ed Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:07:56 -0800 Subject: [PATCH 24/55] Test --- .github/workflows/pr-open.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 34fef043..f5edb9a5 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -20,7 +20,7 @@ jobs: run: | # Get all Dockerfiles that have changed git fetch origin ${{ github.event.repository.default_branch }} - DOCKERFILES=($(git diff --name-only main | grep Dockerfile)) + DOCKERFILES=($(git diff --name-only origin/${{ github.event.repository.default_branch }} | grep -E '^.*/.*/Dockerfile$' | sort -u)) JSON=$(echo "[" for d in "${DOCKERFILES[@]}"; do BASE=${d%/*} @@ -44,7 +44,7 @@ jobs: run: | # Parse the Dockerfiles echo "Dockerfiles?" - echo ${{ needs.scrub.outputs.json }} + echo ${{ needs.scrub.outputs.dockerfiles }} # # https://github.com/bcgov-nr/action-builder-ghcr From f88c27a30e3434662e99c0830d70276a92677373 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:10:31 -0800 Subject: [PATCH 25/55] Test --- .github/workflows/pr-open.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index f5edb9a5..1dddd912 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -31,6 +31,7 @@ jobs: echo -e "]" ) # Clip extra comma and send to output + echo "json=${JSON} | sed 's/\(.*\),/\1 /'" echo "json=${JSON} | sed 's/\(.*\),/\1 /'" >> $GITHUB_OUTPUT parse: @@ -44,7 +45,7 @@ jobs: run: | # Parse the Dockerfiles echo "Dockerfiles?" - echo ${{ needs.scrub.outputs.dockerfiles }} + echo ${{ fromJSON(needs.scrub.outputs.dockerfiles) }} # # https://github.com/bcgov-nr/action-builder-ghcr From 2ad5e77602560ee49522721e5211bff089b8d410 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:15:20 -0800 Subject: [PATCH 26/55] Test --- .github/workflows/pr-open.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 1dddd912..7c76589c 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -31,21 +31,21 @@ jobs: echo -e "]" ) # Clip extra comma and send to output - echo "json=${JSON} | sed 's/\(.*\),/\1 /'" - echo "json=${JSON} | sed 's/\(.*\),/\1 /'" >> $GITHUB_OUTPUT + echo "json=${JSON}"" | sed 's/\(.*\),/\1 /' + echo "json=${JSON}" | sed 's/\(.*\),/\1 /' >> $GITHUB_OUTPUT - parse: - name: Parse Dockerfiles - needs: [scrub] - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - name: Parse Dockerfiles - id: parse - run: | - # Parse the Dockerfiles - echo "Dockerfiles?" - echo ${{ fromJSON(needs.scrub.outputs.dockerfiles) }} + # parse: + # name: Parse Dockerfiles + # needs: [scrub] + # runs-on: ubuntu-22.04 + # steps: + # - uses: actions/checkout@v4 + # - name: Parse Dockerfiles + # id: parse + # run: | + # # Parse the Dockerfiles + # echo "Dockerfiles?" + # echo ${{ fromJSON(needs.scrub.outputs.dockerfiles) }} # # https://github.com/bcgov-nr/action-builder-ghcr From ce8de873a5329135fbe6d9f6696867fb45e9b214 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:16:04 -0800 Subject: [PATCH 27/55] Test --- .github/workflows/pr-open.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 7c76589c..785ac9cc 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -31,7 +31,7 @@ jobs: echo -e "]" ) # Clip extra comma and send to output - echo "json=${JSON}"" | sed 's/\(.*\),/\1 /' + echo "json=${JSON}" | sed 's/\(.*\),/\1 /' echo "json=${JSON}" | sed 's/\(.*\),/\1 /' >> $GITHUB_OUTPUT # parse: From e129c27d84e1baace9aa10a3f663a73e462b3073 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:17:19 -0800 Subject: [PATCH 28/55] Test --- .github/workflows/pr-open.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 785ac9cc..1c76d3ad 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -31,8 +31,8 @@ jobs: echo -e "]" ) # Clip extra comma and send to output - echo "json=${JSON}" | sed 's/\(.*\),/\1 /' - echo "json=${JSON}" | sed 's/\(.*\),/\1 /' >> $GITHUB_OUTPUT + echo "json=${JSON}" + echo "json=${JSON}" >> $GITHUB_OUTPUT # parse: # name: Parse Dockerfiles From e822a7b38e8152de5c431662b60d2ea7cf2b6e6b Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:20:50 -0800 Subject: [PATCH 29/55] Test --- .github/workflows/pr-open.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 1c76d3ad..b5c14cd8 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -21,7 +21,7 @@ jobs: # Get all Dockerfiles that have changed git fetch origin ${{ github.event.repository.default_branch }} DOCKERFILES=($(git diff --name-only origin/${{ github.event.repository.default_branch }} | grep -E '^.*/.*/Dockerfile$' | sort -u)) - JSON=$(echo "[" + LIST=$(echo "[" for d in "${DOCKERFILES[@]}"; do BASE=${d%/*} VERSION=${BASE##*/} @@ -31,8 +31,8 @@ jobs: echo -e "]" ) # Clip extra comma and send to output - echo "json=${JSON}" - echo "json=${JSON}" >> $GITHUB_OUTPUT + JSON=$(echo "json=${LIST}" | sed 's/\(.*\),/\1 /') + echo "json=${JSON}" | sed 's/"/\\"/g' >> $GITHUB_OUTPUT # parse: # name: Parse Dockerfiles From 63db7c9c7d0e782b8a737a06059d530179726012 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:21:53 -0800 Subject: [PATCH 30/55] Test --- .github/workflows/pr-open.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index b5c14cd8..d0e7b2a0 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -32,6 +32,7 @@ jobs: ) # Clip extra comma and send to output JSON=$(echo "json=${LIST}" | sed 's/\(.*\),/\1 /') + echo "JSON=${JSON}" echo "json=${JSON}" | sed 's/"/\\"/g' >> $GITHUB_OUTPUT # parse: From 51065d9f81ab5551ed47435c6aec7e60430ffa84 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:26:53 -0800 Subject: [PATCH 31/55] Test --- .github/workflows/pr-open.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index d0e7b2a0..a92a40a6 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -31,8 +31,8 @@ jobs: echo -e "]" ) # Clip extra comma and send to output - JSON=$(echo "json=${LIST}" | sed 's/\(.*\),/\1 /') - echo "JSON=${JSON}" + ONELINE=$(echo $LIST) + JSON=$(echo $ONELINE | sed 's/\(.*\),/\1 /') echo "json=${JSON}" | sed 's/"/\\"/g' >> $GITHUB_OUTPUT # parse: From 5bea73916546022a2a7bd67cec7d96e6a7d53366 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:27:41 -0800 Subject: [PATCH 32/55] Check if this actually worked --- .github/workflows/pr-open.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index a92a40a6..120d00f8 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -35,18 +35,18 @@ jobs: JSON=$(echo $ONELINE | sed 's/\(.*\),/\1 /') echo "json=${JSON}" | sed 's/"/\\"/g' >> $GITHUB_OUTPUT - # parse: - # name: Parse Dockerfiles - # needs: [scrub] - # runs-on: ubuntu-22.04 - # steps: - # - uses: actions/checkout@v4 - # - name: Parse Dockerfiles - # id: parse - # run: | - # # Parse the Dockerfiles - # echo "Dockerfiles?" - # echo ${{ fromJSON(needs.scrub.outputs.dockerfiles) }} + parse: + name: Parse Dockerfiles + needs: [scrub] + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Parse Dockerfiles + id: parse + run: | + # Parse the Dockerfiles + echo "Dockerfiles?" + echo ${{ fromJSON(needs.scrub.outputs.dockerfiles) }} # # https://github.com/bcgov-nr/action-builder-ghcr From 2784d3ad8b6658537bb28931ece5e1194a86249e Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:31:21 -0800 Subject: [PATCH 33/55] Test --- .github/workflows/pr-open.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 120d00f8..3a14404a 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -16,7 +16,6 @@ jobs: steps: - uses: actions/checkout@v4 - name: Get Dockerfiles - id: dockerfiles run: | # Get all Dockerfiles that have changed git fetch origin ${{ github.event.repository.default_branch }} @@ -40,13 +39,11 @@ jobs: needs: [scrub] runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 - name: Parse Dockerfiles id: parse run: | # Parse the Dockerfiles - echo "Dockerfiles?" - echo ${{ fromJSON(needs.scrub.outputs.dockerfiles) }} + echo ${{ fromJSON(needs.scrub.outputs.json) }} # # https://github.com/bcgov-nr/action-builder-ghcr From 2e910d40c096289b66c996c16f7c0ea71e32558f Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:32:18 -0800 Subject: [PATCH 34/55] Test --- .github/workflows/pr-open.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 3a14404a..f85bfcf7 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -43,7 +43,7 @@ jobs: id: parse run: | # Parse the Dockerfiles - echo ${{ fromJSON(needs.scrub.outputs.json) }} + echo ${{ needs.scrub.outputs.json }} # # https://github.com/bcgov-nr/action-builder-ghcr From 1f57762f2d90c2f9cf1ee6d13fdad226c7cd20e2 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:33:38 -0800 Subject: [PATCH 35/55] Test --- .github/workflows/pr-open.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index f85bfcf7..3a015d14 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -32,7 +32,9 @@ jobs: # Clip extra comma and send to output ONELINE=$(echo $LIST) JSON=$(echo $ONELINE | sed 's/\(.*\),/\1 /') + echo "json=${JSON}" | sed 's/"/\\"/g' echo "json=${JSON}" | sed 's/"/\\"/g' >> $GITHUB_OUTPUT + echo "test=win" >> $GITHUB_OUTPUT parse: name: Parse Dockerfiles @@ -43,7 +45,7 @@ jobs: id: parse run: | # Parse the Dockerfiles - echo ${{ needs.scrub.outputs.json }} + echo ${{ needs.scrub.outputs.test }} # # https://github.com/bcgov-nr/action-builder-ghcr From 91fa63487db6b82c876e6bf6d77fc84d8415216b Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:34:30 -0800 Subject: [PATCH 36/55] Test --- .github/workflows/pr-open.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 3a015d14..1fcd18a1 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -13,6 +13,9 @@ jobs: scrub: name: Scrub for changed Dockerfiles runs-on: ubuntu-22.04 + outputs: + json: ${{ steps.get-dockerfiles.outputs.json }} + test: ${{ steps.get-dockerfiles.outputs.test }} steps: - uses: actions/checkout@v4 - name: Get Dockerfiles From 16b84b1a4816938a63852c4860be91400ecc8f61 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:36:33 -0800 Subject: [PATCH 37/55] Test --- .github/workflows/pr-open.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 1fcd18a1..d94019de 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -14,11 +14,12 @@ jobs: name: Scrub for changed Dockerfiles runs-on: ubuntu-22.04 outputs: - json: ${{ steps.get-dockerfiles.outputs.json }} - test: ${{ steps.get-dockerfiles.outputs.test }} + json: ${{ steps.dockerfiles.outputs.json }} + test: ${{ steps.dockerfiles.outputs.test }} steps: - uses: actions/checkout@v4 - name: Get Dockerfiles + id: dockerfiles run: | # Get all Dockerfiles that have changed git fetch origin ${{ github.event.repository.default_branch }} From f3670596fa65c16811d21d3173e98c558ccdcba8 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:37:37 -0800 Subject: [PATCH 38/55] Test --- .github/workflows/pr-open.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index d94019de..e5d6a17d 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -50,6 +50,8 @@ jobs: run: | # Parse the Dockerfiles echo ${{ needs.scrub.outputs.test }} + echo ${{ needs.scrub.outputs.json }} + echo ${{ toJSON(needs.scrub.outputs.json) }} # # https://github.com/bcgov-nr/action-builder-ghcr From aa259befd1e7960eef5ec22f06631e46c1632c59 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:39:26 -0800 Subject: [PATCH 39/55] Try passing JSON to builder --- .github/workflows/pr-open.yml | 109 ++++++++++++---------------------- 1 file changed, 37 insertions(+), 72 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index e5d6a17d..809befd7 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -36,86 +36,51 @@ jobs: # Clip extra comma and send to output ONELINE=$(echo $LIST) JSON=$(echo $ONELINE | sed 's/\(.*\),/\1 /') - echo "json=${JSON}" | sed 's/"/\\"/g' + echo "json=${JSON}" echo "json=${JSON}" | sed 's/"/\\"/g' >> $GITHUB_OUTPUT echo "test=win" >> $GITHUB_OUTPUT - parse: - name: Parse Dockerfiles + # parse: + # name: Parse Dockerfiles + # needs: [scrub] + # runs-on: ubuntu-22.04 + # steps: + # - name: Parse Dockerfiles + # id: parse + # run: | + # # Parse the Dockerfiles + # echo ${{ needs.scrub.outputs.test }} + # echo ${{ needs.scrub.outputs.json }} + # echo ${{ toJSON(needs.scrub.outputs.json) }} + + + # https://github.com/bcgov-nr/action-builder-ghcr + builds: + name: Builds needs: [scrub] + if: "!github.event.pull_request.head.repo.fork" + permissions: + packages: write runs-on: ubuntu-22.04 + strategy: + matrix: + include: ${{ toJSON(needs.scrub.outputs.json) }} + timeout-minutes: 10 steps: - - name: Parse Dockerfiles - id: parse + - uses: actions/checkout@v4 + - name: Get tag + id: tag run: | - # Parse the Dockerfiles - echo ${{ needs.scrub.outputs.test }} - echo ${{ needs.scrub.outputs.json }} - echo ${{ toJSON(needs.scrub.outputs.json) }} - + TAG=$(grep '^FROM' ${{ matrix.package }}/${{ matrix.major_tag }}/Dockerfile | cut -d':' -f2) + echo "full_tag=${TAG}" >> $GITHUB_OUTPUT - # # https://github.com/bcgov-nr/action-builder-ghcr - # builds: - # name: Builds - # if: "!github.event.pull_request.head.repo.fork" - # permissions: - # packages: write - # runs-on: ubuntu-22.04 - # strategy: - # matrix: - # include: - # - package: bitnami/pgpool - # major_tag: 4 - # - package: bitnami/postgresql - # major_tag: 12 - # - package: bitnami/postgresql - # major_tag: 13 - # - package: bitnami/postgresql - # major_tag: 14 - # - package: bitnami/postgresql - # major_tag: 15 - # - package: bitnami/postgresql - # major_tag: 16 - # - package: bitnami/postgresql-ha - # major_tag: 12 - # - package: bitnami/postgresql-ha - # major_tag: 13 - # - package: bitnami/postgresql-ha - # major_tag: 14 - # - package: bitnami/postgresql-ha - # major_tag: 15 - # - package: bitnami/postgresql-ha - # major_tag: 16 - # - package: mongo - # major_tag: 6 - # - package: mongo - # major_tag: 7 - # - package: postgres - # major_tag: 12 - # - package: postgres - # major_tag: 13 - # - package: postgres - # major_tag: 14 - # - package: postgres - # major_tag: 15 - # - package: postgres - # major_tag: 16 - # timeout-minutes: 10 - # steps: - # - uses: actions/checkout@v4 - # - name: Get tag - # id: tag - # run: | - # TAG=$(grep '^FROM' ${{ matrix.package }}/${{ matrix.major_tag }}/Dockerfile | cut -d':' -f2) - # echo "full_tag=${TAG}" >> $GITHUB_OUTPUT - - # - name: Build or import - # uses: bcgov-nr/action-builder-ghcr@v2.0.0 - # with: - # build_context: ${{ matrix.package }}/${{ matrix.major_tag }} - # package: ${{ matrix.package }} - # tag: ${{ steps.tag.outputs.full_tag }} - # triggers: ${{ matrix.package}}/${{ matrix.triggers }} + - name: Build or import + uses: bcgov-nr/action-builder-ghcr@v2.0.0 + with: + build_context: ${{ matrix.package }}/${{ matrix.major_tag }} + package: ${{ matrix.package }} + tag: ${{ steps.tag.outputs.full_tag }} + triggers: ${{ matrix.package}}/${{ matrix.triggers }} # pr-description-add: # name: PR Description Add From 522d519f4b2bc92d3b81fc8bf33d06856a40089e Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:47:08 -0800 Subject: [PATCH 40/55] Drop extra escape characters --- .github/workflows/pr-open.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 809befd7..53ddd9cb 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -37,7 +37,7 @@ jobs: ONELINE=$(echo $LIST) JSON=$(echo $ONELINE | sed 's/\(.*\),/\1 /') echo "json=${JSON}" - echo "json=${JSON}" | sed 's/"/\\"/g' >> $GITHUB_OUTPUT + echo "json=${JSON}" >> $GITHUB_OUTPUT echo "test=win" >> $GITHUB_OUTPUT # parse: From 76b7921acefe84e679a7b178807601ff47d6cf1b Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:50:17 -0800 Subject: [PATCH 41/55] Drop extra escape characters --- .github/workflows/pr-open.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 53ddd9cb..80f1d53b 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -29,7 +29,7 @@ jobs: BASE=${d%/*} VERSION=${BASE##*/} PACKAGE=${BASE%/*} - echo -e "{\"package\": \"$PACKAGE\", \"major_tag\": \"$VERSION\"}," + echo -e "{"package": "$PACKAGE", "major_tag": "$VERSION"}," done echo -e "]" ) From 7605c1c5053f7a2ee88ff6a2902d9864c2b5d9a0 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:51:37 -0800 Subject: [PATCH 42/55] More escape characters adventures --- .github/workflows/pr-open.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 80f1d53b..262428bf 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -29,7 +29,7 @@ jobs: BASE=${d%/*} VERSION=${BASE##*/} PACKAGE=${BASE%/*} - echo -e "{"package": "$PACKAGE", "major_tag": "$VERSION"}," + echo -e "{\"package\": \"$PACKAGE\", \"major_tag\": \"$VERSION\"}," done echo -e "]" ) @@ -37,8 +37,8 @@ jobs: ONELINE=$(echo $LIST) JSON=$(echo $ONELINE | sed 's/\(.*\),/\1 /') echo "json=${JSON}" - echo "json=${JSON}" >> $GITHUB_OUTPUT - echo "test=win" >> $GITHUB_OUTPUT + echo "json=${JSON}" | sed 's/"/\\"/g' >> $GITHUB_OUTPUT + echo test=win >> $GITHUB_OUTPUT # parse: # name: Parse Dockerfiles From 75ded2387466980818d5510ec5dd8e7b3d093331 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:52:50 -0800 Subject: [PATCH 43/55] More escape characters adventures --- .github/workflows/pr-open.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 262428bf..aafb914d 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -35,9 +35,9 @@ jobs: ) # Clip extra comma and send to output ONELINE=$(echo $LIST) - JSON=$(echo $ONELINE | sed 's/\(.*\),/\1 /') + JSON=$(echo $ONELINE | sed 's/\(.*\),/\1/') echo "json=${JSON}" - echo "json=${JSON}" | sed 's/"/\\"/g' >> $GITHUB_OUTPUT + echo "json=${JSON}" >> $GITHUB_OUTPUT echo test=win >> $GITHUB_OUTPUT # parse: From 8d8ee84f9cf04f1b9bac839b4d33c1cabde62665 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:54:55 -0800 Subject: [PATCH 44/55] More escape characters adventures --- .github/workflows/pr-open.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index aafb914d..38df76ba 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -64,7 +64,8 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - include: ${{ toJSON(needs.scrub.outputs.json) }} + # include: ${{ fromJSON(needs.scrub.outputs.json) }} + include: [ {"package": "bitnami/postgresql", "major_tag": "12"}, {"package": "bitnami/postgresql", "major_tag": "13"}, {"package": "bitnami/postgresql", "major_tag": "14"}, {"package": "bitnami/postgresql", "major_tag": "15"}, {"package": "bitnami/postgresql", "major_tag": "16"} ] timeout-minutes: 10 steps: - uses: actions/checkout@v4 From 703710c7f300835ef7ec505bac472d098a6e1934 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 16:56:40 -0800 Subject: [PATCH 45/55] More escape characters adventures --- .github/workflows/pr-open.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 38df76ba..7fb93afc 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -64,8 +64,8 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - # include: ${{ fromJSON(needs.scrub.outputs.json) }} - include: [ {"package": "bitnami/postgresql", "major_tag": "12"}, {"package": "bitnami/postgresql", "major_tag": "13"}, {"package": "bitnami/postgresql", "major_tag": "14"}, {"package": "bitnami/postgresql", "major_tag": "15"}, {"package": "bitnami/postgresql", "major_tag": "16"} ] + include: ${{ fromJSON(needs.scrub.outputs.json) }} + # include: [ {"package": "bitnami/postgresql", "major_tag": "12"}, {"package": "bitnami/postgresql", "major_tag": "13"}, {"package": "bitnami/postgresql", "major_tag": "14"}, {"package": "bitnami/postgresql", "major_tag": "15"}, {"package": "bitnami/postgresql", "major_tag": "16"} ] timeout-minutes: 10 steps: - uses: actions/checkout@v4 From 2d60f6f627d1cc88f82b724fd2c46bcfafd00719 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 17:04:52 -0800 Subject: [PATCH 46/55] Cleanup --- .github/workflows/pr-open.yml | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 7fb93afc..2bdde5ab 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -15,7 +15,6 @@ jobs: runs-on: ubuntu-22.04 outputs: json: ${{ steps.dockerfiles.outputs.json }} - test: ${{ steps.dockerfiles.outputs.test }} steps: - uses: actions/checkout@v4 - name: Get Dockerfiles @@ -26,33 +25,17 @@ jobs: DOCKERFILES=($(git diff --name-only origin/${{ github.event.repository.default_branch }} | grep -E '^.*/.*/Dockerfile$' | sort -u)) LIST=$(echo "[" for d in "${DOCKERFILES[@]}"; do + # Clip off /Dockerfile and use the rest to handle package name and major tag BASE=${d%/*} - VERSION=${BASE##*/} - PACKAGE=${BASE%/*} - echo -e "{\"package\": \"$PACKAGE\", \"major_tag\": \"$VERSION\"}," + echo "{\"package\": ${BASE%/*}\", \"major_tag\": \"${BASE##*/}\"}," done - echo -e "]" + echo "]" ) # Clip extra comma and send to output ONELINE=$(echo $LIST) JSON=$(echo $ONELINE | sed 's/\(.*\),/\1/') echo "json=${JSON}" echo "json=${JSON}" >> $GITHUB_OUTPUT - echo test=win >> $GITHUB_OUTPUT - - # parse: - # name: Parse Dockerfiles - # needs: [scrub] - # runs-on: ubuntu-22.04 - # steps: - # - name: Parse Dockerfiles - # id: parse - # run: | - # # Parse the Dockerfiles - # echo ${{ needs.scrub.outputs.test }} - # echo ${{ needs.scrub.outputs.json }} - # echo ${{ toJSON(needs.scrub.outputs.json) }} - # https://github.com/bcgov-nr/action-builder-ghcr builds: From 00f4e4c4e2d813b4d17bc718fcb0be7618713dde Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 17:06:09 -0800 Subject: [PATCH 47/55] Comments and testing --- .github/workflows/pr-open.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 2bdde5ab..8ff580df 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -27,7 +27,9 @@ jobs: for d in "${DOCKERFILES[@]}"; do # Clip off /Dockerfile and use the rest to handle package name and major tag BASE=${d%/*} - echo "{\"package\": ${BASE%/*}\", \"major_tag\": \"${BASE##*/}\"}," + VERSION=${BASE##*/} + PACKAGE=${BASE%/*} + echo "{\"package\": \"$PACKAGE\", \"major_tag\": \"$VERSION\"}," done echo "]" ) From 867bec210641e0c3e79165ea8b25bb0f643ca3e3 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 17:11:01 -0800 Subject: [PATCH 48/55] More escape characters adventures --- .github/workflows/pr-open.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 8ff580df..577345c9 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -29,7 +29,7 @@ jobs: BASE=${d%/*} VERSION=${BASE##*/} PACKAGE=${BASE%/*} - echo "{\"package\": \"$PACKAGE\", \"major_tag\": \"$VERSION\"}," + echo "{"package": "$PACKAGE", "major_tag": "$VERSION"}," done echo "]" ) From a751b6781291f1494759d731513ddc1f5045a97f Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 17:12:19 -0800 Subject: [PATCH 49/55] More escape characters adventures --- .github/workflows/pr-open.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 577345c9..51e214ae 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -49,7 +49,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - include: ${{ fromJSON(needs.scrub.outputs.json) }} + include: ${{ needs.scrub.outputs.json }} # include: [ {"package": "bitnami/postgresql", "major_tag": "12"}, {"package": "bitnami/postgresql", "major_tag": "13"}, {"package": "bitnami/postgresql", "major_tag": "14"}, {"package": "bitnami/postgresql", "major_tag": "15"}, {"package": "bitnami/postgresql", "major_tag": "16"} ] timeout-minutes: 10 steps: From dbf2e0b4477b78adbe982191c95ab293d7eeddd7 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 17:13:39 -0800 Subject: [PATCH 50/55] More escape characters adventures --- .github/workflows/pr-open.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 51e214ae..8ff580df 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -29,7 +29,7 @@ jobs: BASE=${d%/*} VERSION=${BASE##*/} PACKAGE=${BASE%/*} - echo "{"package": "$PACKAGE", "major_tag": "$VERSION"}," + echo "{\"package\": \"$PACKAGE\", \"major_tag\": \"$VERSION\"}," done echo "]" ) @@ -49,7 +49,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - include: ${{ needs.scrub.outputs.json }} + include: ${{ fromJSON(needs.scrub.outputs.json) }} # include: [ {"package": "bitnami/postgresql", "major_tag": "12"}, {"package": "bitnami/postgresql", "major_tag": "13"}, {"package": "bitnami/postgresql", "major_tag": "14"}, {"package": "bitnami/postgresql", "major_tag": "15"}, {"package": "bitnami/postgresql", "major_tag": "16"} ] timeout-minutes: 10 steps: From 26c4e0887d7680cdaa95def995ac9a90ac26bf5f Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 17:16:47 -0800 Subject: [PATCH 51/55] More escape characters adventures --- .github/workflows/pr-open.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 8ff580df..b870c3b3 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -27,9 +27,7 @@ jobs: for d in "${DOCKERFILES[@]}"; do # Clip off /Dockerfile and use the rest to handle package name and major tag BASE=${d%/*} - VERSION=${BASE##*/} - PACKAGE=${BASE%/*} - echo "{\"package\": \"$PACKAGE\", \"major_tag\": \"$VERSION\"}," + echo "{\"package\": \"${BASE%/*}\", \"major_tag\": \"${BASE##*/}\"}," done echo "]" ) @@ -50,7 +48,6 @@ jobs: strategy: matrix: include: ${{ fromJSON(needs.scrub.outputs.json) }} - # include: [ {"package": "bitnami/postgresql", "major_tag": "12"}, {"package": "bitnami/postgresql", "major_tag": "13"}, {"package": "bitnami/postgresql", "major_tag": "14"}, {"package": "bitnami/postgresql", "major_tag": "15"}, {"package": "bitnami/postgresql", "major_tag": "16"} ] timeout-minutes: 10 steps: - uses: actions/checkout@v4 From 71a16fac6f35e0f0906da839144a52dc811d389b Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 17:26:17 -0800 Subject: [PATCH 52/55] Now more complicated --- .github/workflows/pr-open.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index b870c3b3..00e0a0ba 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -20,20 +20,24 @@ jobs: - name: Get Dockerfiles id: dockerfiles run: | - # Get all Dockerfiles that have changed + # Fetch default_branch (usually main) git fetch origin ${{ github.event.repository.default_branch }} - DOCKERFILES=($(git diff --name-only origin/${{ github.event.repository.default_branch }} | grep -E '^.*/.*/Dockerfile$' | sort -u)) - LIST=$(echo "[" - for d in "${DOCKERFILES[@]}"; do + + # Get all Dockerfiles that have changed + LIST=$( + echo "[" + while read -r d; do # Clip off /Dockerfile and use the rest to handle package name and major tag BASE=${d%/*} echo "{\"package\": \"${BASE%/*}\", \"major_tag\": \"${BASE##*/}\"}," - done + done < <(git diff --name-only origin/${{ github.event.repository.default_branch }} | grep -E '^.*/.*/Dockerfile$' | sort -u) echo "]" ) + # Clip extra comma and send to output ONELINE=$(echo $LIST) JSON=$(echo $ONELINE | sed 's/\(.*\),/\1/') + echo "json=${JSON}" echo "json=${JSON}" >> $GITHUB_OUTPUT From b224919e5fe1a919dffe422a698cda77e43ad97b Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 17:29:14 -0800 Subject: [PATCH 53/55] Reduce changed containers --- .github/workflows/pr-open.yml | 5 +---- bitnami/postgresql/13/Dockerfile | 2 +- bitnami/postgresql/14/Dockerfile | 2 +- bitnami/postgresql/15/Dockerfile | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 00e0a0ba..be7bec30 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -25,18 +25,15 @@ jobs: # Get all Dockerfiles that have changed LIST=$( - echo "[" while read -r d; do # Clip off /Dockerfile and use the rest to handle package name and major tag BASE=${d%/*} echo "{\"package\": \"${BASE%/*}\", \"major_tag\": \"${BASE##*/}\"}," done < <(git diff --name-only origin/${{ github.event.repository.default_branch }} | grep -E '^.*/.*/Dockerfile$' | sort -u) - echo "]" ) # Clip extra comma and send to output - ONELINE=$(echo $LIST) - JSON=$(echo $ONELINE | sed 's/\(.*\),/\1/') + JSON=$(echo [$LIST] | sed 's/\(.*\),/\1/') echo "json=${JSON}" echo "json=${JSON}" >> $GITHUB_OUTPUT diff --git a/bitnami/postgresql/13/Dockerfile b/bitnami/postgresql/13/Dockerfile index d431563a..206b820c 100644 --- a/bitnami/postgresql/13/Dockerfile +++ b/bitnami/postgresql/13/Dockerfile @@ -1,4 +1,4 @@ -FROM bitnami/postgresql:16.1.0 +FROM bitnami/postgresql:13.13.0 # Health check and non-privileged user HEALTHCHECK --interval=15s --timeout=5s --retries=3 CMD [ "pg_isready" ] diff --git a/bitnami/postgresql/14/Dockerfile b/bitnami/postgresql/14/Dockerfile index d431563a..f0ccdc03 100644 --- a/bitnami/postgresql/14/Dockerfile +++ b/bitnami/postgresql/14/Dockerfile @@ -1,4 +1,4 @@ -FROM bitnami/postgresql:16.1.0 +FROM bitnami/postgresql:14.10.0 # Health check and non-privileged user HEALTHCHECK --interval=15s --timeout=5s --retries=3 CMD [ "pg_isready" ] diff --git a/bitnami/postgresql/15/Dockerfile b/bitnami/postgresql/15/Dockerfile index d431563a..919d65f4 100644 --- a/bitnami/postgresql/15/Dockerfile +++ b/bitnami/postgresql/15/Dockerfile @@ -1,4 +1,4 @@ -FROM bitnami/postgresql:16.1.0 +FROM bitnami/postgresql:15.5.0 # Health check and non-privileged user HEALTHCHECK --interval=15s --timeout=5s --retries=3 CMD [ "pg_isready" ] From 1a05970f6614bba55466fff6828281b8bb1cbca6 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 17:39:07 -0800 Subject: [PATCH 54/55] Cleanup --- .github/workflows/pr-open.yml | 39 +++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index be7bec30..31d5256e 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -23,13 +23,16 @@ jobs: # Fetch default_branch (usually main) git fetch origin ${{ github.event.repository.default_branch }} - # Get all Dockerfiles that have changed + # Get changed Dockerfiles, create JSON object for the builder LIST=$( while read -r d; do - # Clip off /Dockerfile and use the rest to handle package name and major tag BASE=${d%/*} echo "{\"package\": \"${BASE%/*}\", \"major_tag\": \"${BASE##*/}\"}," - done < <(git diff --name-only origin/${{ github.event.repository.default_branch }} | grep -E '^.*/.*/Dockerfile$' | sort -u) + done < <( \ + git diff --name-only origin/${{ github.event.repository.default_branch }} \ + | grep -E '^.*/.*/Dockerfile$' \ + | sort -u \ + ) ) # Clip extra comma and send to output @@ -66,20 +69,20 @@ jobs: tag: ${{ steps.tag.outputs.full_tag }} triggers: ${{ matrix.package}}/${{ matrix.triggers }} - # pr-description-add: - # name: PR Description Add - # needs: [builds] - # runs-on: ubuntu-22.04 - # permissions: - # pull-requests: write - # timeout-minutes: 1 - # steps: - # - uses: bcgov-nr/action-pr-description-add@v1.1.0 - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # add_markdown: | - # --- + pr-description-add: + name: PR Description Add + needs: [builds] + runs-on: ubuntu-22.04 + permissions: + pull-requests: write + timeout-minutes: 1 + steps: + - uses: bcgov-nr/action-pr-description-add@v1.1.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + add_markdown: | + --- - # Thanks for the PR! + Thanks for the PR! - # Any new images should be viewable with [our repo packages](https://github.com/orgs/bcgov/packages?repo_name=nr-containers). :) + Any new images should be viewable with [our repo packages](https://github.com/orgs/bcgov/packages?repo_name=nr-containers). :) From d85fee657b6e7d443d300bfdff0897e0f6300608 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Wed, 15 Nov 2023 17:42:25 -0800 Subject: [PATCH 55/55] Simplify --- .github/workflows/pr-open.yml | 10 +++------- bitnami/postgresql/12/Dockerfile | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 31d5256e..54e6e17d 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -24,20 +24,16 @@ jobs: git fetch origin ${{ github.event.repository.default_branch }} # Get changed Dockerfiles, create JSON object for the builder + DOCKERFILES=($(git diff --name-only origin/${{ github.event.repository.default_branch }} | grep -E '^.*/.*/Dockerfile$' | sort -u)) LIST=$( - while read -r d; do + for d in "${DOCKERFILES[@]}"; do BASE=${d%/*} echo "{\"package\": \"${BASE%/*}\", \"major_tag\": \"${BASE##*/}\"}," - done < <( \ - git diff --name-only origin/${{ github.event.repository.default_branch }} \ - | grep -E '^.*/.*/Dockerfile$' \ - | sort -u \ - ) + done ) # Clip extra comma and send to output JSON=$(echo [$LIST] | sed 's/\(.*\),/\1/') - echo "json=${JSON}" echo "json=${JSON}" >> $GITHUB_OUTPUT diff --git a/bitnami/postgresql/12/Dockerfile b/bitnami/postgresql/12/Dockerfile index d431563a..69091c61 100644 --- a/bitnami/postgresql/12/Dockerfile +++ b/bitnami/postgresql/12/Dockerfile @@ -1,4 +1,4 @@ -FROM bitnami/postgresql:16.1.0 +FROM bitnami/postgresql:12.17.0 # Health check and non-privileged user HEALTHCHECK --interval=15s --timeout=5s --retries=3 CMD [ "pg_isready" ]