Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix image path #139

Merged
merged 11 commits into from
Dec 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions .github/workflows/pull_request_container_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,21 @@ jobs:
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
ref: ${{github.event.pull_request.head.sha}}

- name: Generate Tag
- name: Generate image repository path
id: image_repo_path
run: |
echo "IMAGE_REPOSITORY=$(echo ${{ secrets.CONTAINER_REGISTRY_URL }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT

- name: Generate image tag
id: generate_tag
run: |
sha=${{ github.event.pull_request.head.sha }}
tag="SNAPSHOT-PR-${{ github.event.pull_request.number }}-${sha:0:8}"
echo "GIT_TAG=$(echo ${tag})" >> $GITHUB_OUTPUT

- name: Set Output
- name: Generate image path
id: set_output
run: echo "IMAGE_PATH=${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}" >> $GITHUB_OUTPUT
run: echo "IMAGE_PATH=${{ steps.image_repo_path.outputs.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}" >> $GITHUB_OUTPUT

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand All @@ -80,10 +85,6 @@ jobs:
username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
password: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}

- name: Generate image repository path
run: |
echo IMAGE_REPOSITORY=$(echo ${{ secrets.CONTAINER_REGISTRY_URL }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV

- name: Build and push
uses: docker/build-push-action@v6
with:
Expand All @@ -95,7 +96,7 @@ jobs:
build-args: BUILD_PARAMETERS=${{ inputs.BUILD_PARAMETERS }}
cache-to: type=inline
tags: |
${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}
${{ steps.set_output.outputs.IMAGE_PATH }}
labels: |
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.revision=${{ github.sha }}
Expand All @@ -106,7 +107,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message-success: '@${{ github.actor }} Image is available for testing. `docker pull ${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}`'
message-success: '@${{ github.actor }} Image is available for testing. `docker pull ${{ steps.set_output.outputs.IMAGE_PATH }}`'
message-failure: '@${{ github.actor }} Yikes! You better fix it before anyone else finds out! [Build](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}/checks) has Failed!'
allow-repeats: true

Expand Down