Print version, date and revision

This commit is contained in:
Victor Martinez 2020-09-04 09:09:20 +01:00
parent e89faa7920
commit d3c992bec7
No known key found for this signature in database
GPG key ID: 4058B656AD58C4F5
3 changed files with 15 additions and 2 deletions

View file

@ -39,6 +39,7 @@ CONTAINER_URL='' # Final URL to upload
# Dynamic build variables to pass to container when built # # Dynamic build variables to pass to container when built #
########################################################### ###########################################################
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') # Current build date EX> "2017-08-28T09:24:41Z" BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') # Current build date EX> "2017-08-28T09:24:41Z"
BUILD_REVISION=$(git rev-parse --short HEAD)# Current git commit EX> "e89faa7"
BUILD_VERSION='' # Current version of the container being built BUILD_VERSION='' # Current version of the container being built
######################### #########################
@ -303,7 +304,7 @@ BuildImage() {
################### ###################
# Build the image # # Build the image #
################### ###################
docker build --no-cache --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_VERSION=${BUILD_VERSION}" -t "${CONTAINER_URL}:${IMAGE_VERSION}" -f "${DOCKERFILE_PATH}" . 2>&1 docker build --no-cache --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=${BUILD_REVISION}" --build-arg "BUILD_VERSION=${BUILD_VERSION}" -t "${CONTAINER_URL}:${IMAGE_VERSION}" -f "${DOCKERFILE_PATH}" . 2>&1
####################### #######################
# Load the error code # # Load the error code #
@ -326,7 +327,7 @@ BuildImage() {
######################################################## ########################################################
if [ ${UPDATE_MAJOR_TAG} -eq 1 ]; then if [ ${UPDATE_MAJOR_TAG} -eq 1 ]; then
# Tag the image with the major tag as well # Tag the image with the major tag as well
docker build --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_VERSION=${MAJOR_TAG}" -t "${CONTAINER_URL}:${MAJOR_TAG}" -f "${DOCKERFILE_PATH}" . 2>&1 docker build --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=${BUILD_REVISION}" --build-arg "BUILD_VERSION=${MAJOR_TAG}" -t "${CONTAINER_URL}:${MAJOR_TAG}" -f "${DOCKERFILE_PATH}" . 2>&1
####################### #######################
# Load the error code # # Load the error code #

View file

@ -28,6 +28,7 @@ FROM python:alpine
# Get the build arguements # # Get the build arguements #
############################ ############################
ARG BUILD_DATE ARG BUILD_DATE
ARG BUILD_REVISION
ARG BUILD_VERSION ARG BUILD_VERSION
######################################### #########################################
@ -39,6 +40,7 @@ LABEL com.github.actions.name="GitHub Super-Linter" \
com.github.actions.color="red" \ com.github.actions.color="red" \
maintainer="GitHub DevOps <github_devops@github.com>" \ maintainer="GitHub DevOps <github_devops@github.com>" \
org.opencontainers.image.created=$BUILD_DATE \ org.opencontainers.image.created=$BUILD_DATE \
org.opencontainers.image.revision=$BUILD_REVISION \
org.opencontainers.image.version=$BUILD_VERSION \ org.opencontainers.image.version=$BUILD_VERSION \
org.opencontainers.image.authors="GitHub DevOps <github_devops@github.com>" \ org.opencontainers.image.authors="GitHub DevOps <github_devops@github.com>" \
org.opencontainers.image.url="https://github.com/github/super-linter" \ org.opencontainers.image.url="https://github.com/github/super-linter" \
@ -46,6 +48,13 @@ LABEL com.github.actions.name="GitHub Super-Linter" \
org.opencontainers.image.vendor="GitHub" \ org.opencontainers.image.vendor="GitHub" \
org.opencontainers.image.description="Lint your code base with GitHub Actions" org.opencontainers.image.description="Lint your code base with GitHub Actions"
#################################################
# Set ENV values used for debugging the version #
#################################################
ENV BUILD_DATE=$BUILD_DATE
ENV BUILD_REVISION=$BUILD_REVISION
ENV BUILD_VERSION=$BUILD_VERSION
################################ ################################
# Set ARG values used in Build # # Set ARG values used in Build #
################################ ################################

View file

@ -437,6 +437,9 @@ Header() {
########## ##########
info "---------------------------------------------" info "---------------------------------------------"
info "--- GitHub Actions Multi Language Linter ----" info "--- GitHub Actions Multi Language Linter ----"
info " created date: ${BUILD_DATE}"
info " revision: ${BUILD_REVISION}"
info " version: ${BUILD_VERSION}"
info "---------------------------------------------" info "---------------------------------------------"
info "---------------------------------------------" info "---------------------------------------------"
info "The Super-Linter source code can be found at:" info "The Super-Linter source code can be found at:"