From 9135eda91b250a1b003bac7da31229684d9e174c Mon Sep 17 00:00:00 2001 From: Vishal Thapar <5137689+vthapar@users.noreply.github.com> Date: Tue, 1 Aug 2023 17:35:59 +0530 Subject: [PATCH] Add version to nettest image Adds a `version` file to nettest image which can help determine version in-use for submariner-metrics-proxy pods Refer https://github.com/submariner-io/enhancements/pull/204 Fixes #1327 Signed-off-by: Vishal Thapar <5137689+vthapar@users.noreply.github.com> --- package/Dockerfile.nettest | 4 ++++ scripts/shared/build_image.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package/Dockerfile.nettest b/package/Dockerfile.nettest index 0d884e582..eedb72048 100644 --- a/package/Dockerfile.nettest +++ b/package/Dockerfile.nettest @@ -16,6 +16,8 @@ FROM alpine WORKDIR /app +ARG VERSION + RUN apk add --no-cache \ bash \ bind-tools \ @@ -27,4 +29,6 @@ RUN apk add --no-cache \ COPY --from=0 /usr/local/bin/net* /usr/local/bin/ COPY scripts/nettest/* /app/ +RUN echo ${VERSION} >> /app/version + CMD ["/bin/bash","-l"] diff --git a/scripts/shared/build_image.sh b/scripts/shared/build_image.sh index 8755caaaa..d545e1a12 100755 --- a/scripts/shared/build_image.sh +++ b/scripts/shared/build_image.sh @@ -55,7 +55,7 @@ fi [[ -n "$PLATFORM" ]] || PLATFORM="$default_platform" # Rebuild the image to update any changed layers and tag it back so it will be used. -buildargs_flags=(--build-arg BUILDKIT_INLINE_CACHE=1 --build-arg "BASE_BRANCH=${BASE_BRANCH}") +buildargs_flags=(--build-arg BUILDKIT_INLINE_CACHE=1 --build-arg "BASE_BRANCH=${BASE_BRANCH}" --build-arg "VERSION=${VERSION}") if [[ "${PLATFORM}" != "${default_platform}" ]] && docker buildx version > /dev/null 2>&1; then docker buildx use buildx_builder || docker buildx create --name buildx_builder --use docker buildx build "${output_flag}" -t "${local_image}" "${cache_flags[@]}" -f "${dockerfile}" --iidfile "${hashfile}" --platform "${PLATFORM}" "${buildargs_flags[@]}" .