diff --git a/.github/workflows/build-build-tools-image.yml b/.github/workflows/build-build-tools-image.yml index 82b065c524..9e7be76901 100644 --- a/.github/workflows/build-build-tools-image.yml +++ b/.github/workflows/build-build-tools-image.yml @@ -2,18 +2,13 @@ name: Build build-tools image on: workflow_call: - inputs: - image-tag: - description: "build-tools image tag" - required: true - type: string outputs: image-tag: description: "build-tools tag" - value: ${{ inputs.image-tag }} + value: ${{ jobs.check-image.outputs.tag }} image: description: "build-tools image" - value: neondatabase/build-tools:${{ inputs.image-tag }} + value: neondatabase/build-tools:${{ jobs.check-image.outputs.tag }} defaults: run: @@ -35,7 +30,36 @@ permissions: {} jobs: check-image: - uses: ./.github/workflows/check-build-tools-image.yml + runs-on: ubuntu-22.04 + outputs: + tag: ${{ steps.get-build-tools-tag.outputs.image-tag }} + found: ${{ steps.check-image.outputs.found }} + + steps: + - uses: actions/checkout@v4 + + - name: Get build-tools image tag for the current commit + id: get-build-tools-tag + env: + IMAGE_TAG: | + ${{ hashFiles('build-tools.Dockerfile', + '.github/workflows/build-build-tools-image.yml') }} + run: | + echo "image-tag=${IMAGE_TAG}" | tee -a $GITHUB_OUTPUT + + - name: Check if such tag found in the registry + id: check-image + env: + IMAGE_TAG: ${{ steps.get-build-tools-tag.outputs.image-tag }} + run: | + if docker manifest inspect neondatabase/build-tools:${IMAGE_TAG}; then + found=true + else + found=false + fi + + echo "found=${found}" | tee -a $GITHUB_OUTPUT + build-image: needs: [ check-image ] @@ -48,20 +72,7 @@ jobs: runs-on: ${{ fromJson(format('["self-hosted", "{0}"]', matrix.arch == 'arm64' && 'large-arm64' || 'large')) }} - env: - IMAGE_TAG: ${{ inputs.image-tag }} - steps: - - name: Check `input.tag` is correct - env: - INPUTS_IMAGE_TAG: ${{ inputs.image-tag }} - CHECK_IMAGE_TAG : ${{ needs.check-image.outputs.image-tag }} - run: | - if [ "${INPUTS_IMAGE_TAG}" != "${CHECK_IMAGE_TAG}" ]; then - echo "'inputs.image-tag' (${INPUTS_IMAGE_TAG}) does not match the tag of the latest build-tools image 'inputs.image-tag' (${CHECK_IMAGE_TAG})" - exit 1 - fi - - uses: actions/checkout@v4 - uses: neondatabase/dev-actions/set-docker-config-dir@6094485bf440001c94a94a3f9e221e81ff6b6193 @@ -92,10 +103,10 @@ jobs: cache-from: type=registry,ref=cache.neon.build/build-tools:cache-${{ matrix.debian-version }}-${{ matrix.arch }} cache-to: ${{ github.ref_name == 'main' && format('type=registry,ref=cache.neon.build/build-tools:cache-{0}-{1},mode=max', matrix.debian-version, matrix.arch) || '' }} tags: | - neondatabase/build-tools:${{ inputs.image-tag }}-${{ matrix.debian-version }}-${{ matrix.arch }} + neondatabase/build-tools:${{ needs.check-image.outputs.tag }}-${{ matrix.debian-version }}-${{ matrix.arch }} merge-images: - needs: [ build-image ] + needs: [ check-image, build-image ] runs-on: ubuntu-22.04 steps: @@ -107,7 +118,7 @@ jobs: - name: Create multi-arch image env: DEFAULT_DEBIAN_VERSION: bullseye - IMAGE_TAG: ${{ inputs.image-tag }} + IMAGE_TAG: ${{ needs.check-image.outputs.tag }} run: | for debian_version in bullseye bookworm; do tags=("-t" "neondatabase/build-tools:${IMAGE_TAG}-${debian_version}") diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index cc6f91d28e..89fd2d0d17 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -77,15 +77,9 @@ jobs: shell: bash id: build-tag - check-build-tools-image: - needs: [ check-permissions ] - uses: ./.github/workflows/check-build-tools-image.yml - build-build-tools-image: - needs: [ check-build-tools-image ] + needs: [ check-permissions ] uses: ./.github/workflows/build-build-tools-image.yml - with: - image-tag: ${{ needs.check-build-tools-image.outputs.image-tag }} secrets: inherit check-codestyle-python: diff --git a/.github/workflows/check-build-tools-image.yml b/.github/workflows/check-build-tools-image.yml deleted file mode 100644 index a7a15ad58b..0000000000 --- a/.github/workflows/check-build-tools-image.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Check build-tools image - -on: - workflow_call: - outputs: - image-tag: - description: "build-tools image tag" - value: ${{ jobs.check-image.outputs.tag }} - found: - description: "Whether the image is found in the registry" - value: ${{ jobs.check-image.outputs.found }} - -defaults: - run: - shell: bash -euo pipefail {0} - -# No permission for GITHUB_TOKEN by default; the **minimal required** set of permissions should be granted in each job. -permissions: {} - -jobs: - check-image: - runs-on: ubuntu-22.04 - outputs: - tag: ${{ steps.get-build-tools-tag.outputs.image-tag }} - found: ${{ steps.check-image.outputs.found }} - - steps: - - uses: actions/checkout@v4 - - - name: Get build-tools image tag for the current commit - id: get-build-tools-tag - env: - IMAGE_TAG: | - ${{ hashFiles('build-tools.Dockerfile', - '.github/workflows/check-build-tools-image.yml', - '.github/workflows/build-build-tools-image.yml') }} - run: | - echo "image-tag=${IMAGE_TAG}" | tee -a $GITHUB_OUTPUT - - - name: Check if such tag found in the registry - id: check-image - env: - IMAGE_TAG: ${{ steps.get-build-tools-tag.outputs.image-tag }} - run: | - if docker manifest inspect neondatabase/build-tools:${IMAGE_TAG}; then - found=true - else - found=false - fi - - echo "found=${found}" | tee -a $GITHUB_OUTPUT diff --git a/.github/workflows/neon_extra_builds.yml b/.github/workflows/neon_extra_builds.yml index cd5a665402..e827539c80 100644 --- a/.github/workflows/neon_extra_builds.yml +++ b/.github/workflows/neon_extra_builds.yml @@ -26,15 +26,9 @@ jobs: with: github-event-name: ${{ github.event_name}} - check-build-tools-image: - needs: [ check-permissions ] - uses: ./.github/workflows/check-build-tools-image.yml - build-build-tools-image: - needs: [ check-build-tools-image ] + needs: [ check-permissions ] uses: ./.github/workflows/build-build-tools-image.yml - with: - image-tag: ${{ needs.check-build-tools-image.outputs.image-tag }} secrets: inherit check-macos-build: diff --git a/.github/workflows/pg-clients.yml b/.github/workflows/pg-clients.yml index df40b5beda..4f5495cbe2 100644 --- a/.github/workflows/pg-clients.yml +++ b/.github/workflows/pg-clients.yml @@ -39,15 +39,9 @@ jobs: with: github-event-name: ${{ github.event_name }} - check-build-tools-image: - needs: [ check-permissions ] - uses: ./.github/workflows/check-build-tools-image.yml - build-build-tools-image: - needs: [ check-build-tools-image ] + needs: [ check-permissions ] uses: ./.github/workflows/build-build-tools-image.yml - with: - image-tag: ${{ needs.check-build-tools-image.outputs.image-tag }} secrets: inherit test-logical-replication: diff --git a/.github/workflows/pre-merge-checks.yml b/.github/workflows/pre-merge-checks.yml index 137faa7abc..e1cec6d33d 100644 --- a/.github/workflows/pre-merge-checks.yml +++ b/.github/workflows/pre-merge-checks.yml @@ -34,16 +34,10 @@ jobs: run: | echo "${PYTHON_CHANGED_FILES}" - check-build-tools-image: + build-build-tools-image: if: needs.get-changed-files.outputs.python-changed == 'true' needs: [ get-changed-files ] - uses: ./.github/workflows/check-build-tools-image.yml - - build-build-tools-image: - needs: [ check-build-tools-image ] uses: ./.github/workflows/build-build-tools-image.yml - with: - image-tag: ${{ needs.check-build-tools-image.outputs.image-tag }} secrets: inherit check-codestyle-python: diff --git a/.github/workflows/report-workflow-stats.yml b/.github/workflows/report-workflow-stats.yml index 0d135a257c..15e446bcd7 100644 --- a/.github/workflows/report-workflow-stats.yml +++ b/.github/workflows/report-workflow-stats.yml @@ -9,7 +9,6 @@ on: - Build and Test Locally - Build build-tools image - Check Permissions - - Check build-tools image - Check neon with extra platform builds - Cloud Regression Test - Create Release Branch