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

OCP4: Fix pr image workflow #11533

Merged
merged 1 commit into from
Feb 6, 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
53 changes: 43 additions & 10 deletions .github/workflows/k8s-content-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading