adding some cleanup

This commit is contained in:
Lucas Gravley 2020-09-04 09:52:04 -05:00
parent 7380bad950
commit cd74d80762
3 changed files with 37 additions and 20 deletions

View file

@ -363,7 +363,7 @@ BuildImage() {
###################
# Build the image #
###################
docker build --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_VERSION=${BUILD_VERSION}" -t "${ADDITONAL_URL}:${IMAGE_VERSION}" -f "${DOCKERFILE_PATH}" . 2>&1
docker build --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=${BUILD_REVISION}" --build-arg "BUILD_VERSION=${BUILD_VERSION}" -t "${ADDITONAL_URL}:${IMAGE_VERSION}" -f "${DOCKERFILE_PATH}" . 2>&1
#######################
# Load the error code #
@ -388,7 +388,7 @@ BuildImage() {
###################
# Build the image #
###################
docker build --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_VERSION=${MAJOR_TAG}" -t "${ADDITONAL_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 "${ADDITONAL_URL}:${MAJOR_TAG}" -f "${DOCKERFILE_PATH}" . 2>&1
#######################
# Load the error code #

View file

@ -9,10 +9,11 @@
###########
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace
GITHUB_SHA="${GITHUB_SHA}" # Sha used to create this branch
BUILD_DATE="${BUILD_DATE}"
BUILD_REVISION="${GITHUB_SHA}"
BUILD_VERSION="${GITHUB_SHA}"
ERROR=0
BUILD_DATE="${BUILD_DATE}" # Date the container was built
BUILD_REVISION="${GITHUB_SHA}" # GitHub Sha
BUILD_VERSION="${GITHUB_SHA}" # Version of the container
ORG_REPO="github/super-linter" # Org/repo
ERROR=0 # Error count
#########################
# Source Function Files #
@ -33,17 +34,33 @@ Header() {
################################################################################
#### Function ValidateLabel ####################################################
ValidateLabel() {
LABEL=$(docker inspect --format "{{ index .Config.Labels \"$1\" }}" github/super-linter:"${GITHUB_SHA}")
if [[ ${LABEL} != "$2" ]]; then
error "Assert failed [$1 - '${LABEL}' != '$2']"
##############
# Grab input #
##############
CONTAINER_KEY="$1" # Example: org.opencontainers.image.created
CONTAINER_VALUE="$2" # Example: 1985-04-12T23:20:50.52Z
########################
# Get the docker label #
########################
LABEL=$(docker inspect --format "{{ index .Config.Labels \"${CONTAINER_KEY}\" }}" "${ORG_REPO}:${GITHUB_SHA}")
###################
# Check the value #
###################
if [[ ${LABEL} != "${CONTAINER_VALUE}" ]]; then
error "Assert failed [${CONTAINER_KEY} - '${LABEL}' != '${CONTAINER_VALUE}']"
ERROR=1
else
info "Assert passed [$1]"
info "Assert passed [${CONTAINER_KEY}]"
fi
}
################################################################################
#### Function Footer ###########################################################
Footer() {
#####################################
# Check if any errors were reported #
#####################################
if [[ ${ERROR} -gt 0 ]]; then
fatal "There were some failed assertions. See above"
else

View file

@ -56,6 +56,13 @@ jobs:
shell: bash
run: docker build --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=${GITHUB_SHA}" --build-arg "BUILD_VERSION=${GITHUB_SHA}" --no-cache -t github/super-linter:${GITHUB_SHA} .
########################################
# Validates the metadata docker labels #
########################################
- name: Run Docker label test cases
shell: bash
run: .automation/validate-docker-labels.sh
#####################################
# Run Linter against Test code base #
#####################################
@ -76,10 +83,3 @@ jobs:
- name: Run against all code base
shell: bash
run: docker run -e RUN_LOCAL=true -e OUTPUT_DETAILS=detailed -v ${GITHUB_WORKSPACE}:/tmp/lint github/super-linter:${GITHUB_SHA}
########################################
# Validates the metadata docker labels #
########################################
- name: Run Docker label test cases
shell: bash
run: .automation/validate-docker-labels.sh