-
Notifications
You must be signed in to change notification settings - Fork 2.1k
executable file
·202 lines (191 loc) · 6.74 KB
/
ci-patch-image.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
195
196
197
198
199
200
201
202
name: CI Patch Images Package
env:
# Common versions
GO_VERSION: "1.20"
DEFAULT_OWNER: "labring"
on:
workflow_dispatch:
inputs:
push_mage:
description: 'Push images'
required: false
type: boolean
push:
branches: [ "main" ]
paths-ignore:
- "docs/**"
- "**/*.md"
- "**/*.yaml"
- "CONTRIBUTORS"
- "CHANGELOG/**"
- "controllers/**"
- "service/**"
- "webhooks/**"
- "frontend/**"
pull_request:
branches: [ "*" ]
paths-ignore:
- "docs/**"
- "CHANGELOG/**"
- "**/*.md"
- "**/*.yaml"
- "CONTRIBUTORS"
- "CHANGELOG/**"
- "controllers/**"
- "service/**"
- "webhooks/**"
- "frontend/**"
jobs:
call_ci_workflow:
uses: ./.github/workflows/import-patch-image.yml
with:
arch: amd64,arm64
container-sealos:
needs: [ call_ci_workflow ]
runs-on: ubuntu-20.04
if: ${{ (github.event_name == 'push') || (inputs.push_mage == true) }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Expose git commit data
uses: rlespinasse/git-commit-data-action@v1
- # Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_PAT }}
- name: Download sealos
uses: actions/download-artifact@v3
with:
name: sealos-amd64
path: docker/sealos/bin/sealos-amd64
- name: Download sealos
uses: actions/download-artifact@v3
with:
name: sealos-arm64
path: docker/sealos/bin/sealos-arm64
- name: build (and publish) main sealos image
env:
# fork friendly ^^
DOCKER_REPO: ghcr.io/${{ github.repository_owner }}/sealos
working-directory: docker/sealos
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 \
--label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/sealos" \
--label "org.opencontainers.image.description=sealos container image" \
--label "org.opencontainers.image.licenses=MIT" \
--push \
-t ${DOCKER_REPO}:${{ env.GIT_COMMIT_SHORT_SHA }} \
-f Dockerfile.main \
.
docker buildx build \
--platform linux/amd64,linux/arm64 \
--label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/sealos" \
--label "org.opencontainers.image.description=sealos container image" \
--label "org.opencontainers.image.licenses=MIT" \
--push \
-t ${DOCKER_REPO}:latest \
-f Dockerfile.main \
.
build-on-cluster-image:
if: ${{ (github.event_name == 'push') || (inputs.push_mage == true) }}
needs:
- container-sealos
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Expose git commit data
uses: rlespinasse/git-commit-data-action@v1
- name: Renew issue and Sync Images
uses: labring/[email protected]
if: ${{ github.repository_owner == env.DEFAULT_OWNER }}
with:
version: v0.0.8-rc1
env:
GH_TOKEN: "${{ secrets.GH_PAT }}"
SEALOS_TYPE: "issue_renew"
SEALOS_ISSUE_TITLE: "[DaylyReport] Auto build for sealos"
SEALOS_ISSUE_BODYFILE: "scripts/ISSUE_RENEW.md"
SEALOS_ISSUE_LABEL: "dayly-report"
SEALOS_ISSUE_TYPE: "day"
SEALOS_ISSUE_REPO: "labring-actions/cluster-image"
SEALOS_COMMENT_BODY: "/imagebuild_apps sealos latest"
save-sealos:
uses: ./.github/workflows/import-save-sealos.yml
build-on-cluster-patch-image:
if: ${{ (github.event_name == 'push') || (inputs.push_mage == true) }}
needs:
- call_ci_workflow
- save-sealos
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download sealos
uses: actions/download-artifact@v3
with:
name: sealos
path: /tmp/
- name: Verify sealos
run: |
sudo chmod a+x /tmp/sealos
sudo mv /tmp/sealos /usr/bin/sealos
sudo sealos version
- name: Expose git commit data
uses: rlespinasse/git-commit-data-action@v1
- name: Download amd64 patch image tar
uses: actions/download-artifact@v3
with:
name: patch-image-amd64.tar
path: /tmp/sealos/images/
- name: Download arm64 patch image tar
uses: actions/download-artifact@v3
with:
name: patch-image-arm64.tar
path: /tmp/sealos/images/
- name: Manifest Cluster Images
run: |
sudo sealos login -u ${{ github.repository_owner }} -p ${{ secrets.GH_PAT }} --debug ghcr.io
sudo sealos load -i /tmp/sealos/images/patch-arm64.tar
sudo sealos load -i /tmp/sealos/images/patch-amd64.tar
sudo sealos images
bash docker/patch/manifest-cluster-images.sh
env:
OWNER: ${{ github.repository_owner }}
- name: Manifest Cluster Images for latest
run: |
sudo sealos tag ghcr.io/${{ github.repository_owner }}/sealos-patch:"$GIT_COMMIT_SHORT_SHA"-amd64 ghcr.io/${{ github.repository_owner }}/sealos-patch:latest-amd64
sudo sealos tag ghcr.io/${{ github.repository_owner }}/sealos-patch:"$GIT_COMMIT_SHORT_SHA"-arm64 ghcr.io/${{ github.repository_owner }}/sealos-patch:latest-arm64
sudo sealos images
bash docker/patch/manifest-cluster-images.sh ghcr.io/${{ github.repository_owner }}/sealos-patch:latest
env:
OWNER: ${{ github.repository_owner }}
- name: Renew issue and Sync Images
uses: labring/[email protected]
if: ${{ github.repository_owner == env.DEFAULT_OWNER }}
with:
version: v0.0.8-rc1
env:
GH_TOKEN: "${{ secrets.GH_PAT }}"
SEALOS_TYPE: "issue_renew"
SEALOS_ISSUE_TITLE: "[DaylyReport] Auto build for sealos"
SEALOS_ISSUE_BODYFILE: "scripts/ISSUE_RENEW.md"
SEALOS_ISSUE_LABEL: "dayly-report"
SEALOS_ISSUE_TYPE: "day"
SEALOS_ISSUE_REPO: "labring-actions/cluster-image"
SEALOS_COMMENT_BODY: "/imagesync ghcr.io/${{ github.repository_owner }}/sealos-patch:latest"