diff --git a/.github/configs/.licenserc.yaml b/.github/configs/.licenserc.yaml new file mode 100644 index 00000000..216a23c4 --- /dev/null +++ b/.github/configs/.licenserc.yaml @@ -0,0 +1,56 @@ +header: + license: + spdx-id: Apache-2.0 + copyright-owner: Dell Technologies + content: + /* + * + * Copyright © 2021-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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + pattern: + /* + * + * Copyright © 2021-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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + paths-ignore: + - 'dist' + - 'licenses' + - '**/*.md' + - 'LICENSE' + - 'NOTICE' + - '.github' + - '.gitignore' + - 'go.mod' + - 'go.sum' + - '.licenserc.yaml' + - '.git' + comment: on-failure + dependency: + files: + - go.mod # If this is a Go project. diff --git a/.github/workflows/check-license-header.yaml b/.github/workflows/check-license-header.yaml new file mode 100644 index 00000000..4fbf016f --- /dev/null +++ b/.github/workflows/check-license-header.yaml @@ -0,0 +1,54 @@ +# 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. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +# This workflow is used to check for license header in the source code. +name: Check License Header + +on: + workflow_call: +jobs: + check-license-header: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Get config + run: | + curl -L -o .licenserc.yaml https://raw.githubusercontent.com/dell/common-github-actions/refs/heads/feature/license-validation/.github/configs/.licenserc.yaml + + - name: Check License Header + uses: apache/skywalking-eyes/header@main + with: + config: .licenserc.yaml + mode: check + + fix-license-headers: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Get config + run: | + curl -L -o .licenserc.yaml https://raw.githubusercontent.com/dell/common-github-actions/refs/heads/feature/license-validation/.github/configs/.licenserc.yaml + + - name: Fix License Header + uses: apache/skywalking-eyes/header@main + with: + config: .licenserc.yaml + mode: fix + - name: Cleanup + run: | + rm -rf .licenserc.yaml + + - name: Commit changes + uses: EndBug/add-and-commit@v4 + with: + author_name: License Bot + author_email: license_bot@github.com + message: "Automatic application of license header" diff --git a/.github/workflows/csm-release-driver-module.yaml b/.github/workflows/csm-release-driver-module.yaml index 76c02e31..cef3531f 100644 --- a/.github/workflows/csm-release-driver-module.yaml +++ b/.github/workflows/csm-release-driver-module.yaml @@ -36,7 +36,7 @@ jobs: go-version: "1.24" - name: Install dependencies run: go mod tidy - - name: Build binaries + - name: Build binaries run: | echo "Building binaries to attach to the release if any..." if "${{ inputs.images == 'cert-csi' }}"; then @@ -69,7 +69,9 @@ jobs: version: ${{ inputs.version }} secrets: inherit + # we will not going to push images to dockerhub and quay for the patch release as we do not have the image to be retagged, The developers has to build and push it manually to the repository push-images: + if: ${{ inputs.version == 'patch' || inputs.version == 'minor' || inputs.version == 'major' }} name: Release images to Dockerhub and Quay needs: release-and-tag runs-on: ubuntu-latest @@ -88,7 +90,7 @@ jobs: echo "Current latest version of $image:$latest_version" IFS='.' read -r -a version_parts <<< "$latest_version" - + if "${{ inputs.version == 'major' }}"; then # major version bump up version_parts[0]=$(expr ${version_parts[0]} + 1) @@ -104,7 +106,7 @@ jobs: version_parts[2]=$(expr ${version_parts[2]} + 1) new_version="${version_parts[0]}.${version_parts[1]}.${version_parts[2]}" fi - + echo "Pushing image: $image:$new_version" docker pull dellemc/$image:nightly docker tag dellemc/$image:nightly dellemc/$image:$new_version @@ -118,16 +120,16 @@ jobs: run: | # Push each comma seperated images by splitting the string with ',' images_list=$(echo '${{ inputs.images }}' | tr -d '[]"' | tr ',' ' ') - + REPOSITORY="dell/container-storage-modules" 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 # major version bump up version_parts[0]=$(expr ${version_parts[0]} + 1) @@ -143,7 +145,7 @@ jobs: version_parts[2]=$(expr ${version_parts[2]} + 1) new_version="${version_parts[0]}.${version_parts[1]}.${version_parts[2]}" fi - + # Get manifest digest 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" @@ -155,7 +157,7 @@ jobs: --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 }}' \ diff --git a/.github/workflows/release-creator.yaml b/.github/workflows/release-creator.yaml index b70efd4a..163c9a7b 100644 --- a/.github/workflows/release-creator.yaml +++ b/.github/workflows/release-creator.yaml @@ -14,7 +14,7 @@ on: workflow_call: inputs: version: - description: 'Semantic version to release. Ex: major, minor, or patch' + description: "Semantic version to release. Ex: major, minor, or patch" required: true type: string jobs: @@ -28,13 +28,22 @@ jobs: fetch-depth: 0 # Fetch the full history including tags ref: ${{ github.ref }} # Checkout the branch from which the workflow is triggered + # we will set the release version based on the user given input for older patch releases only ex: n-1, n-2 + - name: Set release version + if: ${{ inputs.version != 'patch' || inputs.version != 'minor' || inputs.version != 'major' }} + run: | + echo "REL_VERSION=v${{ inputs.version }}" >> $GITHUB_ENV + + # we will auto bump up the version if it is only patch, minor, or major else we will just use the user given input - name: Get latest release + if: ${{ inputs.version == 'patch' || inputs.version == 'minor' || inputs.version == 'major' }} run: | - latest_version=$(git describe --tags $(git rev-list --tags --max-count=1)) + latest_version=$(curl -s https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/latest | jq -r .tag_name) echo "MY_VAR=${latest_version}" >> $GITHUB_ENV echo "latest_version=${latest_version}" - name: Increment version + if: ${{ inputs.version == 'patch' || inputs.version == 'minor' || inputs.version == 'major' }} env: MY_VAR: ${{ env.MY_VAR }} run: | diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b81..00000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/common-github-actions.iml b/.idea/common-github-actions.iml deleted file mode 100644 index 5e764c4f..00000000 --- a/.idea/common-github-actions.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 372f7846..00000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1ddf..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/README.md b/README.md index 351806bb..b92199ae 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,9 @@ jobs: common: name: Quality Checks uses: dell/common-github-actions/.github/workflows/go-common.yml@main + check-license-header: + name: Check License Header + uses: dell/common-github-actions/.github/workflows/check-license-header.yaml@main ``` ### csm-release-driver-module @@ -162,7 +165,11 @@ on: # yamllint disable-line rule:truthy - 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 jobs: csm-release: uses: dell/common-github-actions/.github/workflows/csm-release-driver-module.yaml@main