Backport of build(docker): always publish full and minor version tags for dev images into release/1.16.x (#19281)

Backport of build(docker): always publish full and minor version tags for dev images into release/1.17.x (#19282)

backport of commit c6bb4a534106c169d74c15119e2f220f79953ae2

Co-authored-by: DanStough <dan.stough@hashicorp.com>
This commit is contained in:
hc-github-team-consul-core 2023-10-18 17:07:27 -04:00 committed by GitHub
parent 4b304d4934
commit e61a635c67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 10 deletions

View File

@ -27,7 +27,9 @@ jobs:
pre-version: ${{ steps.set-product-version.outputs.prerelease-product-version }} pre-version: ${{ steps.set-product-version.outputs.prerelease-product-version }}
shared-ldflags: ${{ steps.shared-ldflags.outputs.shared-ldflags }} shared-ldflags: ${{ steps.shared-ldflags.outputs.shared-ldflags }}
steps: steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
# action-set-product-version implicitly sets fields like 'product-version' using version/VERSION
# https://github.com/hashicorp/actions-set-product-version
- name: set product version - name: set product version
id: set-product-version id: set-product-version
uses: hashicorp/actions-set-product-version@v1 uses: hashicorp/actions-set-product-version@v1
@ -35,7 +37,6 @@ jobs:
id: get-product-version id: get-product-version
run: | run: |
CONSUL_DATE=$(build-support/scripts/build-date.sh) CONSUL_DATE=$(build-support/scripts/build-date.sh)
## TODO: This assumes `make version` outputs 1.1.1+ent-prerel
echo "product-date=${CONSUL_DATE}" >> "$GITHUB_OUTPUT" echo "product-date=${CONSUL_DATE}" >> "$GITHUB_OUTPUT"
- name: Set shared -ldflags - name: Set shared -ldflags
@ -299,8 +300,10 @@ jobs:
# This naming convention will be used ONLY for per-commit dev images # This naming convention will be used ONLY for per-commit dev images
- name: Set docker dev tag - name: Set docker dev tag
run: | run: |
version="${{ env.version }}" echo "full_dev_tag=${{ env.version }}"
echo "dev_tag=${version%.*}-dev" >> $GITHUB_ENV echo "full_dev_tag=${{ env.version }}" >> $GITHUB_ENV
echo "minor_dev_tag=$(echo ${{ env.version }}| sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+(-[0-9a-zA-Z\+\.]+)?$/\1\2/')"
echo "minor_dev_tag=$(echo ${{ env.version }}| sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+(-[0-9a-zA-Z\+\.]+)?$/\1\2/')" >> $GITHUB_ENV
- name: Docker Build (Action) - name: Docker Build (Action)
uses: hashicorp/actions-docker-build@v1 uses: hashicorp/actions-docker-build@v1
@ -312,8 +315,10 @@ jobs:
docker.io/hashicorp/${{env.repo}}:${{env.version}} docker.io/hashicorp/${{env.repo}}:${{env.version}}
public.ecr.aws/hashicorp/${{env.repo}}:${{env.version}} public.ecr.aws/hashicorp/${{env.repo}}:${{env.version}}
dev_tags: | dev_tags: |
docker.io/hashicorppreview/${{ env.repo }}:${{ env.dev_tag }} docker.io/hashicorppreview/${{ env.repo }}:${{ env.full_dev_tag }}
docker.io/hashicorppreview/${{ env.repo }}:${{ env.dev_tag }}-${{ github.sha }} docker.io/hashicorppreview/${{ env.repo }}:${{ env.full_dev_tag }}-${{ github.sha }}
docker.io/hashicorppreview/${{ env.repo }}:${{ env.minor_dev_tag }}
docker.io/hashicorppreview/${{ env.repo }}:${{ env.minor_dev_tag }}-${{ github.sha }}
smoke_test: .github/scripts/verify_docker.sh v${{ env.version }} smoke_test: .github/scripts/verify_docker.sh v${{ env.version }}
build-docker-ubi-redhat: build-docker-ubi-redhat:
@ -353,8 +358,10 @@ jobs:
# This naming convention will be used ONLY for per-commit dev images # This naming convention will be used ONLY for per-commit dev images
- name: Set docker dev tag - name: Set docker dev tag
run: | run: |
version="${{ env.version }}" echo "full_dev_tag=${{ env.version }}"
echo "dev_tag=${version%.*}-dev" >> $GITHUB_ENV echo "full_dev_tag=${{ env.version }}" >> $GITHUB_ENV
echo "minor_dev_tag=$(echo ${{ env.version }}| sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+(-[0-9a-zA-Z\+\.]+)?$/\1\2/')"
echo "minor_dev_tag=$(echo ${{ env.version }}| sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+(-[0-9a-zA-Z\+\.]+)?$/\1\2/')" >> $GITHUB_ENV
- uses: hashicorp/actions-docker-build@v1 - uses: hashicorp/actions-docker-build@v1
with: with:
@ -365,8 +372,10 @@ jobs:
docker.io/hashicorp/${{env.repo}}:${{env.version}}-ubi docker.io/hashicorp/${{env.repo}}:${{env.version}}-ubi
public.ecr.aws/hashicorp/${{env.repo}}:${{env.version}}-ubi public.ecr.aws/hashicorp/${{env.repo}}:${{env.version}}-ubi
dev_tags: | dev_tags: |
docker.io/hashicorppreview/${{ env.repo }}:${{ env.dev_tag }}-ubi docker.io/hashicorppreview/${{ env.repo }}:${{ env.full_dev_tag }}-ubi
docker.io/hashicorppreview/${{ env.repo }}:${{ env.dev_tag }}-ubi-${{ github.sha }} docker.io/hashicorppreview/${{ env.repo }}:${{ env.full_dev_tag }}-ubi-${{ github.sha }}
docker.io/hashicorppreview/${{ env.repo }}:${{ env.minor_dev_tag }}-ubi
docker.io/hashicorppreview/${{ env.repo }}:${{ env.minor_dev_tag }}-ubi-${{ github.sha }}
smoke_test: .github/scripts/verify_docker.sh v${{ env.version }} smoke_test: .github/scripts/verify_docker.sh v${{ env.version }}
verify-linux: verify-linux: