-
Notifications
You must be signed in to change notification settings - Fork 0
194 lines (175 loc) · 6.55 KB
/
seqera-showcase-production.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: seqera-showcase-autotest-production
run-name: run-pipelines
# Triggers workflow runs on demand, with schedule, or on push.
# workflow_dispatch: Manually trigger workflow from Actions tab.
# dryrun: Whether to do a dry run without submitting pipeline.
# timer: Delay before starting run.
# slack: Notify Slack on run completion.
# remove/force: Cleanup run after completion.
# schedule: Cron schedule to trigger runs automatically.
on:
workflow_dispatch:
inputs:
dryrun:
description: "Dryrun (do not submit pipeline)"
default: false
type: boolean
required: false
timer:
description: "Environment"
default: delay60mins
type: choice
options:
- noDelay
- delay1mins
- delay5mins
- delay15mins
- delay30mins
- delay60mins
- delay120mins
- delay360mins
- delay720mins
- waitForReviewer
slack:
description: Slack hook
type: boolean
required: false
default: true
remove:
description: Delete run
default: true
type: boolean
required: false
force:
description: Force delete run
default: false
type: boolean
required: false
pre_run:
description: Pre-run command
default: ""
type: string
required: false
config:
description: Nextflow config to add
default: ""
type: string
required: false
launch_container:
description: Nextflow launch container
default: ""
type: string
required: false
labels:
description: Labels to add to the pipeline
default: ""
type: string
required: false
disable_optimization:
description: Disable optimizations
default: false
type: boolean
required: false
schedule:
# Every 2am
- cron: "0 2 * * *"
env:
TOWER_API_ENDPOINT: "https://api.cloud.seqera.io"
# This workflow launches pipelines in Tower, waits for completion,
# extracts metadata, and optionally sends Slack notifications.
# The 'launch' job runs the launch_pipelines.py script to start the
# pipelines. It uploads the Tower launch data as an artifact.
# The 'clearup-and-delete' job downloads the artifact, runs
# extract_metadata.py to collect metadata, sends Slack notifications
# if configured, and deletes the workflow run if configured.
jobs:
launch:
runs-on: ubuntu-latest
env:
TOWER_ACCESS_TOKEN: ${{ secrets.TOWER_ACCESS_TOKEN }}
PRE_RUN: ${{ github.event_name != 'workflow_dispatch' && 'true' || inputs.pre_run }}
steps:
- uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: install dependencies
run: |
pip install -r requirements.txt
- name: install tw cli
run: |
set -euo pipefail
wget -L https://github.com/seqeralabs/tower-cli/releases/download/v0.10.1/tw-linux-x86_64
mv tw-* tw
chmod +x tw
sudo mv tw /usr/local/bin/
- name: tower check
run: |
tw --version
- name: launch_pipelines
run: |
python launch_pipelines.py \
-l DEBUG \
-i \
pipelines/production*.yaml \
compute-envs/production*.yaml \
include/*.yaml \
exclude/* \
${{ (github.event_name == 'workflow_dispatch' && inputs.pre_run != '') && format('--pre_run "{0}"', inputs.pre_run) || ''}} \
${{ (github.event_name == 'workflow_dispatch' && inputs.config != '') && format('--config "{0}"', inputs.config) || '' }} \
${{ (github.event_name == 'workflow_dispatch' && inputs.launch_container) && format('--launch-container "{0}"', inputs.launch_container) || '' }} \
${{ (github.event_name == 'workflow_dispatch' && inputs.labels != '') && format('--labels "{0}"', inputs.labels) || '--labels "automation"' }} \
${{ (github.event_name == 'workflow_dispatch' && inputs.dryrun == 'true') && '--dryrun' || '' }} \
${{ (github.event_name == 'workflow_dispatch' && inputs.disable_optimization == 'false') && '' || '--disable-optimization' }} \
-o ${{ github.run_id }}_${{ github.run_number }}_${{ github.run_attempt }}.json
- uses: actions/upload-artifact@v4
with:
name: ${{ github.run_id }}_${{ github.run_number }}_${{ github.run_attempt }}_launch_json
path: ${{ github.run_id }}_${{ github.run_number }}_${{ github.run_attempt }}.json
clearup-and-delete:
runs-on: ubuntu-latest
needs: [launch]
environment: ${{ inputs.timer || 'delay60mins' }}
env:
TOWER_ACCESS_TOKEN: ${{ secrets.TOWER_ACCESS_TOKEN }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ${{ github.run_id }}_${{ github.run_number }}_${{ github.run_attempt }}_launch_json
path: run_details
- name: Install tw CLI
run: |
set -euo pipefail
wget -L https://github.com/seqeralabs/tower-cli/releases/download/v0.9.2/tw-linux-x86_64
mv tw-* tw
chmod +x tw
sudo mv tw /usr/local/bin/
- name: tower check
run: |
tw --version
- name: setup python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: install dependencies
run: |
pip install -r requirements.txt
- name: finish workflow
run: |
python extract_metadata.py \
-l DEBUG \
-o ${{ github.run_id }}_${{ github.run_number }}_${{ github.run_attempt }}_workflow_data.json \
-i run_details/* \
--slack_channel ${{ secrets.SLACK_CHANNEL }} \
${{ ( github.event_name != 'workflow_dispatch' || inputs.slack == 'true' ) && '--slack' || '' }} \
${{ ( github.event_name != 'workflow_dispatch' || inputs.remove == 'true' ) && '--delete' || '' }} \
${{ ( github.event_name != 'workflow_dispatch' || inputs.force == 'true' ) && '--force' || '' }}
- uses: actions/upload-artifact@v4
with:
name: ${{ github.run_id }}_${{ github.run_number }}_${{ github.run_attempt }}_workflow_data
path: ${{ github.run_id }}_${{ github.run_number }}_${{ github.run_attempt }}_workflow_data.json