Skip to content

Commit 1ea5125

Browse files
authored
Merge branch 'main' into deprecate/loki-canary
2 parents 6473c07 + 06629a0 commit 1ea5125

File tree

186 files changed

+4073
-389
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+4073
-389
lines changed

.github/CODEOWNERS

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@
66
# Unless a later match takes precedence, they will be requested for review when someone opens a pull request.
77
* @grafana/helm-charts-admins
88

9-
/charts/grafana/ @jkroepke @maorfr @torstenwalter @Xtigyro @zanhsieh
9+
/charts/grafana/ @jkroepke @maorfr @torstenwalter @Xtigyro @zanhsieh @QuentinBisson
1010
/charts/loki-distributed/ @grafana/loki-squad @unguiculus @Whyeasy
1111
/charts/loki-canary/ @grafana/loki-squad @unguiculus @Whyeasy
1212
/charts/promtail/ @grafana/loki-squad @unguiculus @Whyeasy
1313
/charts/tempo/ @grafana/tempo @Sheikh-Abubaker @dgzlopes @swartz-k @BitProcessor @faustodavid
14-
/charts/tempo-distributed/ @grafana/tempo @Sheikh-Abubaker @mapno @swartz-k @BitProcessor @faustodavid
14+
/charts/tempo-distributed/ @grafana/tempo @Sheikh-Abubaker @swartz-k @BitProcessor @faustodavid @QuentinBisson
1515
/charts/enterprise-metrics/ @grafana/mimir-maintainers
1616
/charts/rollout-operator/ @grafana/mimir-maintainers
1717
/charts/enterprise-logs/ @grafana/loki-squad
1818
/charts/tempo-vulture/ @grafana/tempo @Whyeasy @dgzlopes
1919
/charts/synthetic-monitoring-agent/ @torstenwalter @zanhsieh
2020
/charts/agent-operator/ @grafana/grafana-agent-maintainers
21+
/charts/cloudcost-exporter/ @grafana/platform-monitoring
22+
/charts/grafana-mcp/ @jkroepke @Sheikh-Abubaker @KyriosGN0 @QuentinBisson
23+
/charts/pdc-agent/ @grafana/grafana-datasources-core-services

.github/workflows/check-codeowners.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ on: workflow_call
44

55
jobs:
66
build:
7-
runs-on: ubuntu-20.04
7+
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v4
10+
with:
11+
persist-credentials: false
1012
- name: install yq
1113
run: |
1214
sudo snap install yq

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: CI
22

33
on: pull_request
44

5+
permissions: {}
6+
57
jobs:
68
call-check-codeowners:
79
uses: ./.github/workflows/check-codeowners.yaml

.github/workflows/lint-test.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ on:
2929

3030
env:
3131
CT_CONFIGFILE: ${{ inputs.ct_configfile }}
32+
CT_CHECK_VERSION_INCREMENT: ${{ inputs.ct_check_version_increment }}
3233

3334
jobs:
3435
lint-test:
@@ -38,9 +39,10 @@ jobs:
3839
uses: actions/checkout@v4
3940
with:
4041
fetch-depth: 0
42+
persist-credentials: false
4143

4244
- name: Set up Helm
43-
uses: azure/setup-helm@v4
45+
uses: azure/setup-helm@b9e51907a09c216f16ebe8536097933489208112 # v4.3.0
4446
with:
4547
version: ${{ inputs.helm_version }}
4648

@@ -52,7 +54,7 @@ jobs:
5254
python-version: 3.12
5355

5456
- name: Set up chart-testing
55-
uses: helm/chart-testing-action@v2.1.0
57+
uses: helm/chart-testing-action@0d28d3144d3a25ea2cc349d6e59901c4ff469b3b # v2.7.0
5658

5759
- name: Run chart-testing (list-changed)
5860
id: list-changed
@@ -63,10 +65,10 @@ jobs:
6365
fi
6466
6567
- name: Run chart-testing (lint)
66-
run: ct lint --config "${CT_CONFIGFILE}" --check-version-increment=${{ inputs.ct_check_version_increment }}
68+
run: ct lint --config "${CT_CONFIGFILE}" --check-version-increment="${CT_CHECK_VERSION_INCREMENT}"
6769

6870
- name: Create kind cluster
69-
uses: helm/[email protected]
71+
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0
7072
if: steps.list-changed.outputs.changed == 'true'
7173
with:
7274
kubectl_version: ${{ inputs.kind_kubectl_version }}
@@ -98,5 +100,8 @@ jobs:
98100
elif [[ "$changed" == "charts/snyk-exporter" ]]; then
99101
# Do not run `ct install` for snyk-exporter as it requires Snyk API token
100102
exit 0
103+
elif [[ "$changed" == "charts/cloudcost-exporter" ]]; then
104+
# Do not run `ct install` for cloudcost-exporter as it requires IRSA
105+
exit 0
101106
fi
102107
ct install --config "${CT_CONFIGFILE}"

.github/workflows/linter.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
steps:
2020
- name: Checkout Code
2121
uses: actions/checkout@v4
22+
with:
23+
persist-credentials: false
2224

2325
- name: Check Docs
2426
run: |

.github/workflows/release.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ jobs:
1818
uses: actions/checkout@v4
1919
with:
2020
fetch-depth: 0
21+
persist-credentials: false
2122

2223
- name: Configure Git
2324
run: |
2425
git config user.name "$GITHUB_ACTOR"
2526
git config user.email "[email protected]"
2627
2728
- name: Set up Helm
28-
uses: azure/setup-helm@v4
29+
uses: azure/setup-helm@b9e51907a09c216f16ebe8536097933489208112 # v4.3.0
2930
with:
3031
version: v3.12.0
3132

@@ -39,7 +40,7 @@ jobs:
3940
helm repo add minio-new https://charts.min.io
4041
4142
- name: Run chart-releaser
42-
uses: helm/[email protected]
43+
uses: helm/chart-releaser-action@be16258da8010256c6e82849661221415f031968 # v1.5.0
4344
with:
4445
charts_dir: charts
4546
config: cr.yaml
@@ -48,7 +49,7 @@ jobs:
4849
CR_SKIP_EXISTING: "true"
4950

5051
- name: Login to GHCR
51-
uses: docker/login-action@v3.0.0
52+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
5253
with:
5354
registry: ghcr.io
5455
username: ${{ github.actor }}

.github/workflows/sync-readme.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v4
16+
with:
17+
persist-credentials: false
1618
- run: |
1719
cp -f README.md ${{ runner.temp }}/README.md
1820
- uses: actions/checkout@v4
1921
with:
2022
ref: gh-pages
23+
persist-credentials: false
2124
- run: |
2225
cp -f ${{ runner.temp }}/README.md .
2326
git config user.name "$GITHUB_ACTOR"

.github/workflows/update-helm-repo.yaml

Lines changed: 61 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ on:
3030
github_app_pem:
3131
description: GitHub APP pem to authenticate with
3232
required: false
33+
vault_repo_secret_name:
34+
description: Vault secret name that holds repository's GitHub App credentials to authenticate with
35+
required: false
3336
helm_repo_token:
3437
description: GitHub api token to use against the helm-charts repository
3538
required: false
@@ -41,6 +44,7 @@ env:
4144
CR_PACKAGE_PATH: "${{ github.workspace }}/.cr-release-packages"
4245
CR_TOOL_PATH: "${{ github.workspace }}/.cr-tool"
4346
HELM_TAG_PREFIX: "${{ inputs.helm_tag_prefix }}"
47+
REF_NAME: "${{ github.ref_name }}"
4448

4549
jobs:
4650
setup:
@@ -54,9 +58,10 @@ jobs:
5458
with:
5559
fetch-depth: 0
5660
path: source
61+
persist-credentials: false
5762

5863
- name: Set up chart-testing
59-
uses: helm/chart-testing-action@v2.1.0
64+
uses: helm/chart-testing-action@0d28d3144d3a25ea2cc349d6e59901c4ff469b3b # v2.7.0
6065

6166
- name: List changed charts
6267
id: list-changed
@@ -65,8 +70,8 @@ jobs:
6570
6671
latest_tag=$( if ! git describe --tags --abbrev=0 2> /dev/null ; then git rev-list --max-parents=0 --first-parent HEAD ; fi )
6772
68-
echo "Running: ct list-changed --config ${CT_CONFIGFILE} --since ${latest_tag} --target-branch ${{ github.ref_name }}"
69-
changed=$(ct list-changed --config "${CT_CONFIGFILE}" --since "${latest_tag}" --target-branch "${{ github.ref_name }}")
73+
echo "Running: ct list-changed --config ${CT_CONFIGFILE} --since ${latest_tag} --target-branch ${REF_NAME}"
74+
changed=$(ct list-changed --config "${CT_CONFIGFILE}" --since "${latest_tag}" --target-branch "${REF_NAME}")
7075
echo "${changed}"
7176
num_changed=$(wc -l <<< ${changed})
7277
if [[ "${num_changed}" -gt "1" ]] ; then
@@ -94,30 +99,48 @@ jobs:
9499
needs: [setup]
95100
runs-on: ubuntu-latest
96101
permissions:
102+
id-token: write # allows GitHub App to generate id-token from Github's OIDC
97103
contents: write # allows GITHUB_TOKEN to push chart release, create release, and push tags to github
98104
packages: write # allows GITHUB_TOKEN to push package to ghcr
99105
env:
100-
github_app_id: ${{ secrets.github_app_id }}
106+
# APP_ID and PRIVATE_KEY are overwritten by credentials from vault, if configured
107+
GITHUB_APP_ID: ${{ secrets.github_app_id }}
108+
PRIVATE_KEY: ${{ secrets.github_app_pem }}
109+
VAULT_REPO_SECRET_NAME: ${{ secrets.vault_repo_secret_name }}
101110
if: needs.setup.outputs.changed == 'true'
102111
steps:
103-
- name: Create a GitHub App installation access token
104-
if: env.github_app_id != ''
105-
uses: tibdex/github-app-token@v2
112+
- name: Retrieve GitHub App credentials from Vault
113+
if: env.VAULT_REPO_SECRET_NAME != ''
114+
id: get-secrets
115+
uses: grafana/shared-workflows/actions/get-vault-secrets@28361cdb22223e5f1e34358c86c20908e7248760 # v1.1.0
116+
with:
117+
repo_secrets: |
118+
GITHUB_APP_ID=${{ env.VAULT_REPO_SECRET_NAME }}:app-id
119+
PRIVATE_KEY=${{ env.VAULT_REPO_SECRET_NAME }}:private-key
120+
121+
- name: Generate GitHub App Token
122+
if: env.GITHUB_APP_ID != ''
106123
id: app-token
124+
uses: actions/create-github-app-token@v1
107125
with:
108-
app_id: ${{ secrets.github_app_id }}
109-
private_key: ${{ secrets.github_app_pem }}
126+
# Variables generated by the previous step get-secrets
127+
app-id: ${{ env.GITHUB_APP_ID }}
128+
private-key: ${{ env.PRIVATE_KEY }}
129+
owner: ${{ github.repository_owner }}
110130

111131
- name: Set the correct token (Github App or PAT)
132+
env:
133+
HELM_REPO_TOKEN: ${{ secrets.helm_repo_token }}
134+
APP_TOKEN: ${{ steps.app-token.outputs.token }}
112135
run: |
113-
if [[ "${{ env.github_app_id }}" == '' ]]; then
114-
echo "AUTHTOKEN=${{ secrets.helm_repo_token }}" >> $GITHUB_ENV
136+
if [[ "${GITHUB_APP_ID}" == '' ]]; then
137+
echo "AUTHTOKEN=${HELM_REPO_TOKEN}" >> $GITHUB_ENV
115138
else
116-
echo "AUTHTOKEN=${{ steps.app-token.outputs.token }}" >> $GITHUB_ENV
139+
echo "AUTHTOKEN=${APP_TOKEN}" >> $GITHUB_ENV
117140
fi
118141
119142
- name: Checkout
120-
uses: actions/checkout@v4
143+
uses: actions/checkout@v4 # zizmor: ignore[artipacked] without this ignore comment, zizmor would complain that persist-credentials is not explicitly set to false. We need it set to true (default) to be able to push the release tags later on in this workflow
121144
with:
122145
fetch-depth: 0
123146
path: source
@@ -130,12 +153,12 @@ jobs:
130153
131154
- name: Checkout helm-charts
132155
# The cr tool only works if the target repository is already checked out
133-
uses: actions/checkout@v4
156+
uses: actions/checkout@v4 # zizmor: ignore[artipacked] without this ignore comment, zizmor would complain that persist-credentials is not explicitly set to false. We need it set to true (default) to be able to push the release tags later on in this workflow
134157
with:
135158
fetch-depth: 0
136159
repository: grafana/helm-charts
137160
path: helm-charts
138-
token: ${{ env.AUTHTOKEN }}
161+
token: ${{ env.AUTHTOKEN }}
139162

140163
- name: Configure Git for helm-charts
141164
run: |
@@ -144,15 +167,17 @@ jobs:
144167
git config user.email "[email protected]"
145168
146169
- name: Install Helm
147-
uses: azure/setup-helm@v4
170+
uses: azure/setup-helm@b9e51907a09c216f16ebe8536097933489208112 # v4.3.0
148171
with:
149172
version: v3.16.2
150173

151174
- name: Parse Chart.yaml
152175
id: parse-chart
176+
env:
177+
CHARTPATH: ${{ needs.setup.outputs.chartpath }}
153178
run: |
154179
cd source
155-
changed="${{ needs.setup.outputs.chartpath }}"
180+
changed="${CHARTPATH}"
156181
description=$(yq ".description" < ${changed}/Chart.yaml)
157182
name=$(yq ".name" < ${changed}/Chart.yaml)
158183
version=$(yq ".version" < ${changed}/Chart.yaml)
@@ -166,10 +191,12 @@ jobs:
166191
echo "packagename=${name}-${version}" >> $GITHUB_OUTPUT
167192
168193
- name: Add dependency chart repos
194+
env:
195+
CHARTPATH: ${{ steps.parse-chart.outputs.chartpath }}
169196
run: |
170197
cd source
171198
# Skip the header line and make sure that tabs are expanded into spaces
172-
deps=$(helm dependency list "${{ steps.parse-chart.outputs.chartpath }}" | tail +2 | expand)
199+
deps=$(helm dependency list "${CHARTPATH}" | tail +2 | expand)
173200
while read -r row; do
174201
IFS=' ' read -ra parts <<< "$row"
175202
name="${parts[0]}"
@@ -190,20 +217,24 @@ jobs:
190217
rm -f cr.tar.gz
191218
192219
- name: Create helm package
220+
env:
221+
CHARTPATH: ${{ steps.parse-chart.outputs.chartpath }}
193222
run: |
194223
cd source
195-
"${CR_TOOL_PATH}/cr" package "${{ steps.parse-chart.outputs.chartpath }}" --config "${CR_CONFIGFILE}" --package-path "${CR_PACKAGE_PATH}"
224+
"${CR_TOOL_PATH}/cr" package "${CHARTPATH}" --config "${CR_CONFIGFILE}" --package-path "${CR_PACKAGE_PATH}"
196225
echo "Result of chart package:"
197226
ls -l "${CR_PACKAGE_PATH}"
198227
199228
- name: Create tag and check if exists on origin
229+
env:
230+
TAGNAME: ${{ steps.parse-chart.outputs.tagname }}
200231
run: |
201232
cd source
202-
echo "Making tag ${{ steps.parse-chart.outputs.tagname }}"
203-
git tag "${{ steps.parse-chart.outputs.tagname }}"
233+
echo "Making tag ${TAGNAME}"
234+
git tag "${TAGNAME}"
204235
205236
- name: Make github release
206-
uses: softprops/action-gh-release@v1
237+
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # tags/v1
207238
with:
208239
body: |
209240
${{ steps.parse-chart.outputs.desc }}
@@ -219,18 +250,20 @@ jobs:
219250
token: ${{ env.AUTHTOKEN }}
220251

221252
- name: Push release tag on origin
253+
env:
254+
TAGNAME: ${{ steps.parse-chart.outputs.tagname }}
222255
run: |
223256
cd source
224-
echo "Pushing tag ${{ steps.parse-chart.outputs.tagname }}"
225-
git push origin "${{ steps.parse-chart.outputs.tagname }}"
257+
echo "Pushing tag ${TAGNAME}"
258+
git push origin "${TAGNAME}"
226259
227260
- name: Update helm repo index.yaml
228261
run: |
229262
cd helm-charts
230263
"${CR_TOOL_PATH}/cr" index --config "${CR_CONFIGFILE}" --token "${{ env.AUTHTOKEN }}" --index-path "${CR_INDEX_PATH}" --package-path "${CR_PACKAGE_PATH}" --push
231264
232265
- name: Login to GHCR
233-
uses: docker/login-action@v3.0.0
266+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
234267
with:
235268
registry: ghcr.io
236269
username: ${{ github.actor }}
@@ -239,5 +272,7 @@ jobs:
239272
password: ${{ secrets.GITHUB_TOKEN }}
240273

241274
- name: Push charts to GHCR
275+
env:
276+
PACKAGENAME: ${{ steps.parse-chart.outputs.packagename }}
242277
run: |
243-
helm push "${{ env.CR_PACKAGE_PATH }}/${{ steps.parse-chart.outputs.packagename }}.tgz" "oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/helm-charts"
278+
helm push "${CR_PACKAGE_PATH}/${PACKAGENAME}.tgz" "oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/helm-charts"

.github/workflows/validate-pr.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
- reopened
99
- synchronize
1010

11+
permissions:
12+
pull-requests: read
13+
contents: read
14+
1115
jobs:
1216
validate:
1317
runs-on: ubuntu-latest
@@ -16,10 +20,10 @@ jobs:
1620
uses: actions/checkout@v4
1721
with:
1822
fetch-depth: 0
23+
persist-credentials: false
1924

2025
- name: Set up chart-testing
21-
uses: helm/[email protected]
22-
26+
uses: helm/chart-testing-action@0d28d3144d3a25ea2cc349d6e59901c4ff469b3b # v2.7.0
2327
- name: Validate PR
2428
run: scripts/validate-pr.sh
2529
env:

0 commit comments

Comments
 (0)