forked from ibuildthecloud/os2
-
Notifications
You must be signed in to change notification settings - Fork 19
144 lines (134 loc) · 5 KB
/
installer-pr.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
on:
push:
tags:
- v*
env:
IMAGE_NAME: rancher/harvester-os:${{ github.ref_name }}
jobs:
generate-image-diff:
runs-on: ubuntu-latest
container:
image: registry.suse.com/bci/bci-base:15.4
steps:
- uses: jungwinter/split@v2
id: spliter
with:
msg: ${{ github.ref_name }}
separator: '-'
- name: Install docker
run: zypper ref && zypper -n install docker
- name: Pull new image
uses: nick-fields/retry@v2
with:
timeout_minutes: 1
max_attempts: 10
retry_wait_seconds: 60
command: 'docker pull ${{ env.IMAGE_NAME }}'
- name: Install container-diff
run: |
curl -sfL https://github.com/GoogleContainerTools/container-diff/releases/download/v0.17.0/container-diff-linux-amd64 -o /usr/bin/container-diff
chmod +x /usr/bin/container-diff
- name: Get current OS image from installer
run: |
curl -sfL https://raw.githubusercontent.com/harvester/harvester-installer/${{ steps.spliter.outputs._0 }}/scripts/package-harvester-os -o /tmp/package-harvester-os
grep '^BASE_OS_IMAGE="rancher/harvester-os:' /tmp/package-harvester-os > /tmp/tmp-env
- name: Run container-diff
run: |
source /tmp/tmp-env
docker pull $BASE_OS_IMAGE
echo "Diff $BASE_OS_IMAGE with ${{ env.IMAGE_NAME }}..."
container-diff diff daemon://docker.io/$BASE_OS_IMAGE daemon://docker.io/${{ env.IMAGE_NAME }} --type=rpm --output=diff-result.txt
cat diff-result.txt
- name: Upload container-diff result
uses: actions/upload-artifact@v3
with:
name: diff-result
path: diff-result.txt
create-installer-pr:
runs-on: ubuntu-latest
needs: generate-image-diff
steps:
- uses: jungwinter/split@v2
id: spliter
with:
msg: ${{ github.ref_name }}
separator: '-'
- name: Download container-diff result
uses: actions/download-artifact@v3
with:
name: diff-result
- name: Read diff result
id: read
uses: juliangruber/read-file-action@v1
with:
path: ./diff-result.txt
- name: Remove unused files
run: rm diff-result.txt
- name: Clone harvester-installer repo
uses: actions/checkout@v3
with:
repository: harvester/harvester-installer
ref: ${{ steps.spliter.outputs._0 }}
- name: Update os image
run: sed -i "s,^BASE_OS_IMAGE=.*,BASE_OS_IMAGE=\"${{ env.IMAGE_NAME }}\"," scripts/package-harvester-os
- name: Create installer PR
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.BOT_TOKEN }}
commit-message: Bump OS ${{ github.ref_name }}
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
team-reviewers: os
signoff: false
branch: bump-os-${{ github.ref_name }}
delete-branch: true
title: 'Bump OS ${{ github.ref_name }}'
draft: false
body: |
**Problem:**
Harvester base OS needs to update.
**Solution:**
Bump OS image to [${{ env.IMAGE_NAME }}](https://github.com/harvester/os2/releases/tag/${{ github.ref_name }}).
**Related Issue:**
**Test plan:**
**More info:**
```
${{ steps.read.outputs.content }}
```
create-addon-pr:
runs-on: ubuntu-latest
needs: generate-image-diff
steps:
- uses: jungwinter/split@v2
id: spliter
with:
msg: ${{ github.ref_name }}
separator: '-'
- name: Clone Addons repo
uses: actions/checkout@v3
with:
repository: harvester/addons
ref: ${{ steps.spliter.outputs._0 }}
- name: Update nvidia driver toolkit tag
run: |
sed -i "/tag:/ {N; /harvester-nvidia-driver-toolkit/ s/tag:.*\n/tag: ${{ github.ref_name }}\n/}" pkg/templates/rancherd-22-addons.yaml
- name: Create Addons PR
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.BOT_TOKEN }}
commit-message: Bump nvidia-driver-toolkit ${{ github.ref_name }}
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
team-reviewers: os
signoff: false
branch: bump-nv-driver-${{ github.ref_name }}
delete-branch: true
title: 'Bump nvidia-driver-toolkit ${{ github.ref_name }}'
draft: false
body: |
**Problem:**
The nvidia driver toolkit needs to update.
**Solution:**
Bump nvidia driver toolkit image as related baseos [${{ env.IMAGE_NAME }}](https://github.com/harvester/os2/releases/tag/${{ github.ref_name }}).
**Related Issue:**
**Test plan:**