-
Notifications
You must be signed in to change notification settings - Fork 710
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11533 from ComplianceAsCode/fix_pr_image_workflow
OCP4: Fix pr image workflow
- Loading branch information
Showing
1 changed file
with
43 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,21 +47,54 @@ jobs: | |
id-token: write | ||
packages: write | ||
runs-on: ubuntu-latest | ||
outputs: | ||
image-digest: ${{ steps.container_info.outputs.image-digest }} | ||
image-tags: ${{ steps.container_info.outputs.image-tags }} | ||
steps: | ||
- name: Checkout PR branch | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: refs/pull/${{ needs.get-pr-number.outputs.pr-number }}/head | ||
- name: Build and push container image | ||
uses: metal-toolbox/container-push/.github/workflows/container-push.yml@main | ||
- name: Login to ghcr.io | ||
uses: docker/[email protected] | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
name: k8scontent | ||
tag: ${{ needs.get-pr-number.outputs.pr-number }} | ||
latest: false | ||
registry_org: complianceascode | ||
dockerfile_path: ./Dockerfiles/ocp4_content | ||
licenses: BSD | ||
vendor: ComplianceAsCode authors | ||
images: ghcr.io/complianceascode/k8scontent | ||
tags: | | ||
type=raw,value=${{ needs.get-pr-number.outputs.pr-number }} | ||
type=sha,format=long | ||
labels: | | ||
org.opencontainers.image.source=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} | ||
org.opencontainers.image.title=Kubernetes content | ||
org.opencontainers.image.version=${{ needs.get-pr-number.outputs.pr-number }} | ||
org.opencontainers.image.licenses='BSD-3-Clause' | ||
org.opencontainers.image.vendor='Compliance Operator Authors' | ||
- name: Build container images and push | ||
id: docker_build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfiles/ocp4_content | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
push: true | ||
platforms: 'linux/amd64' | ||
- name: Get container info | ||
id: container_info | ||
run: | | ||
image_tags="${{ needs.get-pr-number.outputs.pr-number }}" | ||
echo "image-digest=${{ steps.docker_build.outputs.digest }}" >> $GITHUB_OUTPUT | ||
echo "image-tags=${{ needs.get-pr-number.outputs.pr-number }}" >> $GITHUB_OUTPUT | ||
comment-pr: | ||
needs: | ||
|