-
Notifications
You must be signed in to change notification settings - Fork 12
125 lines (109 loc) · 3.95 KB
/
workers_build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# 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
name: Build and Push Docker image for workers (release)
on:
push:
branches: [main ]
path:
- worker/fnal-wn-el9/Dockerfile
- worker/fnal-wn-el8/Dockerfile
- worker/fnal-wn-sl7/Dockerfile
- worker/fnal-wn-sl6/Dockerfile
repository_dispatch:
types:
- worker-build
env:
DH_LABEL: latest
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 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: add date tag
continue-on-error: true
if: ${{ github.event.client_payload.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@v5
with:
push: true
context: worker
file: worker/fnal-wn-sl6/Dockerfile
tags: fermilab/fnal-wn-sl6:${{env.DH_LABEL}}
- name: Build and push SL7
id: docker_build_el7
uses: docker/build-push-action@v5
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@v5
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@v5
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@v5
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@v5
with:
push: true
context: worker
file: worker/fnal-wn-sl6/Dockerfile
tags: glideinwms/fnal-wn-sl6:${{env.DH_LABEL}}