Install perl-autodie #104
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
# SPDX-FileCopyrightText: 2020 Fermi Research Alliance, LLC | |
# SPDX-License-Identifier: Apache-2.0 | |
# This workflow can be triggered w/ a dispatch event, e.g.: | |
# curl -X POST -H "Authorization: token $(cat ../token_file)" \ | |
# -H "Content-Type: application/json" -H "Accept: application/vnd.github.v3+json" \ | |
# https://api.github.com/repos/glideinwms/containers/dispatches \ | |
# -d '{"event_type":"worker-build", "client_payload": {"label":"latest", "date_tag":true}}' | |
# A valid GitHub token must be saved in the file (so that is presented in the authorization) | |
# otherwise a misleading "Not Found" message is returned. No reply is provided for successful posts. | |
# The client_payload label and date_tag are optional | |
# label is used as Docker Hub label instead of "latest" | |
# if date_tag id true a date tag is added to the Docker Hub label (+%Y%m%d-%H%M) | |
# -X POST is also optional | |
# | |
# This workflow builds FNAL worker nodes images each time there is a change in the main branch | |
# and by default tags them as ":devel", the unstable/testing images. To trigger a build tagged | |
# as ":latest", the stable image series, you can use a dispatch (see above) with | |
# -d '{"event_type":"worker-build", "client_payload": {"label":"latest", "date_tag":false}}' | |
# or you can push a tag with a name starting with "latest", e.g. git tag latest.240510 | |
name: Build and Push Docker image for workers (release) | |
on: | |
push: | |
branches: [main] | |
tags: [latest*] | |
paths: ['worker/**'] | |
workflow_dispatch: | |
inputs: | |
date_tag: | |
description: 'True to add the date to the image tag' | |
required: true | |
default: false | |
type: boolean | |
label: | |
description: 'Label to use as image tag' | |
required: false | |
type: string | |
repository_dispatch: | |
types: | |
- worker-build | |
env: | |
DH_LABEL: devel | |
OSG_VERSION: NO | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set label branch | |
id: setlabel_branch | |
shell: bash | |
run: | | |
if [[ ${GITHUB_REF##*/} = osg* ]]; then | |
echo "DH_LABEL=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
echo "OSG_VERISON=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
fi | |
- name: set label tag latest | |
id: setlabel_tag_latest | |
shell: bash | |
run: | | |
if [[ ${GITHUB_REF##*/} = latest* ]]; then | |
echo "DH_LABEL=latest" >> $GITHUB_ENV | |
fi | |
- name: set label from parameter | |
id: setlabel_parameter | |
continue-on-error: true | |
if: ${{ github.event.client_payload.label }} | |
run: | | |
echo "DH_LABEL=${{ github.event.client_payload.label }}" >> $GITHUB_ENV | |
- name: set label from inputs | |
id: setlabel_inputs | |
continue-on-error: true | |
if: ${{ inputs.label }} | |
run: | | |
echo "DH_LABEL=${{ inputs.label }}" >> $GITHUB_ENV | |
- name: add date tag | |
continue-on-error: true | |
if: ${{ github.event.client_payload.date_tag }} || ${{ inputs.date_tag }} | |
run: | | |
echo "DH_LABEL=$DH_LABEL-$(date +%Y%m%d-%H%M)" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push SL6 | |
id: docker_build_sl6 | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
context: worker | |
file: worker/fnal-wn-sl6/Dockerfile | |
tags: fermilab/fnal-wn-sl6:${{env.DH_LABEL}} | |
- name: Build and push SL7 base | |
id: docker_build_el7_base | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
context: worker | |
file: worker/base-sl7/Dockerfile | |
tags: fermilab/base-sl7:${{env.DH_LABEL}} | |
- name: Build and push SL7 | |
id: docker_build_el7 | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
context: worker | |
file: worker/fnal-wn-sl7/Dockerfile | |
tags: fermilab/fnal-wn-sl7:${{env.DH_LABEL}} | |
- name: Build and push SL7 dev | |
id: docker_build_el7_dev | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
context: worker | |
file: worker/fnal-dev-sl7/Dockerfile | |
tags: fermilab/fnal-dev-sl7:${{env.DH_LABEL}} | |
- name: Build and push EL8 | |
id: docker_build_el8 | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
context: worker | |
file: worker/fnal-wn-el8/Dockerfile | |
tags: fermilab/fnal-wn-el8:${{env.DH_LABEL}} | |
- name: Build and push EL9 | |
id: docker_build_el9 | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
context: worker | |
file: worker/fnal-wn-el9/Dockerfile | |
tags: fermilab/fnal-wn-el9:${{env.DH_LABEL}} | |
- name: Build and push SL6 OSG 3.5 | |
id: docker_build_sl6_osg35 | |
continue-on-error: true | |
if: ${{ env.OSG_VERISON }} == 'osg35' | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
context: worker | |
file: worker/fnal-wn-sl6/Dockerfile | |
tags: glideinwms/fnal-wn-sl6:${{env.DH_LABEL}} |