forked from signalfx/splunk-otel-collector-chart
-
Notifications
You must be signed in to change notification settings - Fork 0
180 lines (159 loc) · 8.55 KB
/
update_chart_dependencies.yaml
File metadata and controls
180 lines (159 loc) · 8.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: Check for new chart dependency updates
# Description:
# This workflow automates the process of checking for and updating Helm chart dependencies.
# Specifically, it:
# 1. Checks for new versions of (subchart) dependencies listed in chart.yaml.
# 2. Updates chart.yaml with new versions where applicable.
# 3. Updates related values.yaml defaults when a subchart version bump requires it.
# 4. If the 'opentelemetry-operator' subchart is updated in chart.yaml, it also updates related
# image tags in values.yaml and CRD assets when needed.
on:
schedule:
# Run every Monday at noon.
- cron: "0 12 * * 1"
workflow_dispatch:
inputs:
DEBUG_MODE:
description: 'Enable debug mode'
required: false
default: 'false'
permissions:
contents: write
pull-requests: write
jobs:
check_and_update:
runs-on: ubuntu-latest
strategy:
fail-fast: false # Continue all jobs even if one fails
matrix:
# Chart dependencies to check for version updates
include:
- name: 'operator'
component: 'operator'
yaml_file_path: 'helm-charts/splunk-otel-collector/Chart.yaml'
dependency_name: 'opentelemetry-operator'
- name: 'obi'
component: 'chart'
yaml_file_path: 'helm-charts/splunk-otel-collector/Chart.yaml'
dependency_name: 'opentelemetry-ebpf-instrumentation'
env:
DEBUG_MODE: ${{ github.event.inputs.DEBUG_MODE }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Helm
uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 #v4
with:
version: v4.1.4
- name: Check for Version Updates
id: check_for_update
run: |
echo "Checking chart dependency version for ${{ matrix.name }}"
make update-chart-dep CHART_PATH=${{ matrix.yaml_file_path }} SUBCHART_NAME='${{ matrix.dependency_name }}' DEBUG_MODE="$DEBUG_MODE"
- name: Check for Operator CRD Updates
id: check_for_crd_update
if: ${{ matrix.name == 'operator' }}
run: |
make update-operator-crds DEBUG_MODE="$DEBUG_MODE"
- name: Install Skopeo
if: ${{ matrix.name == 'operator' }}
run: |
sudo apt-get update
sudo apt-get install -y skopeo
- name: Set PR message strings
id: pr_messages
if: ${{ steps.check_for_update.outputs.NEED_UPDATE == 1 || steps.check_for_crd_update.outputs.CRDS_NEED_UPDATE == 1 }}
run: |
NEED_UPDATE="${{ steps.check_for_update.outputs.NEED_UPDATE }}"
CRDS_UPDATE="${{ steps.check_for_crd_update.outputs.CRDS_NEED_UPDATE }}"
NAME="${{ matrix.name }}"
YAML_PATH="${{ matrix.yaml_file_path }}"
CURRENT_VER="${{ steps.check_for_update.outputs.CURRENT_VER }}"
LATEST_VER="${{ steps.check_for_update.outputs.LATEST_VER }}"
CRDS_VER="${{ steps.check_for_crd_update.outputs.CRDS_LATEST_VERSION }}"
CHART_TITLE="Bump $NAME from $CURRENT_VER to $LATEST_VER"
CHART_MSG="Update ${NAME} chart dependency version"
CHART_BODY="Use the latest version of ${NAME}"
if [ "$NEED_UPDATE" = "1" ] && [ "$CRDS_UPDATE" = "1" ]; then
title="${CHART_TITLE} and update operator CRDs"
commit_open="${CHART_MSG} and operator CRDs"
commit_finalize="${CHART_MSG} and operator CRDs"
body_open="${CHART_BODY} and update operator CRDs"
body_finalize="${CHART_BODY} and update operator CRDs to ${CRDS_VER} with schema regeneration"
elif [ "$NEED_UPDATE" = "1" ]; then
title="${CHART_TITLE} in ${YAML_PATH}"
commit_open="$CHART_MSG"
commit_finalize="$CHART_MSG"
body_open="$CHART_BODY"
body_finalize="$CHART_BODY"
else
title="Bump opentelemetry-operator-crds to $CRDS_VER"
commit_open="Update operator CRDs"
commit_finalize="Update operator CRDs and regenerate schemas"
body_open="Update operator CRDs"
body_finalize="Update operator CRDs to ${CRDS_VER} and regenerate schemas for kubeconform validation"
fi
{
echo "title=$title"
echo "commit_message_open=$commit_open"
echo "commit_message_finalize=$commit_finalize"
echo "body_open=$body_open"
echo "body_finalize=$body_finalize"
} >> "$GITHUB_OUTPUT"
[ "$NEED_UPDATE" = "1" ] && echo "chlog_note_chart=Bump ${NAME} to ${LATEST_VER} in ${YAML_PATH}" >> "$GITHUB_OUTPUT"
if [ "$CRDS_UPDATE" = "1" ]; then
CRDS_CHLOG="Bump subchart opentelemetry-operator-crds to ${CRDS_VER}. Refer to further [instructions](https://github.com/signalfx/splunk-otel-collector-chart/blob/main/helm-charts/splunk-otel-collector/charts/opentelemetry-operator-crds/README.md#upgrade-notes) for updating CRDs if using \`operatorcrds.install\` option."
{
echo "chlog_note_crds<<EOF"
echo "$CRDS_CHLOG"
echo "EOF"
} >> "$GITHUB_OUTPUT"
fi
- name: Open PR for Version Update
id: open_pr
if: ${{ steps.check_for_update.outputs.NEED_UPDATE == 1 || steps.check_for_crd_update.outputs.CRDS_NEED_UPDATE == 1 }}
uses: ./.github/actions/create-pr
with:
branch: update-${{ matrix.name }}
commit-message: ${{ steps.pr_messages.outputs.commit_message_open }}
title: ${{ steps.pr_messages.outputs.title }}
body: ${{ steps.pr_messages.outputs.body_open }}
author-name: ${{ github.event_name == 'schedule' && 'github-actions[bot]' || github.actor }}
author-email: ${{ github.event_name == 'schedule' && '41898282+github-actions[bot]@users.noreply.github.com' || format('{1}+{0}@users.noreply.github.com', github.actor, github.actor_id) }}
- name: Apply Version Update and Generate Changelog
if: ${{ steps.check_for_update.outputs.NEED_UPDATE == 1 }}
run: |
# Apply the version update, update the rendered examples with the version update, and create a changelog entry
# Re-run the update before rendering/changelog generation to keep derived files in sync.
make update-chart-dep CHART_PATH=${{ matrix.yaml_file_path }} SUBCHART_NAME='${{ matrix.dependency_name }}' DEBUG_MODE="$DEBUG_MODE"
make render
make chlog-new FILENAME="update-${{ matrix.name }}" CHANGE_TYPE=enhancement COMPONENT=${{ matrix.component }} NOTE="${{ steps.pr_messages.outputs.chlog_note_chart }}" ISSUES="[${{ steps.open_pr.outputs.pull-request-number }}]"
- name: Operator CRDs update
env:
COMPONENT: opentelemetry-operator-crds
if: ${{ steps.check_for_crd_update.outputs.CRDS_NEED_UPDATE == 1 }}
run: |
make update-operator-crds DEBUG_MODE="$DEBUG_MODE"
make render
make chlog-new FILENAME="update-operator-crds" CHANGE_TYPE=enhancement COMPONENT="$COMPONENT" NOTE="${{ steps.pr_messages.outputs.chlog_note_crds }}" ISSUES="[${{ steps.open_pr.outputs.pull-request-number }}]"
- name: Generate CRD Schemas for kubeconform
# Regenerate schemas when operator chart or operator-crds are updated
if: ${{ (steps.check_for_update.outputs.NEED_UPDATE == 1 && matrix.name == 'operator') || steps.check_for_crd_update.outputs.CRDS_NEED_UPDATE == 1 }}
run: |
make generate-crd-schemas
- name: Run pre-commit to fix formatting
if: ${{ steps.check_for_update.outputs.NEED_UPDATE == 1 || steps.check_for_crd_update.outputs.CRDS_NEED_UPDATE == 1 }}
run: |
pip install pre-commit==4.5.1
pre-commit run --all-files || true
env:
SKIP: actionlint,render,go-fmt,go-lint,go-mod-tidy
- name: Finalize PR with updates
if: ${{ steps.check_for_update.outputs.NEED_UPDATE == 1 || steps.check_for_crd_update.outputs.CRDS_NEED_UPDATE == 1 }}
uses: ./.github/actions/create-pr
with:
branch: update-${{ matrix.name }}
commit-message: ${{ steps.pr_messages.outputs.commit_message_finalize }}
title: ${{ steps.pr_messages.outputs.title }}
body: ${{ steps.pr_messages.outputs.body_finalize }}
author-name: ${{ github.event_name == 'schedule' && 'github-actions[bot]' || github.actor }}
author-email: ${{ github.event_name == 'schedule' && '41898282+github-actions[bot]@users.noreply.github.com' || format('{1}+{0}@users.noreply.github.com', github.actor, github.actor_id) }}