Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/actions/create-github-release-action/README.md
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.
25 changes: 25 additions & 0 deletions .github/actions/create-github-release-action/action.yml
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
32 changes: 32 additions & 0 deletions .github/actions/find-all-charts-action/action.yml
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"
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
4 changes: 2 additions & 2 deletions workflows/version_check.sh → ...s/find-all-charts-action/version_check.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright 2024 Intel Corporation
# Copyright 2024 The Linux Foundation

INPUT=$1

Expand Down Expand Up @@ -65,7 +66,7 @@ function is_unique_version() {
}

case $INPUT in
all)
check_unique)
is_unique_version
;;

Expand All @@ -78,4 +79,3 @@ case $INPUT in
exit 2
;;
esac

26 changes: 26 additions & 0 deletions .github/actions/get-chart-version-action/action.yml
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.
42 changes: 42 additions & 0 deletions .github/workflows/bump-version.yml
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.
25 changes: 25 additions & 0 deletions .github/workflows/fossa-scan.yml
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
26 changes: 26 additions & 0 deletions .github/workflows/helm-lint.yml
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
103 changes: 103 additions & 0 deletions .github/workflows/helm-publish-umbrella.yml
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 }}
23 changes: 23 additions & 0 deletions .github/workflows/license-check.yml
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
20 changes: 20 additions & 0 deletions .github/workflows/main.yml
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 }}
Loading