dispatch-build #624
This file contains 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 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', 'el8', 'al8', 'cuda_11_8_0'] | |
osg_series: ['3.6'] | |
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 | |
steps: | |
- id: custom-image-name | |
env: | |
SERIES: ${{ matrix.osg_series }} | |
REPO: ${{ matrix.repo }} | |
OS: ${{ matrix.os }} | |
run: | | |
PREFIX="output_image=${GITHUB_REPOSITORY}:${SERIES}" | |
if [[ $OS == 'el8' ]]; then | |
echo "${PREFIX}-${REPO}" >> ${GITHUB_OUTPUT} | |
else | |
echo "${PREFIX}-${OS}-${REPO}" >> ${GITHUB_OUTPUT} | |
fi | |
- 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: | | |
sudo ./tests/test_inside_gha.sh singularity \ | |
bindmount \ | |
"$CONTAINER_IMAGE" | |
- 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}} | |
run: | | |
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} | |
done | |
done |