From 28718bdc1057ccea0befa0119f64e8d8e958eaae Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Fri, 28 Jun 2024 11:58:05 -0400 Subject: [PATCH 01/21] Add automated testing of changes in .github/workflows --- .github/workflows/dev-build.yml | 6 +++++- .github/workflows/prod-build.yml | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index 542bbfd..bd174cc 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -32,12 +32,16 @@ jobs: - name: Create tags.yml to grab changes id: get_tags run: | - for i in $(find containers -name "Dockerfile") + for i in $(find containers -name "Dockerfile" -not -path "containers/testapp/0.0.2/*") do path=$(dirname $i) tag=$(echo $path | cut -f 2- -d/) echo -e "$tag:\n $path/**" done > .github/tags.yml + - name: Add to tags.yml to grab changes in testapp/0.0.2 and github action workflows + id: add_testapp_002_tag + run: | + echo -e "testapp/0.0.2:\n - testapp/0.0.2/**\n - .github/workflows/**" >> .github/tags.yml - name: debug run: cat .github/tags.yml - uses: mirpedrol/paths-filter@main diff --git a/.github/workflows/prod-build.yml b/.github/workflows/prod-build.yml index 7cecf1e..d13cd03 100644 --- a/.github/workflows/prod-build.yml +++ b/.github/workflows/prod-build.yml @@ -30,12 +30,16 @@ jobs: - name: Create tags.yml to grab changes id: get_tags run: | - for i in $(find containers -name "Dockerfile") + for i in $(find containers -name "Dockerfile" -not -path "containers/testapp/0.0.2/*") do path=$(dirname $i) tag=$(echo $path | cut -f 2- -d/) echo -e "$tag:\n $path/**" done > .github/tags.yml + - name: Add to tags.yml to grab changes in testapp/0.0.2 and github action workflows + id: add_testapp_002_tag + run: | + echo -e "testapp/0.0.2:\n - testapp/0.0.2/**\n - .github/workflows/**" >> .github/tags.yml - name: debug run: cat .github/tags.yml - uses: mirpedrol/paths-filter@main From 1d19bb811b65b51629f58aab5ad987bbc1a70b96 Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Fri, 28 Jun 2024 12:12:58 -0400 Subject: [PATCH 02/21] testing different way of moving folders --- .github/workflows/dev-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index 5ed0c3a..48c62f2 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -71,7 +71,7 @@ jobs: remove-haskell: 'true' remove-codeql: 'true' - name: Restore /var/lib/docker/ - run: sudo sh -c "mv ${GITHUB_WORKSPACE}/docker/* /var/lib/docker" + run: sudo sh -c "for i in ${GITHUB_WORKSPACE}/docker/* ; do mv $i /var/lib/docker ;done" - name: Checkout uses: actions/checkout@v4 - name: Hadolint From fbd8bee968cd8599090beb4a7185fb5c24bed9c4 Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Fri, 28 Jun 2024 12:15:26 -0400 Subject: [PATCH 03/21] testing different way of moving folders --- .github/workflows/dev-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index 48c62f2..0b4dc42 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -71,7 +71,7 @@ jobs: remove-haskell: 'true' remove-codeql: 'true' - name: Restore /var/lib/docker/ - run: sudo sh -c "for i in ${GITHUB_WORKSPACE}/docker/* ; do mv $i /var/lib/docker ;done" + run: sudo sh -c "for i in ${GITHUB_WORKSPACE}/docker/* ; do echo $i ; mv $i /var/lib/docker/$(basename $i) ;done" - name: Checkout uses: actions/checkout@v4 - name: Hadolint From 4d310696a74aa0255351e818e74ce14fec1e55e8 Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Fri, 28 Jun 2024 12:16:50 -0400 Subject: [PATCH 04/21] testing different way of moving folders --- .github/workflows/dev-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index 0b4dc42..f7457cc 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -71,7 +71,7 @@ jobs: remove-haskell: 'true' remove-codeql: 'true' - name: Restore /var/lib/docker/ - run: sudo sh -c "for i in ${GITHUB_WORKSPACE}/docker/* ; do echo $i ; mv $i /var/lib/docker/$(basename $i) ;done" + run: sudo sh -c "for i in ${GITHUB_WORKSPACE}/docker/* ; do echo \$i ; mv $i /var/lib/docker/ ;done" - name: Checkout uses: actions/checkout@v4 - name: Hadolint From 07a12122a957cf6322cd25659f02f3fd0bffc1b7 Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Fri, 28 Jun 2024 12:18:17 -0400 Subject: [PATCH 05/21] testing different way of moving folders --- .github/workflows/dev-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index f7457cc..313d2a5 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -71,7 +71,7 @@ jobs: remove-haskell: 'true' remove-codeql: 'true' - name: Restore /var/lib/docker/ - run: sudo sh -c "for i in ${GITHUB_WORKSPACE}/docker/* ; do echo \$i ; mv $i /var/lib/docker/ ;done" + run: sudo sh -c "for i in ${GITHUB_WORKSPACE}/docker/* ; do echo \$i ; mv \$i /var/lib/docker/ ;done" - name: Checkout uses: actions/checkout@v4 - name: Hadolint From 09490d8938dbfd754b9547feedde01eeccd80429 Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Fri, 28 Jun 2024 12:26:46 -0400 Subject: [PATCH 06/21] testing different way of moving folders --- .github/workflows/dev-build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index 313d2a5..cead8ec 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -70,8 +70,12 @@ jobs: remove-android: 'true' remove-haskell: 'true' remove-codeql: 'true' + - name: Stop docker + run: sudo service docker stop - name: Restore /var/lib/docker/ run: sudo sh -c "for i in ${GITHUB_WORKSPACE}/docker/* ; do echo \$i ; mv \$i /var/lib/docker/ ;done" + - name: Restart docker + run: sudo service docker restart - name: Checkout uses: actions/checkout@v4 - name: Hadolint From 18eb8a0e155c0d3fa478f15af8d5b8e4d52a9e04 Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Fri, 28 Jun 2024 12:31:29 -0400 Subject: [PATCH 07/21] testing different way of moving folders --- .github/workflows/dev-build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index cead8ec..6fb8d51 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -73,7 +73,9 @@ jobs: - name: Stop docker run: sudo service docker stop - name: Restore /var/lib/docker/ - run: sudo sh -c "for i in ${GITHUB_WORKSPACE}/docker/* ; do echo \$i ; mv \$i /var/lib/docker/ ;done" + run: | + sudo rm -rf /var/lib/docker/ + sudo mv "${GITHUB_WORKSPACE}/docker" /var/lib/docker/ - name: Restart docker run: sudo service docker restart - name: Checkout From 315e94dcb70f1d352f843a4a22e51480106da794 Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Fri, 28 Jun 2024 12:44:51 -0400 Subject: [PATCH 08/21] testing different way of moving folders --- .github/workflows/dev-build.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index 6fb8d51..b110e82 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -70,14 +70,10 @@ jobs: remove-android: 'true' remove-haskell: 'true' remove-codeql: 'true' - - name: Stop docker - run: sudo service docker stop - name: Restore /var/lib/docker/ run: | - sudo rm -rf /var/lib/docker/ - sudo mv "${GITHUB_WORKSPACE}/docker" /var/lib/docker/ - - name: Restart docker - run: sudo service docker restart + sudo rsync -aPq ${GITHUB_WORKSPACE}/docker/ /var/lib/docker + sudo rm -rf ${GITHUB_WORKSPACE}/docker - name: Checkout uses: actions/checkout@v4 - name: Hadolint From a84607f05c9c0e11c953ecc711c374c81f22dc24 Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Fri, 28 Jun 2024 12:49:19 -0400 Subject: [PATCH 09/21] testing different way of moving folders --- .github/workflows/dev-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index b110e82..4040a8a 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -72,8 +72,8 @@ jobs: remove-codeql: 'true' - name: Restore /var/lib/docker/ run: | - sudo rsync -aPq ${GITHUB_WORKSPACE}/docker/ /var/lib/docker - sudo rm -rf ${GITHUB_WORKSPACE}/docker + sudo rsync -aPq "${GITHUB_WORKSPACE}/docker/" /var/lib/docker + sudo rm -rf "${GITHUB_WORKSPACE}/docker" - name: Checkout uses: actions/checkout@v4 - name: Hadolint From aaf1acd59b3b0ad17a4588c93f1b8bff73190e6e Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Fri, 28 Jun 2024 13:01:06 -0400 Subject: [PATCH 10/21] separate hadolint --- .github/workflows/dev-build.yml | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index 4040a8a..f278b2f 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -49,7 +49,24 @@ jobs: with: filters: ".github/tags.yml" token: "" - dockerfile-validate-build: + dockerfile-lint: + runs-on: ubuntu-latest + name: dockerfile-lint + needs: [dockerfile-changes] + if: needs.dockerfile-changes.outputs.docker-images != '[]' + strategy: + fail-fast: false + matrix: + tags: ["${{ fromJson(needs.dockerfile-changes.outputs.docker-images) }}"] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Hadolint + uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: containers/${{ matrix.tags }}/Dockerfile + verbose: true + docker-validate-build: runs-on: ubuntu-latest name: dockerfile-build needs: [dockerfile-changes] @@ -76,11 +93,6 @@ jobs: sudo rm -rf "${GITHUB_WORKSPACE}/docker" - name: Checkout uses: actions/checkout@v4 - - name: Hadolint - uses: hadolint/hadolint-action@v3.1.0 - with: - dockerfile: containers/${{ matrix.tags }}/Dockerfile - verbose: true - name: Set up Python uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5 with: @@ -127,7 +139,7 @@ jobs: push: true confirm-pass: runs-on: ubuntu-latest - needs: [ dockerfile-changes, dockerfile-validate-build ] + needs: [ dockerfile-changes, docker-validate-build, dockerfile-lint ] if: always() steps: - name: All tests ok From b6038c5f7b9bb5ee533de228ac3584791558dbd2 Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Fri, 28 Jun 2024 13:05:11 -0400 Subject: [PATCH 11/21] Empty-Commit From 4ebbf2b98741c5797cc0d210954772b2bfe9777a Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Fri, 28 Jun 2024 13:11:43 -0400 Subject: [PATCH 12/21] testing different way of moving folders --- .github/workflows/dev-build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index f278b2f..8af5b78 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -77,8 +77,8 @@ jobs: tags: ["${{ fromJson(needs.dockerfile-changes.outputs.docker-images) }}"] steps: # save hadolint-action docker image, which for whatever reason builds before other steps - - name: Move /var/lib/docker/ - run: sudo mv /var/lib/docker/ "${GITHUB_WORKSPACE}/docker" + #- name: Move /var/lib/docker/ + # run: sudo mv /var/lib/docker/ "${GITHUB_WORKSPACE}/docker" - name: Maximize build space uses: easimon/maximize-build-space@master with: @@ -87,10 +87,10 @@ jobs: remove-android: 'true' remove-haskell: 'true' remove-codeql: 'true' - - name: Restore /var/lib/docker/ - run: | - sudo rsync -aPq "${GITHUB_WORKSPACE}/docker/" /var/lib/docker - sudo rm -rf "${GITHUB_WORKSPACE}/docker" + #- name: Restore /var/lib/docker/ + # run: | + # sudo rsync -aPq "${GITHUB_WORKSPACE}/docker/" /var/lib/docker + # sudo rm -rf "${GITHUB_WORKSPACE}/docker" - name: Checkout uses: actions/checkout@v4 - name: Set up Python From bbb5f9503f9d82d698cd8b186d9090ee1496067c Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Fri, 28 Jun 2024 14:00:09 -0400 Subject: [PATCH 13/21] testing different way of moving folders --- .github/workflows/dev-build.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index 8af5b78..cfa89ee 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -76,9 +76,9 @@ jobs: matrix: tags: ["${{ fromJson(needs.dockerfile-changes.outputs.docker-images) }}"] steps: - # save hadolint-action docker image, which for whatever reason builds before other steps - #- name: Move /var/lib/docker/ - # run: sudo mv /var/lib/docker/ "${GITHUB_WORKSPACE}/docker" + # save docker files + - name: Move /var/lib/docker/ + run: sudo mv /var/lib/docker/ "${GITHUB_WORKSPACE}/docker" - name: Maximize build space uses: easimon/maximize-build-space@master with: @@ -87,10 +87,10 @@ jobs: remove-android: 'true' remove-haskell: 'true' remove-codeql: 'true' - #- name: Restore /var/lib/docker/ - # run: | - # sudo rsync -aPq "${GITHUB_WORKSPACE}/docker/" /var/lib/docker - # sudo rm -rf "${GITHUB_WORKSPACE}/docker" + - name: Restore /var/lib/docker/ + run: | + sudo rsync -aPq "${GITHUB_WORKSPACE}/docker/" /var/lib/docker + sudo rm -rf "${GITHUB_WORKSPACE}/docker" - name: Checkout uses: actions/checkout@v4 - name: Set up Python From a9ba4c7e297f09894b5bd5eaccb041430fe639bd Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Fri, 28 Jun 2024 14:46:42 -0400 Subject: [PATCH 14/21] Empty-Commit From 12aa6715df599a4861f05ba51b62d4bee19d886a Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Fri, 28 Jun 2024 15:42:20 -0400 Subject: [PATCH 15/21] exclude prod workflow from act execution --- .github/workflows/prod-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/prod-build.yml b/.github/workflows/prod-build.yml index 62d089e..31516f2 100644 --- a/.github/workflows/prod-build.yml +++ b/.github/workflows/prod-build.yml @@ -15,6 +15,7 @@ env: jobs: dockerfile-changes: name: dockerfile-changes + if: ${{ !github.event.act }} runs-on: ubuntu-latest permissions: pull-requests: read From e5c852c75e4b35660ab1d1356bf23752b838128e Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Fri, 28 Jun 2024 16:40:56 -0400 Subject: [PATCH 16/21] make workflows compatible with act --- .actrc | 1 + .github/workflows/dev-build.yml | 4 ++++ .github/workflows/prod-build.yml | 3 ++- act_event.json | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .actrc create mode 100644 act_event.json diff --git a/.actrc b/.actrc new file mode 100644 index 0000000..f607562 --- /dev/null +++ b/.actrc @@ -0,0 +1 @@ +-e act_event.json diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index cfa89ee..56d3b82 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -47,6 +47,7 @@ jobs: - uses: mirpedrol/paths-filter@main id: filter with: + base: ${{github.ref}} filters: ".github/tags.yml" token: "" dockerfile-lint: @@ -78,8 +79,10 @@ jobs: steps: # save docker files - name: Move /var/lib/docker/ + if: ${{ !github.event.act }} run: sudo mv /var/lib/docker/ "${GITHUB_WORKSPACE}/docker" - name: Maximize build space + if: ${{ !github.event.act }} uses: easimon/maximize-build-space@master with: build-mount-path: /var/lib/docker/ @@ -88,6 +91,7 @@ jobs: remove-haskell: 'true' remove-codeql: 'true' - name: Restore /var/lib/docker/ + if: ${{ !github.event.act }} run: | sudo rsync -aPq "${GITHUB_WORKSPACE}/docker/" /var/lib/docker sudo rm -rf "${GITHUB_WORKSPACE}/docker" diff --git a/.github/workflows/prod-build.yml b/.github/workflows/prod-build.yml index 31516f2..14296fe 100644 --- a/.github/workflows/prod-build.yml +++ b/.github/workflows/prod-build.yml @@ -46,6 +46,7 @@ jobs: - uses: mirpedrol/paths-filter@main id: filter with: + base: ${{github.ref}} filters: ".github/tags.yml" token: "" dockerfile-validate-build: @@ -135,7 +136,7 @@ jobs: confirm-pass: runs-on: ubuntu-latest needs: [ dockerfile-changes, dockerfile-validate-build ] - if: always() + if: always() & ${{ !github.event.act }} steps: - name: All tests ok if: ${{ success() || !contains(needs.*.result, 'failure') }} diff --git a/act_event.json b/act_event.json new file mode 100644 index 0000000..43c2f0e --- /dev/null +++ b/act_event.json @@ -0,0 +1,3 @@ +{ + "act": true +} From 4aa00eaa6953698c1c2bced8366efd7dac66c13e Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Fri, 28 Jun 2024 17:34:36 -0400 Subject: [PATCH 17/21] fix base input parameter in dockerfile-changes workflow --- .github/workflows/dev-build.yml | 2 +- .github/workflows/prod-build.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index 56d3b82..a4d252d 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -47,7 +47,7 @@ jobs: - uses: mirpedrol/paths-filter@main id: filter with: - base: ${{github.ref}} + base: "develop" filters: ".github/tags.yml" token: "" dockerfile-lint: diff --git a/.github/workflows/prod-build.yml b/.github/workflows/prod-build.yml index 14296fe..7447535 100644 --- a/.github/workflows/prod-build.yml +++ b/.github/workflows/prod-build.yml @@ -46,7 +46,7 @@ jobs: - uses: mirpedrol/paths-filter@main id: filter with: - base: ${{github.ref}} + base: "main" filters: ".github/tags.yml" token: "" dockerfile-validate-build: From 5de4877d16d79b8609b9c6d8e88df5003857c432 Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Mon, 1 Jul 2024 12:31:34 -0400 Subject: [PATCH 18/21] add step to print github context --- .github/workflows/dev-build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index a4d252d..764b4a7 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -24,6 +24,10 @@ jobs: # Expose matched filters as job 'docker-images' output variable docker-images: ${{ steps.filter.outputs.changes }} steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v4 with: fetch-depth: 2 From 251f51a09c6d9049a5d28ade8875759e169357db Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Mon, 1 Jul 2024 12:31:57 -0400 Subject: [PATCH 19/21] make prod workflow match dev workflow --- .github/workflows/prod-build.yml | 40 +++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/.github/workflows/prod-build.yml b/.github/workflows/prod-build.yml index 7447535..f97fe09 100644 --- a/.github/workflows/prod-build.yml +++ b/.github/workflows/prod-build.yml @@ -23,6 +23,10 @@ jobs: # Expose matched filters as job 'docker-images' output variable docker-images: ${{ steps.filter.outputs.changes }} steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v4 with: fetch-depth: 2 @@ -49,7 +53,24 @@ jobs: base: "main" filters: ".github/tags.yml" token: "" - dockerfile-validate-build: + dockerfile-lint: + runs-on: ubuntu-latest + name: dockerfile-lint + needs: [dockerfile-changes] + if: needs.dockerfile-changes.outputs.docker-images != '[]' + strategy: + fail-fast: false + matrix: + tags: ["${{ fromJson(needs.dockerfile-changes.outputs.docker-images) }}"] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Hadolint + uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: containers/${{ matrix.tags }}/Dockerfile + verbose: true + docker-validate-build: runs-on: ubuntu-latest name: dockerfile-build needs: [dockerfile-changes] @@ -59,26 +80,23 @@ jobs: matrix: tags: ["${{ fromJson(needs.dockerfile-changes.outputs.docker-images) }}"] steps: - # save hadolint-action docker image, which for whatever reason builds before other steps + # save docker files - name: Move /var/lib/docker/ - run: sudo mv /var/lib/docker "${GITHUB_WORKSPACE}/docker" + run: sudo mv /var/lib/docker/ "${GITHUB_WORKSPACE}/docker" - name: Maximize build space uses: easimon/maximize-build-space@master with: + build-mount-path: /var/lib/docker/ remove-dotnet: 'true' remove-android: 'true' remove-haskell: 'true' remove-codeql: 'true' - build-mount-path: '/var/lib/docker/' - name: Restore /var/lib/docker/ - run: sudo sh -c "mv ${GITHUB_WORKSPACE}/docker/* /var/lib/docker" + run: | + sudo rsync -aPq "${GITHUB_WORKSPACE}/docker/" /var/lib/docker + sudo rm -rf "${GITHUB_WORKSPACE}/docker" - name: Checkout uses: actions/checkout@v4 - - name: Hadolint - uses: hadolint/hadolint-action@v3.1.0 - with: - dockerfile: containers/${{ matrix.tags }}/Dockerfile - verbose: true - name: Set up Python uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5 with: @@ -135,7 +153,7 @@ jobs: push: true confirm-pass: runs-on: ubuntu-latest - needs: [ dockerfile-changes, dockerfile-validate-build ] + needs: [ dockerfile-changes, docker-validate-build, dockerfile-lint ] if: always() & ${{ !github.event.act }} steps: - name: All tests ok From 3f9d5a2ef824bfbe04dd138e64d00d47edd227f3 Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Mon, 8 Jul 2024 12:32:10 -0400 Subject: [PATCH 20/21] put all workflows scripts and assets inside .github/workflows --- .github/workflows/dev-build.yml | 2 +- .github/workflows/prod-build.yml | 2 +- .github/{ => workflows/scripts}/jsonschema/docker_image.json | 0 .github/{ => workflows/scripts}/validate_docker.py | 0 4 files changed, 2 insertions(+), 2 deletions(-) rename .github/{ => workflows/scripts}/jsonschema/docker_image.json (100%) rename .github/{ => workflows/scripts}/validate_docker.py (100%) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index 06f108c..57ba044 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -134,7 +134,7 @@ jobs: run : pip install docker jsonschema - name: Validate image build metadata run: | - python .github/validate_docker.py ${{ env.JFROG_CONTAINER_REPO }}/${{ steps.docker_repo_name.outputs.name}}:${{steps.docker_repo_version.outputs.version}} .github/jsonschema/docker_image.json + python .github/workflows/validate_docker.py ${{ env.JFROG_CONTAINER_REPO }}/${{ steps.docker_repo_name.outputs.name}}:${{steps.docker_repo_version.outputs.version}} .github/workflows/jsonschema/docker_image.json - name: Test JFrog image build run: | docker run --rm ${{ env.JFROG_CONTAINER_REPO }}/${{ steps.docker_repo_name.outputs.name}}:${{steps.docker_repo_version.outputs.version}} diff --git a/.github/workflows/prod-build.yml b/.github/workflows/prod-build.yml index f97fe09..d3e6337 100644 --- a/.github/workflows/prod-build.yml +++ b/.github/workflows/prod-build.yml @@ -130,7 +130,7 @@ jobs: run : pip install docker jsonschema - name: Validate image build metadata run: | - python .github/validate_docker.py ${{ env.JFROG_CONTAINER_REPO }}/${{ steps.docker_repo_name.outputs.name}}:${{steps.docker_repo_version.outputs.version}} .github/jsonschema/docker_image.json + python .github/workflows/validate_docker.py ${{ env.JFROG_CONTAINER_REPO }}/${{ steps.docker_repo_name.outputs.name}}:${{steps.docker_repo_version.outputs.version}} .github/workflows/jsonschema/docker_image.json - name: Test JFrog image build run: | docker run --rm ${{ env.JFROG_CONTAINER_REPO }}/${{ steps.docker_repo_name.outputs.name}}:${{steps.docker_repo_version.outputs.version}} diff --git a/.github/jsonschema/docker_image.json b/.github/workflows/scripts/jsonschema/docker_image.json similarity index 100% rename from .github/jsonschema/docker_image.json rename to .github/workflows/scripts/jsonschema/docker_image.json diff --git a/.github/validate_docker.py b/.github/workflows/scripts/validate_docker.py similarity index 100% rename from .github/validate_docker.py rename to .github/workflows/scripts/validate_docker.py From 90d00f273ca4b3eb0da6fe8816dfc35db9075c82 Mon Sep 17 00:00:00 2001 From: Anne Marie Noronha Date: Mon, 8 Jul 2024 12:51:01 -0400 Subject: [PATCH 21/21] fix paths --- .github/workflows/dev-build.yml | 2 +- .github/workflows/prod-build.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index 57ba044..3f00a0f 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -134,7 +134,7 @@ jobs: run : pip install docker jsonschema - name: Validate image build metadata run: | - python .github/workflows/validate_docker.py ${{ env.JFROG_CONTAINER_REPO }}/${{ steps.docker_repo_name.outputs.name}}:${{steps.docker_repo_version.outputs.version}} .github/workflows/jsonschema/docker_image.json + python .github/workflows/scripts/validate_docker.py ${{ env.JFROG_CONTAINER_REPO }}/${{ steps.docker_repo_name.outputs.name}}:${{steps.docker_repo_version.outputs.version}} .github/workflows/scripts/jsonschema/docker_image.json - name: Test JFrog image build run: | docker run --rm ${{ env.JFROG_CONTAINER_REPO }}/${{ steps.docker_repo_name.outputs.name}}:${{steps.docker_repo_version.outputs.version}} diff --git a/.github/workflows/prod-build.yml b/.github/workflows/prod-build.yml index d3e6337..c99ddf9 100644 --- a/.github/workflows/prod-build.yml +++ b/.github/workflows/prod-build.yml @@ -130,7 +130,7 @@ jobs: run : pip install docker jsonschema - name: Validate image build metadata run: | - python .github/workflows/validate_docker.py ${{ env.JFROG_CONTAINER_REPO }}/${{ steps.docker_repo_name.outputs.name}}:${{steps.docker_repo_version.outputs.version}} .github/workflows/jsonschema/docker_image.json + python .github/workflows/scripts/validate_docker.py ${{ env.JFROG_CONTAINER_REPO }}/${{ steps.docker_repo_name.outputs.name}}:${{steps.docker_repo_version.outputs.version}} .github/workflows/scripts/jsonschema/docker_image.json - name: Test JFrog image build run: | docker run --rm ${{ env.JFROG_CONTAINER_REPO }}/${{ steps.docker_repo_name.outputs.name}}:${{steps.docker_repo_version.outputs.version}}