diff --git a/.containerignore b/.dockerignore similarity index 100% rename from .containerignore rename to .dockerignore diff --git a/.github/workflows/image-build.yaml b/.github/workflows/image-build.yaml index b9b2f4d..672bfb8 100644 --- a/.github/workflows/image-build.yaml +++ b/.github/workflows/image-build.yaml @@ -14,12 +14,23 @@ concurrency: cancel-in-progress: true jobs: + prepare: + runs-on: ubuntu-latest + steps: + - name: Extract tag + id: extract_tag + run: | + tag=$(if [[ ${{github.ref_name}} == v* ]];then echo "${{github.ref_name}}"; else echo "latest"; fi) + echo "tag=$tag" >> $GITHUB_OUTPUT + outputs: + tag: ${{ steps.extract_tag.outputs.tag }} + operator-build: uses: trustification/release-tools/.github/workflows/build-push-images.yaml@main with: registry: "ghcr.io" image_name: "${{ github.repository_owner }}/trustify-operator" - containerfile: "./Containerfile" + containerfile: "./Dockerfile" architectures: '[ "amd64" ]' secrets: registry_username: ${{ github.actor }} @@ -28,13 +39,14 @@ jobs: bundle-build: uses: trustification/release-tools/.github/workflows/build-push-images.yaml@main needs: + - prepare - operator-build with: registry: "ghcr.io" image_name: "${{ github.repository_owner }}/trustify-operator-bundle" - containerfile: "./bundle.Containerfile" + containerfile: "./bundle.Dockerfile" architectures: '[ "amd64" ]' - extra-args: "--build-arg IMAGE_GROUP=${{ github.repository_owner }}" + extra-args: "--build-arg IMAGE_GROUP=${{ github.repository_owner }} --build-arg IMAGE_TAG=${{ needs.prepare.outputs.tag }}" secrets: registry_username: ${{ github.actor }} registry_password: ${{ secrets.GITHUB_TOKEN }} @@ -42,6 +54,7 @@ jobs: catalog-build: runs-on: ubuntu-latest needs: + - prepare - bundle-build steps: - name: Setup OLM CLIs @@ -54,24 +67,20 @@ jobs: curl -LO ${OPERATOR_SDK_DL_URL}/${OS}-${ARCH}-opm chmod +x ${OS}-${ARCH}-opm && sudo mv ${OS}-${ARCH}-opm /usr/local/bin/opm - - name: Extract tag - id: extract_tag - run: | - tag=$(if [[ ${{github.ref_name}} == v* ]];then echo "${{github.ref_name}}"; else echo "latest"; fi) - echo "TAG=$tag" >> $GITHUB_ENV - - name: Create catalog run: | opm index add \ - --bundles ghcr.io/${{ github.repository_owner }}/trustify-operator-bundle:${{ env.TAG }} \ - --tag ${{ github.repository_owner }}/trustify-operator-catalog:${{ env.TAG }} \ + --bundles ghcr.io/${{ github.repository_owner }}/trustify-operator-bundle:$TAG \ + --tag ${{ github.repository_owner }}/trustify-operator-catalog:$TAG \ --build-tool podman + env: + TAG: ${{ needs.prepare.outputs.tag }} - name: Push To Registry uses: redhat-actions/push-to-registry@v2 with: image: ${{ github.repository_owner }}/trustify-operator-catalog - tags: ${{ env.TAG }} + tags: ${{ needs.prepare.outputs.tag }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - registry: "ghcr.io" \ No newline at end of file + registry: "ghcr.io" diff --git a/Containerfile b/Dockerfile similarity index 100% rename from Containerfile rename to Dockerfile diff --git a/bundle.Containerfile b/bundle.Dockerfile similarity index 96% rename from bundle.Containerfile rename to bundle.Dockerfile index ad1409f..3121e3d 100644 --- a/bundle.Containerfile +++ b/bundle.Dockerfile @@ -1,5 +1,6 @@ FROM quay.io/quarkus/ubi-quarkus-mandrel-builder-image:jdk-21 AS build ARG IMAGE_GROUP +ARG IMAGE_TAG COPY --chown=quarkus:quarkus mvnw /code/mvnw COPY --chown=quarkus:quarkus .mvn /code/.mvn COPY --chown=quarkus:quarkus pom.xml /code/ @@ -7,7 +8,7 @@ USER quarkus WORKDIR /code RUN ./mvnw -B org.apache.maven.plugins:maven-dependency-plugin:3.1.2:go-offline COPY src/main /code/src/main -RUN ./mvnw package -DskipTests -Dquarkus.container-image.group=$IMAGE_GROUP +RUN ./mvnw package -DskipTests -Dquarkus.container-image.group=$IMAGE_GROUP -Dquarkus.container-image.tag=$IMAGE_TAG FROM registry.access.redhat.com/ubi9/ubi:latest as bundle COPY scripts /scripts