[minor] multiarch #149
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build CLI Base | |
on: | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
- '**' | |
jobs: | |
build-cli-base-amd64: | |
runs-on: ubuntu-latest | |
steps: | |
# 1. Setup | |
# ------------------------------------------------------------------------------------------- | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Without this option, we don't get the tag information | |
with: | |
fetch-depth: 0 | |
- name: Initialise the build system | |
run: | | |
chmod u+x $GITHUB_WORKSPACE/build/bin/*.sh | |
$GITHUB_WORKSPACE/build/bin/initbuild.sh | |
source $GITHUB_WORKSPACE/build/bin/.functions.sh | |
# 2. Build and Publish CLI base container image for amd64 | |
# ------------------------------------------------------------------------------------------- | |
- name: Build the docker image | |
run: | | |
python3 -m pip install docker-squash | |
$GITHUB_WORKSPACE/build/bin/docker-build.sh -n ibmmas -i cli-base --target-platform amd64 | |
docker-squash --load-image --tag quay.io/ibmmas/cli-base:${{ env.DOCKER_TAG }}-amd64 ibmmas/cli-base:${{ env.DOCKER_TAG }}-amd64 | |
- name: Push the docker image | |
id: push_to_quay | |
run: | | |
docker images | |
docker login --username "${{ secrets.QUAYIO_USERNAME }}" --password "${{ secrets.QUAYIO_PASSWORD }}" quay.io | |
docker push quay.io/ibmmas/cli-base:${{ env.DOCKER_TAG }}-amd64 | |
build-cli-base-s390x: | |
runs-on: ubuntu-latest | |
steps: | |
# 1. Setup | |
# ------------------------------------------------------------------------------------------- | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Without this option, we don't get the tag information | |
with: | |
fetch-depth: 0 | |
- name: Initialise the build system | |
run: | | |
chmod u+x $GITHUB_WORKSPACE/build/bin/*.sh | |
$GITHUB_WORKSPACE/build/bin/initbuild.sh | |
source $GITHUB_WORKSPACE/build/bin/.functions.sh | |
# 2. Download Ansible collection from Artifactory | |
# ------------------------------------------------------------------------------------------- | |
- name: Download whl from Artifactory | |
id: download-whl | |
if: contains(fromJson('["push", "workflow_dispatch", "repository_dispatch"]'), github.event_name) | |
env: | |
CRYPTO_VERSION: 43.0.0-cp37-abi3-linux_s390x | |
WHEELS_URL: https://na.artifactory.swg-devops.com/artifactory/wiotp-generic-local/dependencies/wheels | |
ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }} | |
run: | | |
if [[ -e $GITHUB_WORKSPACE/image/cli-base/install/cryptography-$CRYPTO_VERSION.whl ]]; then | |
echo "Found a local cryptography-$CRYPTO_VERSION ! Skip download from Artifactory..." | |
else | |
echo "Downloading from artifactory/wiotp-generic-local/dependencies/wheels/s390x/cryptography-$CRYPTO_VERSION.whl" | |
wget --header="Authorization:Bearer $ARTIFACTORY_TOKEN" $WHEELS_URL/s390x/cryptography-$CRYPTO_VERSION.whl -O $GITHUB_WORKSPACE/image/cli-base/install/cryptography-$CRYPTO_VERSION.whl | |
fi | |
# 3. Build and Publish CLI base container image for s390x | |
# ------------------------------------------------------------ | |
- name: Build the docker image | |
run: | | |
python3 -m pip install docker-squash | |
$GITHUB_WORKSPACE/build/bin/docker-build.sh -n ibmmas -i cli-base --target-platform s390x | |
docker-squash --load-image --tag quay.io/ibmmas/cli-base:${{ env.DOCKER_TAG }}-s390x ibmmas/cli-base:${{ env.DOCKER_TAG }}-s390x | |
- name: Push the docker image | |
id: push_to_quay | |
run: | | |
docker images | |
docker login --username "${{ secrets.QUAYIO_USERNAME }}" --password "${{ secrets.QUAYIO_PASSWORD }}" quay.io | |
docker push quay.io/ibmmas/cli-base:${{ env.DOCKER_TAG }}-s390x | |
build-cli-manifest: | |
runs-on: ubuntu-latest | |
needs: [build-cli-base-amd64, build-cli-base-s390x] | |
steps: | |
# 1. Setup | |
# ------------------------------------------------------------------------------------------- | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Without this option, we don't get the tag information | |
with: | |
fetch-depth: 0 | |
- name: Initialise the build system | |
run: | | |
chmod u+x $GITHUB_WORKSPACE/build/bin/*.sh | |
$GITHUB_WORKSPACE/build/bin/initbuild.sh | |
source $GITHUB_WORKSPACE/build/bin/.functions.sh | |
# 3. Manifest and publish release base container image of cli | |
# ------------------------------------------------------------------------------------------- | |
- name: Publish release cli | |
run: | | |
docker login --username "${{ secrets.QUAYIO_USERNAME }}" --password "${{ secrets.QUAYIO_PASSWORD }}" quay.io | |
$GITHUB_WORKSPACE/build/bin/docker-manifest.sh -n ibmmas -i cli-base --target-platforms amd64,s390x |