Skip to content

Commit dea6b5d

Browse files
authored
ci: split QingStor OSS sync into separate jobs (#3200)
Move the QingCloud object storage (QingStor/qsctl) synchronization out of the build jobs into independent jobs so a sync failure only requires re-running the sync step instead of the whole build pipeline. - releaser.yaml: add sync-oss job (needs goreleaser), pass dist via artifact - gen-repository-iso.yaml: add sync-iso-oss (matrix) and sync-harbor-oss jobs, pass ISO/harbor artifacts between jobs Signed-off-by: redscholar <blacktiledhouse@gmail.com>
1 parent a2f5ed7 commit dea6b5d

2 files changed

Lines changed: 77 additions & 5 deletions

File tree

.github/workflows/gen-repository-iso.yaml

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,24 +113,59 @@ jobs:
113113
${{ matrix.name }}-arm64.iso
114114
overwrite: true
115115

116+
- name: Upload artifacts
117+
uses: actions/upload-artifact@v4
118+
with:
119+
name: iso-${{ matrix.name }}
120+
path: |
121+
${{ matrix.name }}.iso.sha256sum.txt
122+
${{ matrix.name }}-amd64.iso
123+
${{ matrix.name }}-arm64.iso
124+
retention-days: 5
125+
126+
sync-iso-oss:
127+
runs-on: ubuntu-latest
128+
needs: build-iso
129+
if: github.repository == 'kubesphere/kubekey' && (github.event_name == 'push' || github.event.inputs.upload_iso == 'true')
130+
strategy:
131+
fail-fast: false
132+
matrix:
133+
include:
134+
- name: almalinux-9.0-rpms
135+
- name: centos-8-rpms
136+
- name: debian-10-debs
137+
- name: debian-11-debs
138+
- name: kylin-v10SP3-2403-rpms
139+
- name: kylin-v10SP3-rpms
140+
- name: kylin-v10SP2-rpms
141+
- name: kylin-v10SP1-rpms
142+
- name: ubuntu-18.04-debs
143+
- name: ubuntu-20.04-debs
144+
- name: ubuntu-22.04-debs
145+
- name: ubuntu-24.04-debs
146+
steps:
147+
- name: Download artifacts
148+
uses: actions/download-artifact@v4
149+
with:
150+
name: iso-${{ matrix.name }}
151+
path: .
152+
116153
- name: Synchronize artifacts to OSS
117154
run: |
118-
119155
rm -rf qsctl_v2.4.3_linux_amd64.tar.gz
120156
wget https://attack-on-titan.gd2.qingstor.com/qsctl/v2.4.3/qsctl_v2.4.3_linux_amd64.tar.gz
121157
tar -zxvf qsctl_v2.4.3_linux_amd64.tar.gz
122158
rm -rf qsctl_v2.4.3_linux_amd64.tar.gz
123159
mv qsctl_v2.4.3_linux_amd64 /usr/local/bin/qsctl
124160
echo "access_key_id: ${{secrets.KS_QSCTL_ACCESS_KEY_ID}}" > qsctl-config.yaml
125161
echo "secret_access_key: ${{ secrets.KS_QSCTL_SECRET_ACCESS_KEY }}" >> qsctl-config.yaml
126-
162+
127163
qsctl -c qsctl-config.yaml cp ${{ matrix.name }}.iso.sha256sum.txt qs://kubekey/github.com/kubesphere/kubekey/releases/download/iso-latest/${{ matrix.name }}.iso.sha256sum.txt
128164
qsctl -c qsctl-config.yaml cp ${{ matrix.name }}-amd64.iso qs://kubekey/github.com/kubesphere/kubekey/releases/download/iso-latest/${{ matrix.name }}-amd64.iso
129165
qsctl -c qsctl-config.yaml cp ${{ matrix.name }}-arm64.iso qs://kubekey/github.com/kubesphere/kubekey/releases/download/iso-latest/${{ matrix.name }}-arm64.iso
130166
131167
rm -rf qsctl-config.yaml
132168
133-
134169
build-harbor:
135170
runs-on: ubuntu-latest
136171
needs: update-tag
@@ -161,6 +196,24 @@ jobs:
161196
files: config/harbor/*/*harbor-offline-installer*.tgz
162197
overwrite: true
163198

199+
- name: Upload artifacts
200+
uses: actions/upload-artifact@v4
201+
with:
202+
name: harbor
203+
path: config/harbor
204+
retention-days: 5
205+
206+
sync-harbor-oss:
207+
runs-on: ubuntu-latest
208+
needs: build-harbor
209+
if: github.repository == 'kubesphere/kubekey' && (github.event_name == 'push' || github.event.inputs.upload_harbor == 'true')
210+
steps:
211+
- name: Download artifacts
212+
uses: actions/download-artifact@v4
213+
with:
214+
name: harbor
215+
path: .
216+
164217
- name: Synchronize harbor packages to OSS
165218
shell: bash
166219
run: |

.github/workflows/releaser.yaml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,29 @@ jobs:
6060
env:
6161
GITHUB_TOKEN: ${{ secrets.ADMIN_GH_TOKEN }}
6262

63+
- name: Upload artifacts
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: dist
67+
path: dist
68+
retention-days: 5
69+
70+
sync-oss:
71+
runs-on: ubuntu-latest
72+
needs: goreleaser
73+
if: github.repository == 'kubesphere/kubekey'
74+
steps:
75+
- name: Download artifacts
76+
uses: actions/download-artifact@v4
77+
with:
78+
name: dist
79+
path: .
80+
6381
- name: Synchronize artifacts to OSS
6482
run: |
83+
VERSION=${GITHUB_REF#refs/tags/}
6584
# Check if the current Git reference is a valid semantic version tag (e.g., v1.2.3)
66-
if [[ ! ${GITHUB_REF#refs/*/} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
85+
if [[ ! "${VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
6786
echo "Skipping artifact synchronization: not a release tag."
6887
return 0
6988
fi
@@ -76,6 +95,6 @@ jobs:
7695
echo "secret_access_key: ${{ secrets.KS_QSCTL_SECRET_ACCESS_KEY }}" >> qsctl-config.yaml
7796
7897
mkdir -p dist-output && mv dist/*.tar.gz dist-output/
79-
qsctl -c qsctl-config.yaml cp -r dist-output/ qs://kubekey/github.com/kubesphere/kubekey/releases/download/${{ steps.prepare.outputs.version }}/
98+
qsctl -c qsctl-config.yaml cp -r dist-output/ qs://kubekey/github.com/kubesphere/kubekey/releases/download/${VERSION}/
8099
81100
rm -rf qsctl-config.yaml dist-output/

0 commit comments

Comments
 (0)