forked from mlrun/mlrun
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (72 loc) · 2.9 KB
/
periodic-rebuild.yaml
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
# Copyright 2023 Iguazio
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Scheduled Re-Build Images
on:
schedule:
# every night at 2am
- cron: "0 2 * * *"
jobs:
resolve-branch-to-rebuild:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-branch.outputs.matrix }}
steps:
- name: Resolve Branch to Re-Build
id: set-branch
run: |
# take mlrun branches, find branches that are in format of 9.9.x (where 9 could by any number)
# sort them - so latest version would be last
# take last 2 elements (aka last 2 versions)
# wrap each name with "" and join with ,
# join with development
branches=$(curl --retry 3 --retry-all-errors --silent https://api.github.com/repos/mlrun/mlrun/branches \
| jq -r 'map(select(.name | test("^\\d+.\\d+.x$"))) | sort_by(.name) | .[-2:] | map(.name | tostring | "\"" + . + "\"") | join(",")' \
)
# output would be like
# 1.3.x,1.4.x,development
branches="$branches,\"development\""
matrix="{\"repo\": [\"mlrun\",\"ui\"], \"branch\": [$branches]}"
echo "matrix=$(echo $matrix)" >> $GITHUB_OUTPUT
re-build-images:
if: github.repository == 'mlrun/mlrun'
needs: resolve-branch-to-rebuild
strategy:
fail-fast: false
matrix: ${{fromJson(needs.resolve-branch-to-rebuild.outputs.matrix)}}
runs-on: ubuntu-latest
steps:
# TODO: move to reuseable workflow once all branches have backported with the new workflow
- name: Re-Build MLRun Image
if: matrix.repo == 'mlrun'
uses: convictional/[email protected]
with:
owner: mlrun
repo: mlrun
github_token: ${{ secrets.RELEASE_GITHUB_ACCESS_TOKEN }}
workflow_file_name: build.yaml
ref: ${{ matrix.branch }}
wait_interval: 60
# models is removed on 1.5.x but still exists on 1.4.x and 1.3.x
client_payload: '{"skip_images": "models,tests", "build_from_cache": "false"}'
- name: Re-Build UI Image
if: matrix.repo == 'ui'
uses: convictional/[email protected]
with:
owner: mlrun
repo: ui
github_token: ${{ secrets.RELEASE_GITHUB_ACCESS_TOKEN }}
workflow_file_name: build.yaml
ref: ${{ matrix.branch }}
wait_interval: 60