diff --git a/.github/workflows/images_build_rhel.yml b/.github/workflows/images_build_rhel.yml index a298a8323..1fe091f5e 100644 --- a/.github/workflows/images_build_rhel.yml +++ b/.github/workflows/images_build_rhel.yml @@ -47,6 +47,7 @@ env: PREFLIGHT_IMAGE: "quay.io/opdev/preflight:stable" PFLT_LOGLEVEL: "warn" PFLT_ARTIFACTS: "/tmp/artifacts" + IMAGE_DIR: "/tmp/images" jobs: init_build: @@ -200,28 +201,40 @@ jobs: - name: Image digest env: - IMAGE_TAG: ${{ fromJSON(steps.meta.outputs.json).tags[0] }} + IMAGE_TAG: ${{ steps.build_image.outputs.image-with-tag }} CACHE_FILE_NAME: ${{ env.BASE_BUILD_NAME }}_${{ matrix.arch }} - IMAGE_FULL: $${{ steps.build_image.outputs.image-with-tag }} run: | - echo "${IMAGE_FULL}" - DIGEST=$(podman inspect ${IMAGE_TAG} --format "{{.Id}}") + DIGEST=$(podman inspect "${IMAGE_TAG}" --format "{{ index .RepoDigests 0}}" | cut -d '@' -f2) + echo "::group::Image tag" + echo "image_tag=$IMAGE_TAG" + echo "::endgroup::" echo "::group::Image digest" - echo "$DIGEST" + echo "digest=$DIGEST" echo "::endgroup::" echo "::group::Cache file name" echo "$CACHE_FILE_NAME" echo "::endgroup::" - podman push ${IMAGE_TAG} dir:"/tmp/images/$DIGEST" - exit 1 - echo "$DIGEST" > "$CACHE_FILE_NAME" + + echo "$DIGEST" > "${CACHE_FILE_NAME}_digest" + echo "$IMAGE_TAG" > "${CACHE_FILE_NAME}_tag" - name: Cache image digest uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 with: - path: ${{ env.BASE_BUILD_NAME }}_${{ matrix.arch }} + path: | + ${{ env.BASE_BUILD_NAME }}_${{ matrix.arch }}_digest + ${{ env.BASE_BUILD_NAME }}_${{ matrix.arch }}_tag key: ${{ env.BASE_BUILD_NAME }}-${{ matrix.arch }}-${{ github.run_id }} + - name: Store image + env: + IMAGE_TAG: ${{ steps.build_image.outputs.image-with-tag }} + run: | + echo "::group::Result" + echo "podman push \"${IMAGE_TAG}\" dir:\"$IMAGE_DIR/$DIGEST\"" + podman push "${IMAGE_TAG}" dir:"$IMAGE_DIR/$DIGEST" + echo "::endgroup::" + build_base_database: timeout-minutes: 180 needs: [ "build_base", "init_build"] @@ -259,31 +272,47 @@ jobs: - name: Download SHA256 tag of ${{ env.BASE_BUILD_NAME }}:${{ matrix.arch }} uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 with: - path: ${{ env.BASE_BUILD_NAME }}_${{ matrix.arch }} + path: | + ${{ env.BASE_BUILD_NAME }}_${{ matrix.arch }}_digest + ${{ env.BASE_BUILD_NAME }}_${{ matrix.arch }}_tag key: ${{ env.BASE_BUILD_NAME }}-${{ matrix.arch }}-${{ github.run_id }} - - name: Retrieve ${{ env.BASE_BUILD_NAME }}:${{ matrix.arch }} SHA256 tag + - name: Retrieve ${{ env.BASE_BUILD_NAME }}:${{ matrix.arch }} info id: base_build env: MATRIX_ARCH: ${{ matrix.arch }} BASE_IMAGE: ${{ env.BASE_BUILD_NAME }} IMAGES_PREFIX: ${{ env.IMAGES_PREFIX }} run: | - BASE_TAG=$(cat "${BASE_IMAGE}_${MATRIX_ARCH}") - BUILD_BASE_IMAGE="${IMAGES_PREFIX}${BASE_IMAGE}:${BASE_TAG}" + BASE_TAG=$(cat "${BASE_IMAGE}_${MATRIX_ARCH}_digest") + BUILD_BASE_IMAGE="${IMAGES_PREFIX}${BASE_IMAGE}@${BASE_TAG}" echo "::group::Base build image information" echo "base_tag=${BASE_TAG}" echo "base_build_image=${BUILD_BASE_IMAGE}" echo "::endgroup::" - echo "podman pull \"dir:/tmp/images/${BASE_TAG}\"" - echo "podman tag ${BASE_TAG} ${BUILD_BASE_IMAGE}" - podman pull dir:"/tmp/images/${BASE_TAG}" - podman tag ${BASE_TAG} ${BUILD_BASE_IMAGE} echo "base_tag=${BASE_TAG}" >> $GITHUB_OUTPUT echo "base_build_image=${BUILD_BASE_IMAGE}" >> $GITHUB_OUTPUT + - name: Rull ${{ env.BASE_BUILD_NAME }}:${{ matrix.arch }} image + id: base_build + env: + MATRIX_ARCH: ${{ matrix.arch }} + BASE_IMAGE: ${{ env.BASE_BUILD_NAME }} + IMAGES_PREFIX: ${{ env.IMAGES_PREFIX }} + run: | + BASE_DIGEST=$(cat "${BASE_IMAGE}_${MATRIX_ARCH}_digest") + BASE_TAG=$(cat "${BASE_IMAGE}_${MATRIX_ARCH}_tag") + BUILD_BASE_IMAGE="${IMAGES_PREFIX}${BASE_IMAGE}:${BASE_TAG}" + + echo "::group::Pull image" + echo "podman pull dir:\"${IMAGE_DIR}/${BUILD_BASE_IMAGE}\"" + podman pull dir:"${IMAGE_DIR}/${BASE_TAG}" + echo "podman tag \"${BASE_TAG}\" \"${BUILD_BASE_IMAGE}\"" + podman tag "${BASE_TAG}" "${BUILD_BASE_IMAGE}" + echo "::endgroup::" + - name: Build Zabbix Build Base id: build_image uses: redhat-actions/buildah-build@b4dc19b4ba891854660ab1f88a097d45aa158f76 # v2.12