blob: 43ac4851dd8b82a0af71daee4637ef7b6866bad0 [file] [log] [blame]
Eric Ballf5a66792026-06-29 13:36:45 -07001---
2# SPDX-License-Identifier: Apache-2.0
3# Copyright 2026 The Linux Foundation
4
5name: voltha-helm-charts release
6
7# yamllint disable-line rule:truthy
8on:
9 workflow_dispatch:
10 push:
11 branches:
12 - master
13 - voltha-*
14
15permissions:
16 contents: write
17
18env:
19 PUBLISH_URL: "charts.lfbroadband.org"
20 OLD_REPO_DIR: "cord-charts-repo"
21 NEW_REPO_DIR: "chart_repo"
22 SYNC_TARGET_USER: "jenkins"
23 SYNC_TARGET_SERVER: "static.lfbroadband.org"
24
25jobs:
26 publish-helm-repo:
27 runs-on: ubuntu-latest
28 steps:
29 - name: Checkout charts source
30 # yamllint disable-line rule:line-length
31 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
32 with:
33 fetch-depth: 0
34
35 - name: Checkout published chart repository
36 # yamllint disable-line rule:line-length
37 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
38 with:
39 repository: opencord/cord-charts-repo
40 token: ${{ secrets.CORD_CHARTS_REPO_TOKEN }}
41 path: ${{ env.OLD_REPO_DIR }}
42 fetch-depth: 0
43
44 - name: Checkout helm-repo-tools
45 # yamllint disable-line rule:line-length
46 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
47 with:
48 repository: opencord/helm-repo-tools
49 path: helm-repo-tools
50
51 - name: Set up Helm
52 uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
53
54 - name: Add external Helm repositories
55 run: |
56 set -eu -o pipefail
57 helm repo add stable https://charts.helm.sh/stable
58 helm repo add rook-release https://charts.rook.io/release
59 helm repo add cord https://charts.lfbroadband.org
60 helm repo add elastic https://helm.elastic.co
61 helm repo add kiwigrid https://kokuwaio.github.io/helm-charts
62
63 - name: Build/update chart repository index
64 run: ./helm-repo-tools/helmrepo.sh
65
66 - name: Compute release version
67 id: version
68 run: echo "version=$(date -u +%Y%m%dT%H%M%SZ)" >> "$GITHUB_OUTPUT"
69
70 - name: Commit, tag and push updated chart repository
71 id: publish
72 # Only commits when helmrepo.sh actually added/updated packages, and
73 # pushes both the commit and the date-based tag.
74 # yamllint disable-line rule:line-length
75 uses: stefanzweifel/git-auto-commit-action@4a55954c782fc1ea30b9056cd3e7a2b40ca8887d # v7.2.0
76 with:
77 repository: ${{ env.OLD_REPO_DIR }}
78 commit_message: >-
79 Update helm chart repository
80 commit_options: "--signoff"
81 commit_user_name: "VOLTHA Bot"
82 commit_user_email: "do-not-reply@opennetworking.org"
83 tagging_message: ${{ steps.version.outputs.version }}
84
85 - name: Configure SSH access to static server
86 if: steps.publish.outputs.changes_detected == 'true'
87 env:
88 SSH_PRIVATE_KEY: ${{ secrets.STATIC_LFBB_JENKINS_SSH_KEY }}
89 run: |
90 set -eu
91 mkdir -p ~/.ssh
92 chmod 700 ~/.ssh
93 printf '%s\n' "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
94 chmod 600 ~/.ssh/id_rsa
95 ssh-keyscan -H "$SYNC_TARGET_SERVER" >> ~/.ssh/known_hosts 2>/dev/null
96
97 - name: Sync chart repository to static server
98 if: steps.publish.outputs.changes_detected == 'true'
99 run: |
100 set -eu -o pipefail
101 rsync -rvzh --delete-after --exclude=.git \
102 "${OLD_REPO_DIR}/" \
103 "${SYNC_TARGET_USER}@${SYNC_TARGET_SERVER}:/srv/sites/${PUBLISH_URL}/"