diff --git a/.automation/validate-docker-labels.sh b/.automation/validate-docker-labels.sh index 73672e44..aaac71d1 100755 --- a/.automation/validate-docker-labels.sh +++ b/.automation/validate-docker-labels.sh @@ -13,6 +13,7 @@ BUILD_DATE="${BUILD_DATE}" BUILD_REVISION="${GITHUB_SHA}" # GitHub Sha BUILD_VERSION="${GITHUB_SHA}" # Version of the container ORG_REPO="github/super-linter" # Org/repo +REGISTRY='ghcr.io' # Docker Registry ((LOG_TRACE = LOG_DEBUG = LOG_VERBOSE = LOG_NOTICE = LOG_WARN = LOG_ERROR = "true")) # Enable all loging ERROR=0 # Error count export LOG_TRACE LOG_DEBUG LOG_VERBOSE LOG_NOTICE LOG_WARN LOG_ERROR @@ -45,7 +46,7 @@ ValidateLabel() { ######################## # Get the docker label # ######################## - LABEL=$(docker inspect --format "{{ index .Config.Labels \"${CONTAINER_KEY}\" }}" "${ORG_REPO}:${GITHUB_SHA}") + LABEL=$(docker inspect --format "{{ index .Config.Labels \"${CONTAINER_KEY}\" }}" "${REGISTRY}/${ORG_REPO}:${GITHUB_SHA}") ################### # Check the value # diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index 8f7a9cfd..77dd0a28 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -53,8 +53,16 @@ jobs: # Build image locally for testing # ################################### - name: Build image - 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} . + uses: whoan/docker-build-with-cache-action@v5 + with: + username: ${{ secrets.GCR_USERNAME }} + password: ${{ secrets.GCR_TOKEN }} + registry: ghcr.io + image_name: github/super-linter + image_tag: ${{ github.sha }} + dockerfile: Dockerfile + build_extra_args: "--build-arg=BUILD_DATE=${{ env.BUILD_DATE }} --build-arg=BUILD_REVISION=${{ github.sha }} --build-arg=BUILD_VERSION=${{ github.sha }}" + push_image_and_stages: false ######################################## # Validates the metadata docker labels # @@ -68,7 +76,7 @@ jobs: ##################################### - name: Run Test Cases shell: bash - run: docker run -e RUN_LOCAL=true -e TEST_CASE_RUN=true -e OUTPUT_FORMAT=tap -e OUTPUT_FOLDER=${GITHUB_SHA} -e OUTPUT_DETAILS=detailed -e ACTIONS_RUNNER_DEBUG=true -e ERROR_ON_MISSING_EXEC_BIT=true -v ${GITHUB_WORKSPACE}:/tmp/lint github/super-linter:${GITHUB_SHA} + run: docker run -e RUN_LOCAL=true -e TEST_CASE_RUN=true -e OUTPUT_FORMAT=tap -e OUTPUT_FOLDER=${GITHUB_SHA} -e OUTPUT_DETAILS=detailed -e ACTIONS_RUNNER_DEBUG=true -e ERROR_ON_MISSING_EXEC_BIT=true -v ${GITHUB_WORKSPACE}:/tmp/lint ghcr.io/github/super-linter:${GITHUB_SHA} ######################################### # Clean code base to run against it all # @@ -82,4 +90,4 @@ jobs: ############################################ - name: Run against all code base shell: bash - run: docker run -e RUN_LOCAL=true -e OUTPUT_DETAILS=detailed -e ACTIONS_RUNNER_DEBUG=true -e ERROR_ON_MISSING_EXEC_BIT=true -v ${GITHUB_WORKSPACE}:/tmp/lint github/super-linter:${GITHUB_SHA} + run: docker run -e RUN_LOCAL=true -e OUTPUT_DETAILS=detailed -e ACTIONS_RUNNER_DEBUG=true -e ERROR_ON_MISSING_EXEC_BIT=true -v ${GITHUB_WORKSPACE}:/tmp/lint ghcr.io/github/super-linter:${GITHUB_SHA} diff --git a/.github/workflows/deploy-PROD.yml b/.github/workflows/deploy-PROD.yml index 9839a06e..9d2ee7ad 100644 --- a/.github/workflows/deploy-PROD.yml +++ b/.github/workflows/deploy-PROD.yml @@ -39,32 +39,37 @@ jobs: - name: Checkout Code uses: actions/checkout@v2.3.4 + ######################## + # Get the current date # + ######################## + - name: Get current date + run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> ${GITHUB_ENV} + ##################### # Run Deploy script # ##################### - name: Deploy latest image to DockerHub - env: - # Set the Env Vars - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - IMAGE_REPO: github/super-linter - IMAGE_VERSION: latest - DOCKERFILE_PATH: Dockerfile - REGISTRY: Docker - shell: bash - run: .automation/upload-docker.sh + uses: whoan/docker-build-with-cache-action@v5 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + image_name: github/super-linter + image_tag: "latest,v3" + dockerfile: Dockerfile + build_extra_args: "--build-arg=BUILD_DATE=${{ env.BUILD_DATE }} --build-arg=BUILD_REVISION=${{ github.sha }} --build-arg=BUILD_VERSION=${{ github.sha }}" + push_image_and_stages: true ############################# # Run Deploy script for GPR # ############################# - name: Deploy Latest image to GitHub Container Registry - env: - # Set the Env Vars - GCR_USERNAME: ${{ secrets.GCR_USERNAME }} - GCR_TOKEN: ${{ secrets.GCR_TOKEN }} - IMAGE_REPO: github/super-linter - IMAGE_VERSION: latest - DOCKERFILE_PATH: Dockerfile - REGISTRY: GCR - shell: bash - run: .automation/upload-docker.sh + uses: whoan/docker-build-with-cache-action@v5 + with: + username: ${{ secrets.GCR_USERNAME }} + password: ${{ secrets.GCR_TOKEN }} + registry: ghcr.io + image_name: github/super-linter + image_tag: "latest,v3" + dockerfile: Dockerfile + build_extra_args: "--build-arg=BUILD_DATE=${{ env.BUILD_DATE }} --build-arg=BUILD_REVISION=$${{ github.sha }} --build-arg=BUILD_VERSION=${{ github.sha }}" + push_image_and_stages: true diff --git a/.github/workflows/deploy-RELEASE.yml b/.github/workflows/deploy-RELEASE.yml index 62f114bb..c267e037 100644 --- a/.github/workflows/deploy-RELEASE.yml +++ b/.github/workflows/deploy-RELEASE.yml @@ -39,6 +39,12 @@ jobs: - name: Checkout Code uses: actions/checkout@v2.3.4 + ######################## + # Get the current date # + ######################## + - name: Get current date + run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> ${GITHUB_ENV} + ################################### # Run Deploy script for Dockerhub # ################################### @@ -50,7 +56,7 @@ jobs: image_name: github/super-linter image_tag: ${{ github.event.release.tag_name }} dockerfile: Dockerfile - build_extra_args: "--build-arg=BUILD_DATE=${BUILD_DATE} --build-arg=BUILD_REVISION=${GITHUB_SHA} --build-arg=BUILD_VERSION=${GITHUB_SHA}" + build_extra_args: "--build-arg=BUILD_DATE=${{ env.BUILD_DATE }} --build-arg=BUILD_REVISION=${{ github.sha }} --build-arg=BUILD_VERSION=${{ github.sha }}" push_image_and_stages: true ################################################### @@ -65,5 +71,5 @@ jobs: image_name: github/super-linter image_tag: ${{ github.event.release.tag_name }} dockerfile: Dockerfile - build_extra_args: "--build-arg=BUILD_DATE=${BUILD_DATE} --build-arg=BUILD_REVISION=${GITHUB_SHA} --build-arg=BUILD_VERSION=${GITHUB_SHA}" + build_extra_args: "--build-arg=BUILD_DATE=${{ github.event.timestamp }}Z --build-arg=BUILD_REVISION=${{ github.sha }} --build-arg=BUILD_VERSION=${{ github.sha }}" push_image_and_stages: true