set PRODUCT_VERSION for docker build (#14242)

Changes proposed in this PR:

In `actions-docker-build` we [pass](05c370a26e/scripts/docker_build (L49)) `PRODUCT_VERSION` to the docker build command. Since this was not set, the label did not populate properly which is used in a comparison to determine the `minor-latest` and `latest` docker image tags. 

How I've tested this PR:
 - build the image up to the point of label creation and pass in `--build-arg PRODUCT_VERSION=1.2.3`
 - inspect the image for the label with the above command

How I expect reviewers to test this PR:
- same as above

Related [internal-only] post about this: https://hashicorp.atlassian.net/wiki/spaces/RELENG/pages/2416934922/August+17+2022-+Docker+Build+Failures
This commit is contained in:
Michele Degges 2022-08-17 14:48:43 -07:00 committed by GitHub
parent f92883bbce
commit 925eaf31fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -110,13 +110,13 @@ CMD ["agent", "-dev", "-client", "0.0.0.0"]
# Remember, this image cannot be built locally. # Remember, this image cannot be built locally.
FROM docker.mirror.hashicorp.services/alpine:3.15 as default FROM docker.mirror.hashicorp.services/alpine:3.15 as default
ARG VERSION ARG PRODUCT_VERSION
ARG BIN_NAME ARG BIN_NAME
# PRODUCT_NAME and PRODUCT_VERSION are the name of the software on releases.hashicorp.com # PRODUCT_NAME and PRODUCT_VERSION are the name of the software on releases.hashicorp.com
# and the version to download. Example: PRODUCT_NAME=consul PRODUCT_VERSION=1.2.3. # and the version to download. Example: PRODUCT_NAME=consul PRODUCT_VERSION=1.2.3.
ENV BIN_NAME=$BIN_NAME ENV BIN_NAME=$BIN_NAME
ENV VERSION=$VERSION ENV VERSION=$PRODUCT_VERSION
ARG PRODUCT_REVISION ARG PRODUCT_REVISION
ARG PRODUCT_NAME=$BIN_NAME ARG PRODUCT_NAME=$BIN_NAME
@ -128,7 +128,7 @@ LABEL org.opencontainers.image.authors="Consul Team <consul@hashicorp.com>" \
org.opencontainers.image.url="https://www.consul.io/" \ org.opencontainers.image.url="https://www.consul.io/" \
org.opencontainers.image.documentation="https://www.consul.io/docs" \ org.opencontainers.image.documentation="https://www.consul.io/docs" \
org.opencontainers.image.source="https://github.com/hashicorp/consul" \ org.opencontainers.image.source="https://github.com/hashicorp/consul" \
org.opencontainers.image.version=$VERSION \ org.opencontainers.image.version=${PRODUCT_VERSION} \
org.opencontainers.image.vendor="HashiCorp" \ org.opencontainers.image.vendor="HashiCorp" \
org.opencontainers.image.title="consul" \ org.opencontainers.image.title="consul" \
org.opencontainers.image.description="Consul is a datacenter runtime that provides service discovery, configuration, and orchestration." org.opencontainers.image.description="Consul is a datacenter runtime that provides service discovery, configuration, and orchestration."
@ -217,7 +217,7 @@ LABEL org.opencontainers.image.authors="Consul Team <consul@hashicorp.com>" \
org.opencontainers.image.url="https://www.consul.io/" \ org.opencontainers.image.url="https://www.consul.io/" \
org.opencontainers.image.documentation="https://www.consul.io/docs" \ org.opencontainers.image.documentation="https://www.consul.io/docs" \
org.opencontainers.image.source="https://github.com/hashicorp/consul" \ org.opencontainers.image.source="https://github.com/hashicorp/consul" \
org.opencontainers.image.version=$VERSION \ org.opencontainers.image.version=${PRODUCT_VERSION} \
org.opencontainers.image.vendor="HashiCorp" \ org.opencontainers.image.vendor="HashiCorp" \
org.opencontainers.image.title="consul" \ org.opencontainers.image.title="consul" \
org.opencontainers.image.description="Consul is a datacenter runtime that provides service discovery, configuration, and orchestration." org.opencontainers.image.description="Consul is a datacenter runtime that provides service discovery, configuration, and orchestration."
@ -284,4 +284,4 @@ USER 100
# By default you'll get an insecure single-node development server that stores # By default you'll get an insecure single-node development server that stores
# everything in RAM, exposes a web UI and HTTP endpoints, and bootstraps itself. # everything in RAM, exposes a web UI and HTTP endpoints, and bootstraps itself.
# Don't use this configuration for production. # Don't use this configuration for production.
CMD ["agent", "-dev", "-client", "0.0.0.0"] CMD ["agent", "-dev", "-client", "0.0.0.0"]