From 43f341f97fd241ebd664e5cc12115d0c0e1db556 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Mon, 13 Mar 2023 17:06:18 +0100 Subject: [PATCH 1/3] Use github action expression syntax to alias over github repository name --- .github/workflows/update_ci_image.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update_ci_image.yaml b/.github/workflows/update_ci_image.yaml index 33bb8fd3867..20de0645de8 100644 --- a/.github/workflows/update_ci_image.yaml +++ b/.github/workflows/update_ci_image.yaml @@ -37,7 +37,7 @@ jobs: trigger: ${{ steps.check.outputs.trigger }} no_cache: ${{ steps.check.outputs.no_cache }} container: - image: ghcr.io/ros-planning/navigation2:${{ github.ref_name }} + image: ghcr.io/${{ github.repository }}:${{ github.ref_name }} steps: - name: "Check apt updates" id: check @@ -100,12 +100,12 @@ jobs: pull: true push: true no-cache: ${{ steps.config.outputs.no_cache }} - cache-from: type=registry,ref=ghcr.io/ros-planning/navigation2:${{ github.ref_name }} + cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:${{ github.ref_name }} cache-to: type=inline target: builder tags: | - ghcr.io/ros-planning/navigation2:${{ github.ref_name }} - ghcr.io/ros-planning/navigation2:${{ github.ref_name }}-${{ steps.config.outputs.timestamp }} + ghcr.io/${{ github.repository }}:${{ github.ref_name }} + ghcr.io/${{ github.repository }}:${{ github.ref_name }}-${{ steps.config.outputs.timestamp }} - name: Image digest if: steps.config.outputs.trigger == 'true' run: echo ${{ steps.docker_build.outputs.digest }} From efdba15a96bb8fd3af923451c43fc776cad273eb Mon Sep 17 00:00:00 2001 From: ruffsl Date: Mon, 20 Mar 2023 20:06:40 +0100 Subject: [PATCH 2/3] Tag by version instead of by timestamp --- .github/workflows/update_ci_image.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update_ci_image.yaml b/.github/workflows/update_ci_image.yaml index 20de0645de8..45697475362 100644 --- a/.github/workflows/update_ci_image.yaml +++ b/.github/workflows/update_ci_image.yaml @@ -74,8 +74,8 @@ jobs: - name: Set build config id: config run: | - timestamp=$(date --utc +%Y%m%d%H%M%S) - echo "timestamp=${timestamp}" >> $GITHUB_OUTPUT + version=$(grep -oP '(?<=).*?(?=)' navigation2/package.xml) + echo "version=${version}" >> $GITHUB_OUTPUT no_cache=false if [ "${{needs.check_ci_files.outputs.no_cache}}" == 'true' ] || \ @@ -105,7 +105,7 @@ jobs: target: builder tags: | ghcr.io/${{ github.repository }}:${{ github.ref_name }} - ghcr.io/${{ github.repository }}:${{ github.ref_name }}-${{ steps.config.outputs.timestamp }} + ghcr.io/${{ github.repository }}:${{ github.ref_name }}-${{ steps.config.outputs.version }} - name: Image digest if: steps.config.outputs.trigger == 'true' run: echo ${{ steps.docker_build.outputs.digest }} From 80750df31fc914b21bf77c3dbe8ff1fed6da04e4 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Mon, 20 Mar 2023 20:20:47 +0100 Subject: [PATCH 3/3] Avoid pushing untagged image to GHCR by setting provenance to false now tath provenance is enabled by default as of v4 of docker/build-push-action - https://github.com/docker/build-push-action/pull/781 - https://github.com/docker/build-push-action/issues/778 --- .github/workflows/update_ci_image.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update_ci_image.yaml b/.github/workflows/update_ci_image.yaml index 45697475362..dae9fdab4a2 100644 --- a/.github/workflows/update_ci_image.yaml +++ b/.github/workflows/update_ci_image.yaml @@ -97,6 +97,7 @@ jobs: id: docker_build uses: docker/build-push-action@v4 with: + provenance: false pull: true push: true no-cache: ${{ steps.config.outputs.no_cache }}