-
Notifications
You must be signed in to change notification settings - Fork 12
173 lines (153 loc) · 5.71 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# 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
# You can use also the gh cli:
# jq -n '{"event_type":"worker-build", "client_payload": {"label":"latest", "date_tag":true}}' | \
# gh api repos/glideinwms/containers/dispatches --input -
#
# 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
DBG_INFO: Start
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set debug info
id: set_debug
shell: bash
run: |
echo "DBG_INFO=${DBG_INFO}GH_REF${GITHUB_REF##*/},PdDate${{ github.event.client_payload.date_tag }},InDate${{ inputs.date_tag }}," >> $GITHUB_ENV
- 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 == true || inputs.date_tag == true }}
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}}