Skip to content

Updates cloud-native-toolkit/image-cli-tools-core module to v1.7.0 #159

Updates cloud-native-toolkit/image-cli-tools-core module to v1.7.0

Updates cloud-native-toolkit/image-cli-tools-core module to v1.7.0 #159

Workflow file for this run

name: Docker build
# Controls when the workflow will run
on:
release:
types:
- published
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
base:
- cli-tools-core:v1.7.0
- cli-tools-ibmcloud:v0.4.23
- cli-tools:v2.2.19
version:
- v1.2
env:
TERRAFORM_LATEST: "v1.2"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Login to CNTK Quay
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_CNTK_USERNAME }}
password: ${{ secrets.QUAY_CNTK_TOKEN }}
- name: Setup variables ${{ matrix.base }}:${{ matrix.version }}
id: variables
shell: bash
run: |
SHORT_TERRAFORM=${{ matrix.version }}
BASE_NAME=$(echo "${{ matrix.base }}" | sed -E "s/(.*):(.*)/\1/g")
BASE_VERSION=$(echo "${{ matrix.base }}" | sed -E "s/(.*):(.*)/\2/g")
BASE_TAG="v1.2-${BASE_VERSION}-alpine"
MAIN_IMAGE="cli-tools-core"
SHORT_TAG_ENABLED="false"
if [[ "${BASE_NAME}" == "${MAIN_IMAGE}" ]]; then
SHORT_TAG_ENABLED="true"
fi
BASE_ENABLED="false"
LATEST_ENABLED="false"
if [[ "${SHORT_TERRAFORM}" == "${TERRAFORM_LATEST}" ]]; then
BASE_ENABLED="true"
if [[ "${BASE_NAME}" == "${MAIN_IMAGE}" ]]; then
LATEST_ENABLED="true"
fi
fi
RELEASE_TAG=${GITHUB_REF#refs/tags/}
RELEASE_TAG_ENABLED="false"
RELEASE_TAG_SHORT_ENABLED="false"
if [[ "${GITHUB_REF}" =~ refs/tags ]] && [[ "${RELEASE_TAG}" != "main" ]]; then
RELEASE_TAG_ENABLED="true"
if [[ "${BASE_NAME}" == "${MAIN_IMAGE}" ]]; then
RELEASE_TAG_SHORT_ENABLED="true"
fi
else
RELEASE_TAG="main"
fi
echo "Short terraform: ${SHORT_TERRAFORM}"
echo "::set-output name=terraform::$SHORT_TERRAFORM"
echo "Short tag enabled: $SHORT_TAG_ENABLED"
echo "::set-output name=short-enabled::$SHORT_TAG_ENABLED"
echo "Release tag: ${RELEASE_TAG}"
echo "::set-output name=release-tag::$RELEASE_TAG"
echo "Release tag enabled: $RELEASE_TAG_ENABLED"
echo "::set-output name=release-tag-enabled::$RELEASE_TAG_ENABLED"
echo "Release tag short enabled: $RELEASE_TAG_SHORT_ENABLED"
echo "::set-output name=release-tag-short-enabled::$RELEASE_TAG_SHORT_ENABLED"
echo "Base enabled: $BASE_ENABLED"
echo "::set-output name=base-enabled::$BASE_ENABLED"
echo "Latest enabled: $LATEST_ENABLED"
echo "::set-output name=latest-enabled::$LATEST_ENABLED"
echo "Base image: $BASE_NAME"
echo "::set-output name=base-image::$BASE_NAME"
echo "Base tag: $BASE_TAG"
echo "::set-output name=base-tag::$BASE_TAG"
- name: Docker CNTK meta ${{ matrix.base }}:${{ matrix.version }}
id: cntk-meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
quay.io/cloudnativetoolkit/web-terminal
# Docker tags based on the following events/attributes
tags: |
type=raw,value=${{ steps.variables.outputs.terraform }}-${{ steps.variables.outputs.base-image }}
type=raw,value=${{ steps.variables.outputs.terraform }},enable=${{ steps.variables.outputs.short-enabled }}
type=raw,value=${{ steps.variables.outputs.terraform }}-${{ steps.variables.outputs.release-tag }}-${{ steps.variables.outputs.base-image }},enable=${{ steps.variables.outputs.release-tag-enabled }}
type=raw,value=${{ steps.variables.outputs.terraform }}-${{ steps.variables.outputs.release-tag }},enable=${{ steps.variables.outputs.release-tag-short-enabled }}
type=raw,value=${{ steps.variables.outputs.base-image }},enable=${{ steps.variables.outputs.base-enabled }}
type=raw,value=latest,enable=${{ steps.variables.outputs.latest-enabled }}
- name: Build and push ${{ matrix.base }}:${{ matrix.version }}
uses: docker/build-push-action@v3
with:
context: .
file: Containerfile
build-args: |
IMAGE=quay.io/cloudnativetoolkit/${{ steps.variables.outputs.base-image }}:${{ steps.variables.outputs.base-tag }}
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64
tags: ${{ steps.cntk-meta.outputs.tags }}
labels: ${{ steps.cntk-meta.outputs.labels }}
verify:
needs: build
runs-on: ubuntu-latest
steps:
- name: Verify
run: |
echo "Success"