From fbcd5c7e35b987563ee66f43bc85606f680e0725 Mon Sep 17 00:00:00 2001 From: huangzhangshu Date: Wed, 10 Apr 2024 20:08:34 +0800 Subject: [PATCH] chore: release install KubeBlocks yaml --- .github/workflows/release-crds.yml | 60 +++++++++++++------ .../helm/templates/tests/test-connection.yaml | 15 ----- 2 files changed, 41 insertions(+), 34 deletions(-) delete mode 100644 deploy/helm/templates/tests/test-connection.yaml diff --git a/.github/workflows/release-crds.yml b/.github/workflows/release-crds.yml index 7202ab8aa0a..61553af11fa 100644 --- a/.github/workflows/release-crds.yml +++ b/.github/workflows/release-crds.yml @@ -1,4 +1,4 @@ -name: Release Crds +name: Release KubeBlocks Install And Crds Yaml on: workflow_dispatch: @@ -17,7 +17,7 @@ env: GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} JIHULAB_KUBEBLOCKS_PROJECT_ID: 98723 JIHULAB_ACCESS_TOKEN: ${{ secrets.GITLAB_ACCESS_TOKEN }} - KUBEBLOCKS_CRDS: "kubeblocks_crds.yaml" + HELM_VERSION: v3.14.3 jobs: release-version: @@ -29,11 +29,11 @@ jobs: - name: Get Release Version id: get_release_version run: | - RELASE_VERSION="${{ inputs.RELEASE_VERSION }}" - if [[ -z "$RELASE_VERSION" ]]; then - RELASE_VERSION="${{ github.ref_name }}" + RELEASE_VERSION="${{ inputs.RELEASE_VERSION }}" + if [[ -z "$RELEASE_VERSION" ]]; then + RELEASE_VERSION="${{ github.ref_name }}" fi - echo release-version=$RELASE_VERSION >> $GITHUB_OUTPUT + echo release-version=$RELEASE_VERSION >> $GITHUB_OUTPUT create-jihulab-release: name: Create Release KubeBlocks Jihulab @@ -49,32 +49,54 @@ jobs: --tag-name "${{ needs.release-version.outputs.release-version }}" \ --access-token ${{ env.JIHULAB_ACCESS_TOKEN }} - upload-kubeblocks-crds: + upload-kubeblocks-yaml: needs: [ release-version, create-jihulab-release ] - name: Upload KubeBlocks crds + strategy: + fail-fast: false + matrix: + yaml: [ 'kubeblocks_crds.yaml', 'kubeblocks.yaml' ] + name: Upload ${{ matrix.yaml }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + + - name: Install Helm + if: ${{ matrix.yaml == 'kubeblocks.yaml' }} + uses: azure/setup-helm@v4 + with: + version: ${{ env.HELM_VERSION }} + + - name: generate KubeBlocks yaml + if: ${{ matrix.yaml == 'kubeblocks.yaml' }} + run: | + BUMP_VERSION="${{ needs.release-version.outputs.release-version }}" + if [[ "$BUMP_VERSION" == "v"* ]]; then + BUMP_VERSION="${BUMP_VERSION/v/}" + fi + make bump-chart-ver VERSION="${BUMP_VERSION}" + touch ${{ matrix.yaml }} + helm template kubeblocks deploy/helm --dependency-update > ${{ matrix.yaml }} + - name: merge KubeBlocks crds + if: ${{ matrix.yaml == 'kubeblocks_crds.yaml' }} run: | + touch ${{ matrix.yaml }} crds_path="deploy/helm/crds" - KUBEBLOCKS_CRDS=${{ env.KUBEBLOCKS_CRDS }} - touch $KUBEBLOCKS_CRDS crds_list=$(ls $crds_path) for crd in $(echo $crds_list); do - echo "---" >> $KUBEBLOCKS_CRDS - cat $crds_path/$crd >> $KUBEBLOCKS_CRDS + echo "---" >> ${{ matrix.yaml }} + cat $crds_path/$crd >> ${{ matrix.yaml }} done - - name: upload KubeBlocks crds to jihulab + - name: upload KubeBlocks yaml to jihulab run: | - echo "Processing file: ${{ env.KUBEBLOCKS_CRDS }}" + echo "Processing file: ${{ matrix.yaml }}" bash ${{ github.workspace }}/.github/utils/release_gitlab.sh \ --type 2 \ --project-id ${{ env.JIHULAB_KUBEBLOCKS_PROJECT_ID }} \ --tag-name "${{ needs.release-version.outputs.release-version }}" \ - --asset-path ${{ github.workspace }}/${{ env.KUBEBLOCKS_CRDS }} \ - --asset-name ${{ env.KUBEBLOCKS_CRDS }} \ + --asset-path ${{ github.workspace }}/${{ matrix.yaml }} \ + --asset-name ${{ matrix.yaml }} \ --access-token ${{ env.JIHULAB_ACCESS_TOKEN }} - name: get KubeBlocks release upload url @@ -85,10 +107,10 @@ jobs: --github-repo ${{ github.repository }} \ --github-token ${{ env.GITHUB_TOKEN }}` >> $GITHUB_ENV - - name: upload KubeBlocks crds to github + - name: upload KubeBlocks yaml to github uses: actions/upload-release-asset@main with: upload_url: ${{ env.UPLOAD_URL }} - asset_path: ${{ github.workspace }}/${{ env.KUBEBLOCKS_CRDS }} - asset_name: ${{ env.KUBEBLOCKS_CRDS }} + asset_path: ${{ github.workspace }}/${{ matrix.yaml }} + asset_name: ${{ matrix.yaml }} asset_content_type: application/yaml diff --git a/deploy/helm/templates/tests/test-connection.yaml b/deploy/helm/templates/tests/test-connection.yaml deleted file mode 100644 index a144a858a32..00000000000 --- a/deploy/helm/templates/tests/test-connection.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "{{ include "kubeblocks.fullname" . }}-test-connection" - labels: - {{- include "kubeblocks.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": test -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "kubeblocks.fullname" . }}:{{ .Values.service.port }}'] - restartPolicy: Never