Skip to content

Commit

Permalink
Container retention via version tagging (#3491)
Browse files Browse the repository at this point in the history
* Use github action expression syntax
to alias over github repository name

* Tag by version instead of by timestamp

* Avoid pushing untagged image to GHCR
by setting provenance to false
now that provenance is enabled by default
as of v4 of docker/build-push-action

- docker/build-push-action#781
- docker/build-push-action#778
  • Loading branch information
ruffsl authored and SteveMacenski committed Jun 9, 2023
1 parent 704b829 commit bbe6dfc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/update_ci_image.yaml
Expand Up @@ -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
Expand Down Expand Up @@ -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 '(?<=<version>).*?(?=</version>)' navigation2/package.xml)
echo "version=${version}" >> $GITHUB_OUTPUT
no_cache=false
if [ "${{needs.check_ci_files.outputs.no_cache}}" == 'true' ] || \
Expand All @@ -97,15 +97,16 @@ jobs:
id: docker_build
uses: docker/build-push-action@v3
with:
provenance: false
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.version }}
- name: Image digest
if: steps.config.outputs.trigger == 'true'
run: echo ${{ steps.docker_build.outputs.digest }}

0 comments on commit bbe6dfc

Please sign in to comment.