-
Notifications
You must be signed in to change notification settings - Fork 31
121 lines (101 loc) · 3.69 KB
/
call-offline-build.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
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
name: Offline Build
on:
workflow_call:
jobs:
offline-build:
runs-on: ubuntu-latest
steps:
- name: Git clone kubean repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set kubespray version env
run: |
echo "SPRAY_VERSION=$(yq ".kubespray_version" version.yml)" >> ${GITHUB_ENV}
echo "KUBE_VERSION=$(yq ".kubernetes_version" version.yml)" >> ${GITHUB_ENV}
echo "SHA256SUM_TXT=sha256sum-offline-${{ github.ref_name }}.txt" >> ${GITHUB_ENV}
- name: Git clone kubespray repo
uses: actions/checkout@v3
with:
repository: kubernetes-sigs/kubespray
ref: ${{ env.SPRAY_VERSION }}
path: ./kubespray
- name: Install yq tool
uses: mikefarah/yq@v4.44.1
- name: Generate Manifest & LocalArtifactSet manifests
env:
KUBEAN_TAG: ${{ github.ref_name }}
SPRAY_COMMIT: ${{ env.SPRAY_VERSION }}
KUBE_VERSION: ${{ env.KUBE_VERSION }}
run: |
./artifacts/gen_airgap_crs.py Manifest
./artifacts/gen_airgap_crs.py LocalArtifactSet
cp artifacts/import_iso.sh ${KUBEAN_TAG}/
pushd ${KUBEAN_TAG}
sha256sum localartifactset.cr.yaml >> ../${{ env.SHA256SUM_TXT }}
sha256sum import_iso.sh >> ../${{ env.SHA256SUM_TXT }}
popd
echo "localartifactset cr output:"
cat ${KUBEAN_TAG}/localartifactset.cr.yaml
echo "manifest cr output:"
cat charts/kubean/templates/manifest.cr.yaml
- name: Preparing the python environment
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install kubespray requirements
run: |
cd kubespray/
python3 -m pip install --no-cache-dir -r requirements.txt
cd ../
- name: Generate binaries & images offline packages (amd64/arm64)
env:
KUBEAN_TAG: ${{ github.ref_name }}
KUBE_VERSION: ${{ env.KUBE_VERSION }}
run: |
function gen_airgap_pkgs() {
export ARCH=$1
export OFFLINE_PACKAGE_DIR=${KUBEAN_TAG}/${ARCH}
bash artifacts/gen_airgap_pkgs.sh all
pushd ${OFFLINE_PACKAGE_DIR}
tar -zcvf files-${ARCH}-${KUBEAN_TAG}.tar.gz files/
tar -zcvf images-${ARCH}-${KUBEAN_TAG}.tar.gz images/
mv files.list files-${ARCH}.list
mv images.list images-${ARCH}.list
sha256sum files-${ARCH}-${KUBEAN_TAG}.tar.gz >> ../../${{ env.SHA256SUM_TXT }}
sha256sum images-${ARCH}-${KUBEAN_TAG}.tar.gz >> ../../${{ env.SHA256SUM_TXT }}
sha256sum files-${ARCH}.list >> ../../${{ env.SHA256SUM_TXT }}
sha256sum images-${ARCH}.list >> ../../${{ env.SHA256SUM_TXT }}
popd
}
for arch in 'amd64' 'arm64'; do
gen_airgap_pkgs "${arch}"
done
tree ${KUBEAN_TAG}/
echo -e "\noutput files size:\n"
ls -lh ${KUBEAN_TAG}/amd64/
ls -lh ${KUBEAN_TAG}/arm64/
- name: Upload offline sha256sum file
uses: actions/upload-artifact@v4
with:
name: offline-sha256sum-key
retention-days: 1
path: |
${{ env.SHA256SUM_TXT }}
- name: Release and upload packages
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
${{ github.ref_name }}/*/*.tar.gz
${{ github.ref_name }}/*/*.list
${{ github.ref_name }}/*.cr.yaml
${{ github.ref_name }}/*.sh
- name: Upload InfoManifest CR
uses: actions/upload-artifact@v4
with:
path: charts/kubean/templates/manifest.cr.yaml
name: info-manifest-cr-file
retention-days: 1