@@ -768,12 +768,44 @@ jobs:
|
768 | 768 | username: ${{ github.actor }} |
769 | 769 | password: ${{ github.token }} |
770 | 770 | |
771 | | - - name: Setup Docker builder |
| 771 | + - name: Check existing shared Docker E2E images |
| 772 | +id: image_exists |
772 | 773 | if: steps.plan.outputs.needs_e2e_image == '1' |
| 774 | +shell: bash |
| 775 | +run: | |
| 776 | + set -euo pipefail |
| 777 | + bare_exists=0 |
| 778 | + functional_exists=0 |
| 779 | + needs_build=0 |
| 780 | + |
| 781 | + if [[ "${{ steps.plan.outputs.needs_bare_image }}" == "1" ]]; then |
| 782 | + if docker manifest inspect "${{ steps.image.outputs.bare_image }}" >/dev/null 2>&1; then |
| 783 | + bare_exists=1 |
| 784 | + echo "Shared Docker E2E bare image already exists: ${{ steps.image.outputs.bare_image }}" |
| 785 | + else |
| 786 | + needs_build=1 |
| 787 | + fi |
| 788 | + fi |
| 789 | + |
| 790 | + if [[ "${{ steps.plan.outputs.needs_functional_image }}" == "1" ]]; then |
| 791 | + if docker manifest inspect "${{ steps.image.outputs.functional_image }}" >/dev/null 2>&1; then |
| 792 | + functional_exists=1 |
| 793 | + echo "Shared Docker E2E functional image already exists: ${{ steps.image.outputs.functional_image }}" |
| 794 | + else |
| 795 | + needs_build=1 |
| 796 | + fi |
| 797 | + fi |
| 798 | + |
| 799 | + echo "bare_exists=$bare_exists" >> "$GITHUB_OUTPUT" |
| 800 | + echo "functional_exists=$functional_exists" >> "$GITHUB_OUTPUT" |
| 801 | + echo "needs_build=$needs_build" >> "$GITHUB_OUTPUT" |
| 802 | + |
| 803 | + - name: Setup Docker builder |
| 804 | +if: steps.image_exists.outputs.needs_build == '1' |
773 | 805 | uses: useblacksmith/setup-docker-builder@ac083cc84672d01c60d5e8561d0a939b697de542 # v1 |
774 | 806 | |
775 | 807 | - name: Build and push bare Docker E2E image |
776 | | -if: steps.plan.outputs.needs_bare_image == '1' |
| 808 | +if: steps.plan.outputs.needs_bare_image == '1' && steps.image_exists.outputs.bare_exists != '1' |
777 | 809 | uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 |
778 | 810 | with: |
779 | 811 | context: . |
@@ -788,7 +820,7 @@ jobs:
|
788 | 820 | push: true |
789 | 821 | |
790 | 822 | - name: Build and push functional Docker E2E image |
791 | | -if: steps.plan.outputs.needs_functional_image == '1' |
| 823 | +if: steps.plan.outputs.needs_functional_image == '1' && steps.image_exists.outputs.functional_exists != '1' |
792 | 824 | uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 |
793 | 825 | with: |
794 | 826 | context: . |
|