mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-25 15:41:02 -05:00
adding some cleanup
This commit is contained in:
parent
7380bad950
commit
cd74d80762
3 changed files with 37 additions and 20 deletions
|
@ -38,9 +38,9 @@ CONTAINER_URL='' # Final URL to upload
|
|||
###########################################################
|
||||
# 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_REVISION=$(git rev-parse --short HEAD)# Current git commit EX> "e89faa7"
|
||||
BUILD_VERSION='' # Current version of the container being built
|
||||
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
|
||||
|
||||
#########################
|
||||
# Source Function Files #
|
||||
|
@ -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 #
|
||||
|
|
|
@ -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
|
||||
|
|
14
.github/workflows/deploy-DEV.yml
vendored
14
.github/workflows/deploy-DEV.yml
vendored
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue