-
Notifications
You must be signed in to change notification settings - Fork 706
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There was a issue with existing pr image build workflow, github does not let workflow to use metal-toolbox/container-push/.github/workflows/container-push.yml@main in the steps, this PR replace metal-toolbox to build and push image directly
- Loading branch information
1 parent
1dfff9b
commit c287b14
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='Apache-2.0' | ||
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: | ||
|