Skip to content

Commit b28f99a

Browse files
committed
Add new workflows, modify helm release and tag
These changes were made while rolling out reusable workflows to all onosproject repos. All regularly-deployed workflows are supported. Signed-off-by: Eric Ball <eball@linuxfoundation.org>
1 parent 1f1e19f commit b28f99a

File tree

10 files changed

+313
-30
lines changed

10 files changed

+313
-30
lines changed

.github/workflows/docker-build.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright 2025 Canonical Ltd.
3+
name: Docker Build
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
branch_name:
9+
description: "Name of the branch to checkout"
10+
required: false
11+
type: string
12+
default: ${{ github.ref }}
13+
build_directory:
14+
description: "Directory where to run the build command from"
15+
required: false
16+
type: string
17+
default: '.'
18+
make_target:
19+
description: "Makefile target to build"
20+
required: false
21+
type: string
22+
default: "docker-build"
23+
24+
jobs:
25+
docker-build:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
ref: ${{ inputs.branch_name }}
31+
32+
- name: Build Docker image
33+
run: |
34+
cd ${{ inputs.build_directory }}
35+
make ${{ inputs.make_target }}

.github/workflows/docs-publish.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright 2025 The Linux Foundation
2+
# SPDX-FileCopyrightText: 2025 Intel Corporation
3+
# SPDX-License-Identifier: Apache-2.0
4+
name: Publish Documents
5+
# Calling workflow should include "secrets: inherit"
6+
7+
on:
8+
workflow_call:
9+
inputs:
10+
remote_host:
11+
description: "Address for host to sync charts to"
12+
required: true
13+
type: string
14+
remote_path:
15+
description: "Path on remote_host where charts should be stored"
16+
required: true
17+
type: string
18+
19+
jobs:
20+
publish:
21+
runs-on: ubuntu-latest
22+
env:
23+
BUILD_OUTPUT_PATH: _build/multiversion/
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Set up Python
30+
uses: actions/setup-python@v5
31+
with:
32+
python-version: 3.11
33+
34+
- name: Build docs
35+
run: make multiversion
36+
37+
- name: List built files
38+
run: ls $BUILD_OUTPUT_PATH*
39+
40+
- name: rsync deployments
41+
uses: burnett01/rsync-deployments@7.0.1
42+
with:
43+
switches: -rvzh --delete-after --exclude=.git
44+
path: ${{ env.BUILD_OUTPUT_PATH }}
45+
remote_path: ${{ inputs.remote_path }}
46+
remote_host: ${{ inputs.remote_host }}
47+
remote_user: ${{ secrets.JENKINS_USERNAME }}
48+
remote_key: ${{ secrets.JENKINS_SSHKEY }}
49+
remote_key_pass: ${{ secrets.JENKINS_PASSPHRASE }}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2025 The Linux Foundation
2+
# SPDX-FileCopyrightText: 2025 Intel Corporation
3+
# SPDX-License-Identifier: Apache-2.0
4+
name: Build and Test Go
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
go-mod-path:
10+
required: false
11+
type: string
12+
default: "go.mod"
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-go@v5
20+
with:
21+
go-version-file: ${{ inputs.go-mod-path }}
22+
- name: build
23+
run: make build
24+
25+
test:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: actions/setup-go@v5
30+
with:
31+
go-version-file: 'go.mod'
32+
- name: Unit tests
33+
run: make unit-test || make test
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright 2025 The Linux Foundation
2+
# SPDX-FileCopyrightText: 2025 Intel Corporation
3+
# SPDX-License-Identifier: Apache-2.0
4+
name: Get All Go Modules
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
go-dir:
10+
description: "Location of Go modules to enumerate"
11+
required: false
12+
default: "."
13+
outputs:
14+
modules:
15+
description: "Go modules in the current repo"
16+
value: $ {{ jobs.get-modules.outputs.modules }}
17+
18+
jobs:
19+
get-modules:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: create release using REST API
27+
run: |
28+
echo "modules=$(find ${{ inputs.go-dir }} -name go.mod | jq -R | jq -sc)" >> $GITHUB_OUTPUT

.github/workflows/go-lint.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright 2025 Canonical Ltd.
3+
name: Lint Go Code
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
build_directory:
9+
description: "Directory where to run the lint command from"
10+
required: false
11+
type: string
12+
default: '.'
13+
14+
jobs:
15+
lint:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: actions/setup-go@v5
21+
with:
22+
go-version-file: 'go.mod'
23+
cache: true
24+
25+
- name: Run golangci-lint
26+
uses: golangci/golangci-lint-action@v7.0.0
27+
with:
28+
version: latest
29+
args: -v --config ./.golangci.yml
30+
working-directory: ${{ inputs.build_directory }}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# SPDX-FileCopyrightText: 2025 The Linux Foundation
2+
# SPDX-License-Identifier: Apache-2.0
3+
name: Golang Version Check
4+
# Calling workflow should include "secrets: inherit"
5+
6+
on:
7+
workflow_call:
8+
outputs:
9+
dev_version:
10+
description: "The version for the release"
11+
value: ${{ jobs.version-check.outputs.dev_version }}
12+
target_version:
13+
description: "The version for the release"
14+
value: ${{ jobs.version-check.outputs.target_version }}
15+
16+
jobs:
17+
version-check:
18+
if: (github.repository_owner == 'onosproject')
19+
runs-on: ubuntu-latest
20+
outputs:
21+
dev_version: ${{ steps.dev-version-check-step.outputs.dev_version }}
22+
target_version: ${{ steps.get-target-version-step.outputs.target_version }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: check dev version
29+
id: dev-version-check-step
30+
run: |
31+
if [[ $(cat VERSION | tr -d '\n' | tail -c 4) =~ "-dev" ]]; then
32+
echo "dev_version=true" >> $GITHUB_OUTPUT
33+
else
34+
echo "dev_version=false" >> $GITHUB_OUTPUT
35+
fi
36+
37+
- name: get target version
38+
id: get-target-version-step
39+
run: |
40+
echo "target_version=$(cat VERSION)" >> $GITHUB_OUTPUT
41+
42+
- name: check version
43+
id: version-check-step
44+
run: |
45+
# check if version format is matched to SemVer
46+
VER_REGEX='^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$'
47+
if [[ ! $(cat VERSION | tr -d '\n' | sed s/-dev//) =~ $VER_REGEX ]]; then
48+
exit 1
49+
fi
50+
exit 0

.github/workflows/release-helm-charts.yml

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,24 @@
55
# Copyright 2025 The Linux Foundation
66

77
name: Publish image and tag/release code
8+
# Calling workflow should include "secrets: inherit"
89

910
# yamllint disable-line rule:truthy
1011
on:
1112
workflow_call:
1213
inputs:
13-
CHARTS_REPO_URL:
14-
description: "Repo URL to push charts to"
14+
charts_repo_url:
15+
description: "URL for the helm repository to push to"
1516
required: false
1617
type: string
17-
UMBRELLA_CHART:
18-
description: "The repository's umbrella chart, if applicable"
19-
required: false
20-
type: string
21-
RSYNC_REMOTE_HOST:
22-
description: "The remote host to sync charts to"
23-
required: false
18+
default: https://charts.aetherproject.org
19+
remote_host:
20+
description: "Address for host to sync charts to"
21+
required: true
2422
type: string
25-
RSYNC_REMOTE_PATH:
26-
description: "The path on the remote host to sync charts to"
27-
required: false
23+
remote_path:
24+
description: "Path on remote_host where charts should be stored"
25+
required: true
2826
type: string
2927

3028
jobs:
@@ -81,18 +79,7 @@ jobs:
8179
version: ${{ steps.version-change.outputs.version }}
8280

8381
version-check:
84-
runs-on: ubuntu-latest
85-
steps:
86-
- uses: actions/checkout@v4
87-
with:
88-
fetch-depth: 0
89-
- name: Setup yq
90-
uses: vegardit/gha-setup-yq@v1
91-
- name: Check all changed charts have unique versions
92-
id: version-change
93-
run: |
94-
export COMPARISON_BRANCH=${{ github.event.before }}
95-
${{ github.action_path }}/version_check.sh check_unique
82+
uses: onosproject/.github/.github/workflows/version-check.yml@main
9683

9784
tag-versions:
9885
runs-on: ubuntu-latest
@@ -138,7 +125,6 @@ jobs:
138125
- name: Publish all changed charts
139126
# yamllint disable rule:line-length
140127
run: |
141-
export COMPARISON_BRANCH=${{ github.event.before }}
142128
target_charts=${{ steps.get-charts.outputs.charts }}
143129
rm -rf staging && mkdir -p staging/${{ github.repository }}
144130
while IFS= read -r tc
@@ -148,8 +134,8 @@ jobs:
148134
helm package $tc --destination staging/${{ github.repository }}/$tc
149135
done <<< $target_charts
150136
cd staging
151-
curl -o current-index.yaml ${{ inputs.CHARTS_REPO_URL }}/index.yaml
152-
helm repo index ${{ github.repository }} --url ${{ inputs.CHARTS_REPO_URL }}/${{ github.repository }} --merge current-index.yaml
137+
curl -o current-index.yaml ${{ inputs.charts_repo_url }}/index.yaml
138+
helm repo index ${{ github.repository }} --url ${{ inputs.charts_repo_url }}/${{ github.repository }} --merge current-index.yaml
153139
rm -rf current-index.yaml
154140
mv ${{ github.repository }}/index.yaml .
155141
cd ..
@@ -160,8 +146,8 @@ jobs:
160146
with:
161147
switches: -rvzh
162148
path: staging/
163-
remote_path: ${{ inputs.RSYNC_REMOTE_PATH }}
164-
remote_host: ${{ inputs.RSYNC_REMOTE_HOST }}
149+
remote_path: ${{ inputs.remote_path }}
150+
remote_host: ${{ inputs.remote_host }}
165151
remote_user: ${{ secrets.JENKINS_USERNAME }}
166152
remote_key: ${{ secrets.JENKINS_SSHKEY }}
167153
remote_key_pass: ${{ secrets.JENKINS_PASSPHRASE }}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright 2025 Canonical Ltd.
2+
# SPDX-FileCopyrightText: 2025 Intel Corporation
3+
# SPDX-License-Identifier: Apache-2.0
4+
name: Release Image
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
docker_tag:
10+
required: false
11+
type: string
12+
default: "latest"
13+
type: string
14+
docker_registry:
15+
description: "Docker Registry URL"
16+
default: "docker.io"
17+
type: string
18+
docker_repository:
19+
description: "Docker Repository"
20+
default: "onosproject/"
21+
type: string
22+
23+
jobs:
24+
release-image:
25+
runs-on: ubuntu-latest
26+
env:
27+
DOCKER_TAG: ${{ inputs.docker_tag }}
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- uses: actions/setup-go@v5
32+
with:
33+
go-version-file: 'go.mod'
34+
cache: true
35+
36+
- name: Login to Docker Registry
37+
uses: docker/login-action@v3.4.0
38+
with:
39+
registry: ${{ inputs.docker_registry }}
40+
username: ${{ secrets.DOCKERHUB_USERNAME }}
41+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
42+
43+
- name: Build and Push to Docker Registry
44+
env:
45+
DOCKER_REGISTRY: ${{ inputs.docker_registry }}/
46+
DOCKER_REPOSITORY: ${{ inputs.docker_repository }}
47+
run: |
48+
make docker-build
49+
make docker-push

.github/workflows/tag-github.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616

1717
jobs:
1818
tag-github:
19+
if: github.repository_owner == 'onosproject'
1920
runs-on: ubuntu-latest
2021
outputs:
2122
changed: ${{ steps.version-change.outputs.changed }}
@@ -50,7 +51,7 @@ jobs:
5051
5152
- name: Create Github release
5253
if: steps.version-change.outputs.changed == 'true'
53-
uses: onos-project/.github/.github/actions/create-github-release-action@main
54+
uses: onosproject/.github/.github/actions/create-github-release-action@main
5455
with:
5556
version: ${{ steps.version-change.outputs.version }}
5657
env:

0 commit comments

Comments
 (0)