From 95af04afa9210473a4ea42e8182bd398e2f4a47a Mon Sep 17 00:00:00 2001 From: "bo.jiang" Date: Fri, 10 May 2024 17:53:57 +0800 Subject: [PATCH] add sha256sum file to release assets Signed-off-by: bo.jiang --- .github/workflows/auto-release-ci.yaml | 8 +++ .github/workflows/call-offline-build.yaml | 64 ++++++++++++--------- .github/workflows/call-os-pkgs-build.yaml | 50 ++++++++--------- .github/workflows/call-sha256sum-gen.yaml | 62 +++++++++++++++++++++ .github/workflows/call-upload-qiniu.yaml | 68 ----------------------- .github/workflows/os-pkgs-matrix.json | 14 +++++ 6 files changed, 146 insertions(+), 120 deletions(-) create mode 100644 .github/workflows/call-sha256sum-gen.yaml delete mode 100644 .github/workflows/call-upload-qiniu.yaml create mode 100644 .github/workflows/os-pkgs-matrix.json diff --git a/.github/workflows/auto-release-ci.yaml b/.github/workflows/auto-release-ci.yaml index 42a2339ea..b33602b10 100644 --- a/.github/workflows/auto-release-ci.yaml +++ b/.github/workflows/auto-release-ci.yaml @@ -47,6 +47,14 @@ jobs: packages: write contents: write + call-sha256sum-gen: + needs: [call-offline-build, call-os-pkgs-build] + uses: ./.github/workflows/call-sha256sum-gen.yaml + secrets: inherit + permissions: + packages: write + contents: write + sync-charts-and-api: needs: [call-images-build, call-offline-build, call-os-pkgs-build] uses: ./.github/workflows/call-sync-repos.yaml diff --git a/.github/workflows/call-offline-build.yaml b/.github/workflows/call-offline-build.yaml index 6dbb31405..f1d8a428a 100644 --- a/.github/workflows/call-offline-build.yaml +++ b/.github/workflows/call-offline-build.yaml @@ -16,6 +16,7 @@ jobs: 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 @@ -37,6 +38,11 @@ jobs: ./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:" @@ -53,41 +59,48 @@ jobs: python3 -m pip install --no-cache-dir -r requirements.txt cd ../ - - name: Generate binaries & images offline packages (amd64) + - name: Generate binaries & images offline packages (amd64/arm64) env: KUBEAN_TAG: ${{ github.ref_name }} - ARCH: amd64 KUBE_VERSION: ${{ env.KUBE_VERSION }} run: | - OFFLINE_PACKAGE_DIR=${KUBEAN_TAG}/${ARCH} - bash artifacts/gen_airgap_pkgs.sh all - cd ${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 - cd ../../ - tree ${KUBEAN_TAG}/ + 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 - - name: Generate binaries & images offline packages (arm64) - env: - KUBEAN_TAG: ${{ github.ref_name }} - ARCH: arm64 - KUBE_VERSION: ${{ env.KUBE_VERSION }} - run: | - OFFLINE_PACKAGE_DIR=${KUBEAN_TAG}/${ARCH} - bash artifacts/gen_airgap_pkgs.sh all - cd ${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 - cd ../../ 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 @@ -105,3 +118,4 @@ jobs: with: path: charts/kubean/templates/manifest.cr.yaml name: info-manifest-cr-file + retention-days: 1 diff --git a/.github/workflows/call-os-pkgs-build.yaml b/.github/workflows/call-os-pkgs-build.yaml index 39ffca209..57b59bc1c 100644 --- a/.github/workflows/call-os-pkgs-build.yaml +++ b/.github/workflows/call-os-pkgs-build.yaml @@ -3,38 +3,22 @@ name: OS Packages Build on: workflow_call jobs: + matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - uses: actions/checkout@v3 + - id: set-matrix + run: | + echo "matrix=$(jq -c . < .github/workflows/os-pkgs-matrix.json)" >> $GITHUB_OUTPUT build: runs-on: ubuntu-latest + needs: matrix strategy: fail-fast: false matrix: - include: - - name: centos7 - dockerfile: build/os-packages/Dockerfile.centos7 - - name: redhat7 - dockerfile: build/os-packages/Dockerfile.redhat7 - - name: redhat8 - dockerfile: build/os-packages/Dockerfile.redhat8 - - name: redhat9 - dockerfile: build/os-packages/Dockerfile.redhat9 - - name: rocky9 - dockerfile: build/os-packages/Dockerfile.rocky9 - - name: kylinv10 - dockerfile: build/os-packages/Dockerfile.kylinv10 - - name: openeuler22.03 - dockerfile: build/os-packages/Dockerfile.openeuler22.03 - - name: oracle8 - dockerfile: build/os-packages/Dockerfile.oracle8 - - name: oracle9 - dockerfile: build/os-packages/Dockerfile.oracle9 - - name: tencent31 - dockerfile: build/os-packages/Dockerfile.tencent31 - - name: ubuntu1804 - dockerfile: build/os-packages/Dockerfile.ubuntu1804 - - name: ubuntu2004 - dockerfile: build/os-packages/Dockerfile.ubuntu2004 - - name: ubuntu2204 - dockerfile: build/os-packages/Dockerfile.ubuntu2204 + include: ${{ fromJSON(needs.matrix.outputs.matrix) }} steps: - name: Checkout uses: actions/checkout@v3 @@ -87,6 +71,18 @@ jobs: cp artifacts/import_ospkgs.sh os-pkgs/ tar -I pigz -cf os-pkgs-${{ matrix.name }}-${{ github.ref_name }}.tar.gz os-pkgs/ --remove-files + - name: Generate sha256sum file + run: | + sha256sum os-pkgs-${{ matrix.name }}-${{ github.ref_name }}.tar.gz > sha256sum-os-pkg-${{ matrix.name }}-${{ github.ref_name }}.txt + + - name: Upload os-pkgs sha256sum file + uses: actions/upload-artifact@v4 + with: + name: os-pkgs-sha256sum-${{ matrix.name }}-key + retention-days: 1 + path: | + sha256sum-os-pkg-${{ matrix.name }}-${{ github.ref_name }}.txt + - name: Release and upload packages if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v2 diff --git a/.github/workflows/call-sha256sum-gen.yaml b/.github/workflows/call-sha256sum-gen.yaml new file mode 100644 index 000000000..83e3f126d --- /dev/null +++ b/.github/workflows/call-sha256sum-gen.yaml @@ -0,0 +1,62 @@ +name: Assets sha256sum Generate + +on: workflow_call + +jobs: + matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - uses: actions/checkout@v3 + - id: set-matrix + run: | + echo "matrix=$(jq -c . < .github/workflows/os-pkgs-matrix.json)" >> $GITHUB_OUTPUT + os-pkgs-sha256sum: + runs-on: ubuntu-latest + needs: matrix + strategy: + fail-fast: true + max-parallel: 1 + matrix: + include: ${{ fromJSON(needs.matrix.outputs.matrix) }} + steps: + - name: Download os-pkgs sha256sum files + uses: actions/download-artifact@v4 + with: + name: os-pkgs-sha256sum-${{ matrix.name }}-key + - name: Download offline sha256sum file + uses: actions/download-artifact@v4 + with: + name: offline-sha256sum-key + - name: Integrate all sha256sum for os-pkgs + run: | + cat sha256sum-os-pkg-${{ matrix.name }}-${{ github.ref_name }}.txt >> sha256sum-offline-${{ github.ref_name }}.txt + - name: Upload offline sha256sum file + uses: actions/upload-artifact@v4 + with: + name: offline-sha256sum-key + overwrite: true + retention-days: 1 + path: | + sha256sum-offline-${{ github.ref_name }}.txt + + upload-sha256sum-file: + runs-on: ubuntu-latest + needs: os-pkgs-sha256sum + steps: + - name: Download offline sha256sum file + uses: actions/download-artifact@v4 + with: + name: offline-sha256sum-key + - name: Rename sha256sum + run: | + mv sha256sum-offline-${{ github.ref_name }}.txt sha256sum.txt + - name: upload sha256sum file + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + files: | + sha256sum.txt diff --git a/.github/workflows/call-upload-qiniu.yaml b/.github/workflows/call-upload-qiniu.yaml deleted file mode 100644 index e62f9c485..000000000 --- a/.github/workflows/call-upload-qiniu.yaml +++ /dev/null @@ -1,68 +0,0 @@ -name: Upload Qiniu - -on: workflow_call - -env: - QINIU_SHELL_TAR: qshell-v2.8.0-linux-amd64.tar.gz - -jobs: - make-package: - runs-on: ubuntu-latest - permissions: - packages: write - contents: read - steps: - - name: clean environment - run: rm -rf ./* - - - name: Restore offline-build cache - uses: actions/cache@v4 - with: - path: ${{ github.ref_name }}/ - key: offline-build - - - name: Restore os-pkgs-build-centos7 cache - uses: actions/cache@v4 - with: - path: | - os-pkgs/kubean-${{ github.ref_name }}-centos7.sha256sum.txt - os-pkgs/kubean-${{ github.ref_name }}-centos7-amd64.tar.gz - os-pkgs/kubean-${{ github.ref_name }}-centos7-arm64.tar.gz - key: os-pkgs-build-centos7 - - - name: Make tar package - run: | - tree . - mv os-pkgs/* ${{ github.ref_name }}/os-pkgs/ - tar -zcvf kubean-${{ github.ref_name }}.tar.gz ${{ github.ref_name }}/ - - - name: Upload offline tar file - uses: actions/upload-artifact@v4 - with: - name: kubean-offline-tar - path: | - kubean-${{ github.ref_name }}.tar.gz - - upload-qiniu: - needs: [make-package] - runs-on: self-hosted - permissions: - packages: write - contents: read - steps: - - name: Download offline tar file - uses: actions/download-artifact@v4 - with: - name: kubean-offline-tar - - - name: Upload offline package to Qiniu - run: | - wget https://devtools.qiniu.com/$QINIU_SHELL_TAR - tar -zxvf $QINIU_SHELL_TAR - mv qshell /usr/local/bin/ - chmod +x /usr/local/bin/qshell - qshell account -w ${{ secrets.QINIU_AK }} ${{ secrets.QINIU_SK }} 'dce-ci' - echo 'delete the same name of old file' - qshell delete ${{ secrets.QINIU_BU }} DaoCloud_Enterprise/dce5/kubean-${{ github.ref_name }}.tar.gz - echo 'upload to qiniu' - qshell rput ${{ secrets.QINIU_BU }} DaoCloud_Enterprise/dce5/kubean-${{ github.ref_name }}.tar.gz kubean-${{ github.ref_name }}.tar.gz diff --git a/.github/workflows/os-pkgs-matrix.json b/.github/workflows/os-pkgs-matrix.json new file mode 100644 index 000000000..8862cff15 --- /dev/null +++ b/.github/workflows/os-pkgs-matrix.json @@ -0,0 +1,14 @@ +[ + { "name": "redhat7", "dockerfile":"build/os-packages/Dockerfile.redhat7"}, + { "name": "redhat8", "dockerfile":"build/os-packages/Dockerfile.redhat8"}, + { "name": "redhat9", "dockerfile":"build/os-packages/Dockerfile.redhat9"}, + { "name": "rocky9", "dockerfile":"build/os-packages/Dockerfile.rocky9"}, + { "name": "kylinv10", "dockerfile":"build/os-packages/Dockerfile.kylinv10"}, + { "name": "openeuler22.03", "dockerfile":"build/os-packages/Dockerfile.openeuler22.03"}, + { "name": "oracle8", "dockerfile":"build/os-packages/Dockerfile.oracle8"}, + { "name": "oracle9", "dockerfile":"build/os-packages/Dockerfile.oracle9"}, + { "name": "tencent31", "dockerfile":"build/os-packages/Dockerfile.tencent31"}, + { "name": "ubuntu1804", "dockerfile":"build/os-packages/Dockerfile.ubuntu1804"}, + { "name": "ubuntu2004", "dockerfile":"build/os-packages/Dockerfile.ubuntu2004"}, + { "name": "ubuntu2204", "dockerfile":"build/os-packages/Dockerfile.ubuntu2204"} +]