From 8b058dbce333d99068988a376f3f19c6b62069db Mon Sep 17 00:00:00 2001 From: Kakde Date: Mon, 18 Aug 2025 15:03:12 +0530 Subject: [PATCH 1/4] updated release process --- .github/workflows/create-tag-release.yaml | 64 +++++++++++++++++++++++ .github/workflows/release-image.yaml | 64 +++++++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 .github/workflows/create-tag-release.yaml create mode 100644 .github/workflows/release-image.yaml diff --git a/.github/workflows/create-tag-release.yaml b/.github/workflows/create-tag-release.yaml new file mode 100644 index 00000000..0f554b1b --- /dev/null +++ b/.github/workflows/create-tag-release.yaml @@ -0,0 +1,64 @@ +name: Create Tag and Release + +on: + workflow_call: + inputs: + version: + description: "Semantic version to release. Ex: major, minor, or patch" + type: string + required: true + images: + description: "List of image names. Example: csi-powerstore,csi-isilon" + type: string + required: true + +jobs: + build-and-scan: + name: Build and Scan + runs-on: ubuntu-latest + steps: + - name: Checkout the code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.24" + + - name: Install dependencies + run: go mod tidy + + - name: Build binaries + run: | + echo "Building binaries to attach to the release if any..." + if "${{ inputs.images == 'cert-csi' }}"; then + make build + mv cert-csi cert-csi-linux-amd64 + echo "BIN_NAME=cert-csi-linux-amd64" >> $GITHUB_ENV + fi + if "${{ contains(inputs.images, 'dell-csi-replicator') || contains(inputs.images, 'dell-replication-controller') }}"; then + cd repctl + make build + mv repctl repctl-linux-amd64 + mv repctl-linux-amd64 ../ + echo "BIN_NAME=repctl-linux-amd64" >> $GITHUB_ENV + fi + + - name: Upload Binaries + if: ${{ env.BIN_NAME != '' }} + uses: actions/upload-artifact@v4.6.1 + env: + BIN_NAME: ${{ env.BIN_NAME }} + with: + name: ${{ env.BIN_NAME }} + path: ${{ env.BIN_NAME }} + + release-and-tag: + name: Tag and Release + needs: build-and-scan + uses: dell/common-github-actions/.github/workflows/release-creator.yaml@main + with: + version: ${{ inputs.version }} + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/release-image.yaml b/.github/workflows/release-image.yaml new file mode 100644 index 00000000..9b99e638 --- /dev/null +++ b/.github/workflows/release-image.yaml @@ -0,0 +1,64 @@ +# This workflow is used to push images to quay.io +name: Release Image + +# Invocable as a reusable workflow +on: + workflow_call: + inputs: + version: + description: "Semantic version to release. Ex: major, minor, or patch" + type: string + required: true + images: + description: "List of image names. Example: csi-powerstore,csi-isilon" + type: string + required: true + +jobs: + push-images: + if: ${{ inputs.version == 'patch' || inputs.version == 'minor' || inputs.version == 'major' }} + name: Release images to Quay + runs-on: ubuntu-latest + steps: + - name: Push images to Quay.io + shell: bash + run: | + images_list=$(echo '${{ inputs.images }}' | tr -d '[]"' | tr ',' ' ') + REPOSITORY="delltech/csm" + + for image in $images_list; do + latest_version=$(curl -s https://quay.io/api/v1/repository/$REPOSITORY/$image/tag/?limit=100 | jq -r '.tags[].name' | sort -V | tail -n 1) + echo "Current latest version of $image:$latest_version" + + IFS='.' read -r -a version_parts <<< "$latest_version" + + if "${{ inputs.version == 'major' }}"; then + version_parts[0]=$(expr ${version_parts[0]} + 1) + new_version="${version_parts[0]}.0.0" + fi + if "${{ inputs.version == 'minor' }}"; then + version_parts[1]=$(expr ${version_parts[1]} + 1) + new_version="${version_parts[0]}.${version_parts[1]}.0" + fi + if "${{ inputs.version == 'patch' }}"; then + version_parts[2]=$(expr ${version_parts[2]} + 1) + new_version="${version_parts[0]}.${version_parts[1]}.${version_parts[2]}" + fi + + SHA=$(curl -s --location --request GET https://quay.io/api/v1/repository/$REPOSITORY/$image/tag?specificTag=nightly --header 'Content-Type: application/json' --header 'Authorization: Bearer ${{ secrets.QUAY_API_TOKEN }}' | jq -r '.tags[0].manifest_digest') + echo "Pushing image: $image:$new_version" + + curl --location --request PUT https://quay.io/api/v1/repository/$REPOSITORY/$image/tag/$new_version \ + --header 'Content-Type: application/json' \ + --header 'Authorization: Bearer ${{ secrets.QUAY_API_TOKEN }}' \ + --data-raw '{ + "manifest_digest": "'"$SHA"'" + }' + + curl --location --request PUT https://quay.io/api/v1/repository/$REPOSITORY/$image/tag/latest \ + --header 'Content-Type: application/json' \ + --header 'Authorization: Bearer ${{ secrets.QUAY_API_TOKEN }}' \ + --data-raw '{ + "manifest_digest": "'"$SHA"'" + }' + done \ No newline at end of file From cef9d46241b5b7ce251bd281a3c88aa8317d1ba9 Mon Sep 17 00:00:00 2001 From: Kakde Date: Mon, 18 Aug 2025 15:21:27 +0530 Subject: [PATCH 2/4] updated release process --- .github/workflows/create-tag-release.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-tag-release.yaml b/.github/workflows/create-tag-release.yaml index 0f554b1b..6b3a2ff8 100644 --- a/.github/workflows/create-tag-release.yaml +++ b/.github/workflows/create-tag-release.yaml @@ -1,5 +1,6 @@ +# This workflow is used to create Github Tag and Release name: Create Tag and Release - +# Invocable as a reusable workflow on: workflow_call: inputs: From a01baeff6eb2c0283336967ae2f97eb0bdce3b96 Mon Sep 17 00:00:00 2001 From: Kakde Date: Mon, 18 Aug 2025 21:38:21 +0530 Subject: [PATCH 3/4] update release workflow --- .github/workflows/create-tag-release.yaml | 10 +++++++++- .github/workflows/release-image.yaml | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-tag-release.yaml b/.github/workflows/create-tag-release.yaml index 6b3a2ff8..31b26cff 100644 --- a/.github/workflows/create-tag-release.yaml +++ b/.github/workflows/create-tag-release.yaml @@ -1,3 +1,11 @@ +# Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + # This workflow is used to create Github Tag and Release name: Create Tag and Release # Invocable as a reusable workflow @@ -62,4 +70,4 @@ jobs: uses: dell/common-github-actions/.github/workflows/release-creator.yaml@main with: version: ${{ inputs.version }} - secrets: inherit \ No newline at end of file + secrets: inherit diff --git a/.github/workflows/release-image.yaml b/.github/workflows/release-image.yaml index 9b99e638..0d4d22ed 100644 --- a/.github/workflows/release-image.yaml +++ b/.github/workflows/release-image.yaml @@ -1,3 +1,11 @@ +# Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + # This workflow is used to push images to quay.io name: Release Image @@ -61,4 +69,4 @@ jobs: --data-raw '{ "manifest_digest": "'"$SHA"'" }' - done \ No newline at end of file + done From 29a350e2783ee0b4b93e074912dfae84fa419ded Mon Sep 17 00:00:00 2001 From: Kakde Date: Tue, 19 Aug 2025 15:20:38 +0530 Subject: [PATCH 4/4] update readme --- .github/workflows/create-tag-release.yaml | 2 +- .github/workflows/release-image.yaml | 2 +- README.md | 144 ++++++++++++++++++++++ 3 files changed, 146 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-tag-release.yaml b/.github/workflows/create-tag-release.yaml index 31b26cff..d6227d94 100644 --- a/.github/workflows/create-tag-release.yaml +++ b/.github/workflows/create-tag-release.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. +# Copyright (c) 2025 Dell Inc., or its subsidiaries. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.github/workflows/release-image.yaml b/.github/workflows/release-image.yaml index 0d4d22ed..93feae6f 100644 --- a/.github/workflows/release-image.yaml +++ b/.github/workflows/release-image.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. +# Copyright (c) 2025 Dell Inc., or its subsidiaries. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 1cf91fd7..f8bbe4df 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,150 @@ jobs: name: Check License Header uses: dell/common-github-actions/.github/workflows/check-license-header.yaml@main ``` +### create-tag-release + +This workflow automates the creation of Tag and Release in driver and module Github repositories. The workflow accepts two parameters as version and image, and can be used from any repo by creating a workflow that resembles the following. + +For manual trigger from driver and module repositories, here is the example for the csi-powerscale repo: + +```yaml +name: Create Tag and Release +# Invocable as a reusable workflow +# Can be manually triggered +on: # yamllint disable-line rule:truthy + workflow_call: + workflow_dispatch: + inputs: + option: + description: 'Select version to release' + required: true + type: choice + default: 'minor' + options: + - major + - minor + - patch + - n-1/n-2 patch (Provide input in the below box) + version: + description: "Patch version to release. example: 2.1.x (Use this only if n-1/n-2 patch is selected)" + required: false + type: string + repository_dispatch: + types: [auto-release-workflow] + +jobs: + process-inputs: + name: Process Inputs + runs-on: ubuntu-latest + outputs: + processedVersion: ${{ steps.set-version.outputs.versionEnv }} + steps: + - name: Process input + id: set-version + shell: bash + run: | + echo "Triggered by: ${{ github.event_name }}" + if [[ "${{ github.event_name }}" == "repository_dispatch" ]]; then + echo "versionEnv=minor" >> $GITHUB_OUTPUT + exit 0 + fi + if [[ "${{ github.event.inputs.version }}" != "" && "${{ github.event.inputs.option }}" == "n-1/n-2 patch (Provide input in the below box)" ]]; then + echo "versionEnv=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT + exit 0 + fi + if [[ "${{ github.event.inputs.option }}" != "n-1/n-2 patch (Provide input in the below box)" ]]; then + echo "versionEnv=${{ github.event.inputs.option }}" >> $GITHUB_OUTPUT + exit 0 + fi + echo "versionEnv=minor" >> $GITHUB_OUTPUT + + csm-release: + needs: process-inputs + uses: dell/common-github-actions/.github/workflows/create-tag-release.yaml@main + name: Create Tag and Release + with: + version: ${{ needs.process-inputs.outputs.processedVersion }} + images: 'csi-isilon' + secrets: inherit + + next-steps: + name: 📌 Next Steps for Release Process + runs-on: ubuntu-latest + needs: csm-release + steps: + - name: Share next steps with user + run: | + echo "✅ Tag and release completed." + echo "➡️ Please manually trigger the Jenkins image build job: CSM-Images-Build-Nightly." + echo "🚀 Once the Jenkins image build job is successful, trigger the Release Image workflow from GitHub Actions." +``` +### release-image + +This workflow automates releasing the images to quay.io. The workflow accepts two parameters as version and image, and can be used from any repo by creating a workflow that resembles the following. + +Before manually triggering this workflow from a driver or module repository, ensure that the create-tag-and-image workflow has been executed, followed by a manual trigger of the Jenkins job 'CSM-Images-Build-Nightly'. Once the Jenkins image build job is successful, the release-image workflow can be manually triggered to publish the image to quay.io. here is the example for the csi-powerscale repo: + +```yaml +name: Release CSI-Powerscale Image +# Invocable as a reusable workflow +# Can be manually triggered +on: # yamllint disable-line rule:truthy + workflow_call: + workflow_dispatch: + inputs: + option: + description: 'Select version to release' + required: true + type: choice + default: 'minor' + options: + - major + - minor + - patch + - n-1/n-2 patch (Provide input in the below box) + version: + description: "Patch version to release. example: 2.1.x (Use this only if n-1/n-2 patch is selected)" + required: false + type: string + repository_dispatch: + types: [auto-release-workflow] +jobs: + process-inputs: + name: Process Inputs + runs-on: ubuntu-latest + outputs: + processedVersion: ${{ steps.set-version.outputs.versionEnv }} + steps: + - name: Process input + id: set-version + shell: bash + run: | + echo "Triggered by: ${{ github.event_name }}" + if [[ "${{ github.event_name }}" == "repository_dispatch" ]]; then + echo "versionEnv=minor" >> $GITHUB_OUTPUT + exit 0 + fi + if [[ "${{ github.event.inputs.version }}" != "" && "${{ github.event.inputs.option }}" == "n-1/n-2 patch (Provide input in the below box)" ]]; then + # if both version and option are provided, then version takes precedence i.e. patch release for n-1/n-2 + echo "versionEnv=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT + exit 0 + fi + if [[ "${{ github.event.inputs.option }}" != "n-1/n-2 patch (Provide input in the below box)" ]]; then + # if only option is provided, then option takes precedence i.e. minor, major or patch release + echo "versionEnv=${{ github.event.inputs.option }}" >> $GITHUB_OUTPUT + exit 0 + fi + # if neither option nor version is provided, then minor release is taken by default (Auto-release) + echo "versionEnv=minor" >> $GITHUB_OUTPUT + csm-release: + needs: [process-inputs] + uses: dell/common-github-actions/.github/workflows/release-image.yaml@main + name: Release Image + with: + version: ${{ needs.process-inputs.outputs.processedVersion }} + images: 'csi-isilon' + secrets: inherit +``` ### csm-release-driver-module