-
Notifications
You must be signed in to change notification settings - Fork 4
Move workflows to .github, add helper actions #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| <!-- | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: 2025 The Linux Foundation | ||
| --> | ||
|
|
||
| # ⬆️ Create Github Release Action | ||
|
|
||
| This action creates a new release in the calling repo using the provided version. | ||
|
|
||
| ## Usage Example | ||
|
|
||
| ```yaml | ||
| steps: | ||
| - name: Create Github release | ||
| uses: onos-project/.github/.github/actions/create-github-release-action@main | ||
| with: | ||
| version: ${{ steps.version-change.outputs.version }} | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GH_ONOS_PAT }} | ||
| ``` | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Variable Name | Required | Description | | ||
| | ------------- | -------- | ------------ | | ||
| | VERSION | True | Version to release on Github | | ||
|
|
||
| ## Outputs | ||
|
|
||
| | Variable Name | Description | | ||
| | ------------- | ------------- | | ||
| | None | | | ||
|
|
||
| ## Notes | ||
|
|
||
| This uses the built-in `gh` CLI. A GH_TOKEN with proper permissions should be | ||
| included in the env. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: 2025 The Linux Foundation | ||
|
|
||
| name: "Create Github release" | ||
|
|
||
| inputs: | ||
| VERSION: | ||
| description: "Version to release on Github" | ||
| type: string | ||
| required: true | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: "Create Github release" | ||
| shell: bash | ||
| run: | | ||
| if gh release create "${{ inputs.VERSION }}" --generate-notes; then | ||
| echo "Release ${{ inputs.VERSION }} created ✅" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "Release ${{ inputs.VERSION }} created ✅" | ||
| else | ||
| echo "Failed to create release ${{ inputs.VERSION }} ❌" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "Failed to create release ${{ inputs.VERSION }} ❌" | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| --- | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: 2025 The Linux Foundation | ||
|
|
||
| name: "Find all Helm charts" | ||
|
|
||
| inputs: | ||
| COMPARISON_BRANCH: | ||
| description: "Branch to compare current code with" | ||
| required: false | ||
| default: "master" | ||
|
|
||
| outputs: | ||
| CHARTS: | ||
| description: "List of charts that have changed from master" | ||
| value: ${{ steps.find_charts.outputs.charts }} | ||
| CHARTS_JSON: | ||
| description: "Json-formatted list of charts that have changed from master" | ||
| value: ${{ steps.find_charts.outputs.charts_json }} | ||
|
|
||
| runs: | ||
| using: "composite" | ||
eb-oss marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| steps: | ||
| - name: "Find all helm charts in repo" | ||
| id: find_charts | ||
| shell: bash | ||
| run: | | ||
| export COMPARISON_BRANCH=${{ inputs.COMPARISON_BRANCH }} | ||
| echo "charts_json=$(${{ github.action_path }}/version_check.sh get_changed_charts | jq -R | jq -sc)" >> $GITHUB_OUTPUT | ||
| echo 'charts<<EOF' >> $GITHUB_OUTPUT | ||
| ${{ github.action_path }}/version_check.sh get_changed_charts | ||
| echo 'EOF' >> $GITHUB_OUTPUT | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| --- | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: 2025 The Linux Foundation | ||
|
|
||
| name: "Get chart version" | ||
|
|
||
| inputs: | ||
| CHART_PATH: | ||
| description: "Path to chart to check" | ||
| required: true | ||
|
|
||
| outputs: | ||
| VERSION: | ||
| description: "Version of given chart" | ||
| value: ${{ steps.get_version.outputs.version }} | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Setup yq | ||
| uses: vegardit/gha-setup-yq@v1 | ||
| - name: "Get version of chart" | ||
| id: get_version | ||
| shell: bash | ||
| # yamllint disable-line rule:line-length | ||
| run: echo "version=$(yq e '.version' ${{ inputs.CHART_PATH }})" >> $GITHUB_OUTPUT |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # Copyright 2025 The Linux Foundation | ||
| # SPDX-FileCopyrightText: 2025 Intel Corporation | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| name: Bump Version | ||
| # Calling workflow should include "secrets: inherit" | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| version: | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| bump-version: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: increment version | ||
| run: | | ||
| IFS='.' read -r major minor patch <<< ${{ inputs.version }} | ||
| patch_update=$((patch+1)) | ||
| NEW_VERSION="$major.$minor.$patch_update-dev" | ||
| echo $NEW_VERSION > VERSION | ||
| echo "Updated version: $NEW_VERSION" | ||
|
|
||
| - name: Create Pull Request | ||
| uses: peter-evans/create-pull-request@v7 | ||
| with: | ||
| token: ${{ secrets.GH_ONOS_PAT }} | ||
| commit-message: Update version | ||
| committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | ||
| signoff: true | ||
| branch: version-update | ||
| delete-branch: true | ||
| title: Update version | ||
| body: | | ||
| Update VERSION file | ||
| add-paths: | | ||
| VERSION |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # Copyright 2025 Canonical Ltd. | ||
| name: Fossa Scan | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| branch_name: | ||
| description: "Name of the branch to checkout" | ||
| required: false | ||
| type: string | ||
| default: ${{ github.ref }} | ||
|
|
||
| jobs: | ||
| fossa-scan: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ inputs.branch_name }} | ||
|
|
||
| - name: FOSSA scan | ||
| uses: fossa-contrib/fossa-action@v3 | ||
| with: | ||
| fossa-api-key: 6d304c09a3ec097ba4517724e4a4d17d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # Copyright 2025 Canonical Ltd. | ||
| name: Lint Helm Charts | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| jobs: | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Helm | ||
| uses: azure/setup-helm@v4 | ||
| with: | ||
| version: latest | ||
|
|
||
| - name: Find all Charts and Lint them | ||
| run: | | ||
| for dir in $(find . -maxdepth 1 -mindepth 1 -type d); do | ||
| if [[ -f "$dir/Chart.yaml" ]]; then | ||
| helm lint "$dir" | ||
| fi | ||
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| # Copyright 2025 Canonical Ltd. | ||
| # Copyright 2025 The Linux Foundation | ||
| # SPDX-FileCopyrightText: 2025 Intel Corporation | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| name: Publish Helm Charts with Umbrella Chart | ||
| # Calling workflow should include "secrets: inherit" | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| charts_repo_url: | ||
| description: "URL for the helm repository to push to" | ||
| required: false | ||
| type: string | ||
| default: https://charts.aetherproject.org | ||
| umbrella_charts: | ||
| description: "Directory containing the umbrella chart(s)" | ||
| required: true | ||
| type: string | ||
| remote_host: | ||
| description: "Address for host to sync charts to" | ||
| required: true | ||
| type: string | ||
| remote_path: | ||
| description: "Path on remote_host where charts should be stored" | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| CHARTS_DIR: charts | ||
| REF_CHARTS_DIR: charts-ref | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Helm | ||
| uses: azure/setup-helm@v4 | ||
| with: | ||
| version: latest | ||
|
|
||
| - name: Get current Index.yaml | ||
| run: | | ||
| rm -rf ${{ env.REF_CHARTS_DIR }} && mkdir -p ${{ env.REF_CHARTS_DIR }} | ||
| curl -o ${{ env.REF_CHARTS_DIR }}/index.yaml ${{ inputs.charts_repo_url }}/index.yaml | ||
|
|
||
| - name: Find all Charts and Package them | ||
| run: | | ||
| rm -rf ${{ env.CHARTS_DIR }} && mkdir -p ${{ env.CHARTS_DIR }} | ||
| for dir in $(find . -maxdepth 1 -mindepth 1 -type d); do | ||
| if [[ -f "$dir/Chart.yaml" ]] && [[ "$dir" != ${{ inputs.umbrella_charts }} ]]; then | ||
| echo "Packaging charts for: $dir" | ||
| helm dependency update "$dir" | ||
| helm package "$dir" --destination ${{ env.CHARTS_DIR }} | ||
| fi | ||
| done | ||
| helm repo index ${{ env.CHARTS_DIR }} --url ${{ inputs.charts_repo_url }} --merge ${{ env.REF_CHARTS_DIR }}/index.yaml | ||
|
|
||
| - name: Remove not "updated" local Charts (version has not changed) | ||
| working-directory: ${{ env.CHARTS_DIR }} | ||
| run: | | ||
| for file in *.tgz; do | ||
| if grep -q "${{ inputs.charts_repo_url }}/$file" "../${{ env.REF_CHARTS_DIR }}/index.yaml"; then | ||
| echo "Not publishing $file because it is already in ${{ inputs.charts_repo_url }}/index.yaml" | ||
| rm $file | ||
| fi | ||
| done | ||
|
|
||
| - name: rsync deployments | ||
| uses: burnett01/rsync-deployments@7.0.1 | ||
| with: | ||
| switches: -avh | ||
| path: ${{ env.CHARTS_DIR }}/ | ||
| remote_path: ${{ inputs.remote_path }} | ||
| remote_host: ${{ inputs.remote_host }} | ||
| remote_user: ${{ secrets.JENKINS_USERNAME }} | ||
| remote_key: ${{ secrets.JENKINS_SSHKEY }} | ||
| remote_key_pass: ${{ secrets.JENKINS_PASSPHRASE }} | ||
|
|
||
| - name: Get current Index.yaml | ||
| run: | | ||
| rm -rf ${{ env.REF_CHARTS_DIR }} && mkdir -p ${{ env.REF_CHARTS_DIR }} | ||
| curl -o ${{ env.REF_CHARTS_DIR }}/index.yaml ${{ inputs.charts_repo_url }}/index.yaml | ||
|
|
||
| - name: Find all Charts and Package them | ||
| run: | | ||
| rm -rf ${{ env.CHARTS_DIR }} && mkdir -p ${{ env.CHARTS_DIR }} | ||
| echo "Packaging charts for: ${{ inputs.umbrella_charts }}" | ||
| helm dependency update "${{ inputs.umbrella_charts }}" | ||
| helm package "${{ inputs.umbrella_charts }}" --destination ${{ env.CHARTS_DIR }} | ||
| helm repo index ${{ env.CHARTS_DIR }} --url ${{ inputs.charts_repo_url }} --merge ${{ env.REF_CHARTS_DIR }}/index.yaml | ||
|
|
||
| - name: rsync deployments | ||
| uses: burnett01/rsync-deployments@7.0.1 | ||
| with: | ||
| switches: -avh | ||
| path: ${{ env.CHARTS_DIR }}/ | ||
| remote_path: ${{ inputs.remote_path }} | ||
| remote_host: ${{ inputs.remote_host }} | ||
| remote_user: ${{ secrets.JENKINS_USERNAME }} | ||
| remote_key: ${{ secrets.JENKINS_SSHKEY }} | ||
| remote_key_pass: ${{ secrets.JENKINS_PASSPHRASE }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # Copyright 2025 Canonical Ltd. | ||
| name: License Check | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| branch_name: | ||
| description: "Name of the branch to checkout" | ||
| required: false | ||
| type: string | ||
| default: ${{ github.ref }} | ||
|
|
||
| jobs: | ||
| license-check: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ inputs.branch_name }} | ||
|
|
||
| - name: reuse lint | ||
| uses: fsfe/reuse-action@v5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # SPDX-FileCopyrightText: 2025 Intel Corporation | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| on: | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| push: | ||
| branches: | ||
| - master | ||
|
|
||
| jobs: | ||
| license-check: | ||
| uses: ./.github/workflows/license-check.yml | ||
| with: | ||
| branch_name: ${{ github.ref }} | ||
|
|
||
| fossa-scan: | ||
| uses: ./.github/workflows/fossa-scan.yml | ||
| with: | ||
| branch_name: ${{ github.ref }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.