Skip to content

dispatch-build

dispatch-build #714

name: Build and test container images
on:
push:
pull_request:
repository_dispatch:
types:
- dispatch-build
workflow_dispatch:
jobs:
build-images:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: ['el9', 'al8', 'cuda_11_8_0']
osg_series: ['3.6', '23']
repo: ['development', 'testing', 'release']
exclude:
# cuda builds take a super long time; only do one of them
- os: cuda_11_8_0
repo: development
- os: cuda_11_8_0
repo: testing
# OSG 23 should default to EL9
- os: 'al8'
osg_series: '23'
# FIXME: disable OSG 23 dev until we have fixed the mash
# cache + signed RPMs issue in the prod repo
- osg_series: '23'
repo: 'development'
steps:
- id: custom-image-name
env:
SERIES: ${{ matrix.osg_series }}
REPO: ${{ matrix.repo }}
OS: ${{ matrix.os }}
run: |
PREFIX="output_image=${GITHUB_REPOSITORY}:${SERIES}"
echo "${PREFIX}-${OS}-${REPO}" >> ${GITHUB_OUTPUT}
- id: build-image
uses: opensciencegrid/build-container-action@v0.6.0
with:
osg_series: ${{ matrix.osg_series }}
osg_repo: ${{ matrix.repo }}
base_os: ${{ matrix.os }}
output_image: ${{ steps.custom-image-name.outputs.output_image }}
- name: Prepare CVMFS
run: |
sudo ./tests/setup_cvmfs.sh
- name: Docker + CVMFS bindmount
id: test-docker-cvmfs
env:
CONTAINER_IMAGE: ${{ steps.build-image.outputs.timestamp-image }}
run: |
sudo ./tests/test_inside_gha.sh docker \
bindmount \
"$CONTAINER_IMAGE"
- name: Docker + cvmfsexec
id: test-docker-cvmfsexec
env:
CONTAINER_IMAGE: ${{ steps.build-image.outputs.timestamp-image }}
run: |
sudo ./tests/test_inside_gha.sh docker \
cvmfsexec \
"$CONTAINER_IMAGE"
- name: Singularity + CVMFS bindmount
id: test-singularity-cvmfs
env:
CONTAINER_IMAGE: ${{ steps.build-image.outputs.timestamp-image }}
run: |
if [[ $CONTAINER_IMAGE == *cuda* ]]; then
echo >&2 "Skipping test: \$APPTAINER_TMPDIR (${APPTAINER_TMPDIR:-/tmp}) too small for cuda-based images"
exit 0
else
sudo ./tests/test_inside_gha.sh singularity \
bindmount \
"$CONTAINER_IMAGE"
fi
- name: Harbor login
if: >-
github.ref == 'refs/heads/master' &&
github.event_name != 'pull_request' &&
github.repository_owner == 'opensciencegrid'
uses: docker/login-action@v2
with:
registry: hub.opensciencegrid.org
username: ${{ secrets.OSG_HARBOR_ROBOT_USER }}
password: ${{ secrets.OSG_HARBOR_ROBOT_PASSWORD }}
- name: Docker login
if: >-
github.ref == 'refs/heads/master' &&
github.event_name != 'pull_request' &&
github.repository_owner == 'opensciencegrid'
uses: docker/login-action@v2
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to OSG Harbor
if: >-
github.ref == 'refs/heads/master' &&
github.event_name != 'pull_request' &&
github.repository_owner == 'opensciencegrid'
env:
IMAGE_LIST: ${{ steps.build-image.outputs.image-list}}
OSG_SERIES: ${{ matrix.osg_series }}
run: |
case $OSG_SERIES in
'3.6') DEFAULT_OS=al8 ;;
'23' ) DEFAULT_OS=el9 ;;
* ) exit ;;
esac
for registry in hub.opensciencegrid.org docker.io; do
IFS=,
for image in ${IMAGE_LIST}; do
fqin=${registry}/${image}
docker tag ${image} ${fqin}
docker push ${fqin}
# Also tag the image for the default OS as the OS-less tag
# (i.e. 3.6-al8-release -> 3.6-release)
image2=${image/-${DEFAULT_OS}-/-} # bash syntax for search-and-replace
if [[ $image2 != $image ]]; then
fqin2=${registry}/${image2}
docker tag ${image} ${fqin2}
docker push ${fqin2}
fi
done
done