Skip to content

Commit c4a1e7f

Browse files
committed
Merge branch 'main' into fl/primitive-delta-support
2 parents 42087f5 + 1d185f1 commit c4a1e7f

File tree

994 files changed

+60787
-36251
lines changed

Some content is hidden

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

994 files changed

+60787
-36251
lines changed

.github/workflows/changelog-check.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ jobs:
1515
id: check-label
1616
run: |
1717
LABELS=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
18-
19-
if echo "$LABELS" | grep -qE "(changelog-not-needed|dependency-update|vendored-mimir-prometheus-update|helm-weekly-release)"; then
18+
19+
# "grep -w" to check for the whole words
20+
if echo "$LABELS" | grep -w -qE "(changelog-not-needed|dependency-update|vendored-mimir-prometheus-update|helm-weekly-release|backport)"; then
2021
echo "skip=true" >> $GITHUB_OUTPUT
2122
echo "PR has a label that skips changelog check, skipping changelog check"
2223
else
@@ -30,10 +31,23 @@ jobs:
3031
if: steps.check-label.outputs.skip == 'false'
3132
run: |
3233
PR_NUMBER=${{ github.event.pull_request.number }}
34+
MAIN_CHANGELOG_FOUND=false
35+
HELM_CHANGELOG_FOUND=false
36+
3337
if grep -q "#${PR_NUMBER}" CHANGELOG.md; then
3438
echo "✅ PR #${PR_NUMBER} is referenced in CHANGELOG.md"
39+
MAIN_CHANGELOG_FOUND=true
40+
fi
41+
42+
if grep -q "#${PR_NUMBER}" operations/helm/charts/mimir-distributed/CHANGELOG.md; then
43+
echo "✅ PR #${PR_NUMBER} is referenced in helm CHANGELOG.md"
44+
HELM_CHANGELOG_FOUND=true
45+
fi
46+
47+
if [ "$MAIN_CHANGELOG_FOUND" = true ] || [ "$HELM_CHANGELOG_FOUND" = true ]; then
48+
echo "✅ PR #${PR_NUMBER} is referenced in at least one changelog"
3549
else
36-
echo "❌ PR #${PR_NUMBER} is not referenced in CHANGELOG.md"
37-
echo "Please add an entry for this PR in CHANGELOG.md or add one of these labels if this change doesn't require a changelog entry: 'changelog-not-needed', 'dependency-update', 'vendored-mimir-prometheus-update', 'helm-weekly-release'"
50+
echo "❌ PR #${PR_NUMBER} is not referenced in CHANGELOG.md or operations/helm/charts/mimir-distributed/CHANGELOG.md"
51+
echo "Please add an entry for this PR in the appropriate changelog or add one of these labels if this change doesn't require a changelog entry: 'changelog-not-needed', 'dependency-update', 'vendored-mimir-prometheus-update', 'helm-weekly-release'"
3852
exit 1
39-
fi
53+
fi

.github/workflows/flaky-tests.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Flaky Tests Detection
2+
3+
on:
4+
schedule:
5+
- cron: "0 2 * * 1" # Run every Monday at 2 AM
6+
workflow_dispatch:
7+
inputs:
8+
skip-posting-issues:
9+
description: 'Skip creating/updating GitHub issues (preview mode)'
10+
required: false
11+
default: 'true'
12+
type: boolean
13+
14+
permissions:
15+
contents: read
16+
issues: write
17+
id-token: write
18+
19+
jobs:
20+
analyze-flaky-tests:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout Repository
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: '0' # we need all commits so that the git history check returns valid commits
27+
28+
- name: Retrieve Secrets from Vault
29+
id: get-secrets
30+
uses: grafana/shared-workflows/actions/get-vault-secrets@5d7e361bc7e0a183cde8afe9899fb7b596d2659b # get-vault-secrets-v1.2.0
31+
with:
32+
repo_secrets: |
33+
LOKI_URL=flaky-tests-bot:loki-url
34+
LOKI_USERNAME=flaky-tests-bot:loki-username
35+
LOKI_PASSWORD=flaky-tests-bot:loki-password
36+
APP_ID=mimir-github-bot:app_id
37+
PRIVATE_KEY=mimir-github-bot:private_key
38+
39+
- name: Generate GitHub App Token
40+
id: github-token
41+
uses: actions/create-github-app-token@v1
42+
with:
43+
app-id: ${{ env.APP_ID }}
44+
private-key: ${{ env.PRIVATE_KEY }}
45+
owner: ${{ github.repository_owner }}
46+
47+
- name: Run Flaky Tests Analysis
48+
uses: dimitarvdimitrov/shared-workflows/actions/go-flaky-tests@0e7ecbf2ae0a5b76e24e31beed04d63e610e6b1d # dimitar/analyze-test-failures/exclude-tests
49+
with:
50+
loki-url: ${{ env.LOKI_URL }}
51+
loki-username: ${{ env.LOKI_USERNAME }}
52+
loki-password: ${{ env.LOKI_PASSWORD }}
53+
repository: ${{ github.repository }}
54+
time-range: "7d"
55+
top-k: "3"
56+
skip-posting-issues: ${{ github.event_name == 'workflow_dispatch' && inputs.skip-posting-issues || 'false' }}
57+
ignored-tests: "TestOurUpstreamTestCasesAreInSyncWithUpstream" # This is supposed to block upstream mimir-prometheus updates, so it's also expected to fail.
58+
env:
59+
GITHUB_TOKEN: ${{ steps.github-token.outputs.token }}

.github/workflows/push-mimir-build-image.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
4040

4141
- name: Set up Docker Buildx
42-
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
42+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
4343

4444
- name: Login to Docker Hub
4545
uses: grafana/shared-workflows/actions/dockerhub-login@13fb504e3bfe323c1188bf244970d94b2d336e86 # v1.0.1
@@ -109,6 +109,26 @@ jobs:
109109
echo "isDifferent=true" >> $GITHUB_OUTPUT
110110
fi
111111
112+
# This job uses "Mimir bot" instead of "github-actions bot" (secrets.GITHUB_TOKEN)
113+
# because any events triggered by the latter don't spawn GitHub actions.
114+
# Refer to https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow
115+
- name: Retrieve GitHub App Credentials from Vault
116+
id: get-secrets
117+
uses: grafana/shared-workflows/actions/get-vault-secrets@28361cdb22223e5f1e34358c86c20908e7248760 # v1.1.0
118+
with:
119+
repo_secrets: |
120+
APP_ID=mimir-github-bot:app_id
121+
PRIVATE_KEY=mimir-github-bot:private_key
122+
123+
- name: Generate GitHub App Token
124+
id: app-token
125+
uses: actions/create-github-app-token@v1
126+
with:
127+
# Variables generated by the previous step get-secrets
128+
app-id: ${{ env.APP_ID }}
129+
private-key: ${{ env.PRIVATE_KEY }}
130+
owner: ${{ github.repository_owner }}
131+
112132
- name: Add commit to PR in order to update Build Image version
113133
if: steps.compare_tag.outputs.isDifferent == 'true'
114134
run: |
@@ -122,12 +142,13 @@ jobs:
122142
sed -i "s/$MAIN_TAG/${{ steps.compute_hash.outputs.tag }}/g" Makefile
123143
git config --global user.email "${GITHUB_LOGIN}@users.noreply.github.com"
124144
git config --global user.name "${GITHUB_LOGIN}"
145+
git config --global url.https://x-access-token:${GITHUB_TOKEN}@github.com/.insteadOf https://github.com/
125146
git add Makefile
126147
git commit -m "Update build image version to ${{ steps.compute_hash.outputs.tag }}"
127148
git push origin HEAD
128149
fi
129150
env:
130-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
151+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
131152
GITHUB_LOGIN: ${{ github.event.pull_request.user.login }}
132153
TAG: ${{ steps.compute_hash.outputs.tag }}
133154
MAIN_TAG: ${{ steps.prepare.outputs.main_image_tag }}

.github/workflows/scripts/run-unit-tests-group.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ echo "$GROUP_TESTS"
4747
echo ""
4848

4949
# shellcheck disable=SC2086 # we *want* word splitting of GROUP_TESTS.
50-
exec go test -tags=netgo,stringlabels -timeout 30m -race -count 1 ${GROUP_TESTS}
50+
exec go test -tags=netgo,stringlabels -timeout 30m -race ${GROUP_TESTS}

.github/workflows/test-build-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ jobs:
205205
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
206206
- name: Set up Docker Buildx
207207
id: buildx
208-
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
208+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
209209
- name: Symlink Expected Path to Workspace
210210
run: |
211211
mkdir -p /go/src/github.com/grafana/mimir
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Update vendored versions in grafana/backend-enterprise weekly branches
2+
3+
on:
4+
push:
5+
branches:
6+
- 'r[0-9]*'
7+
8+
permissions:
9+
contents: read
10+
id-token: write
11+
12+
jobs:
13+
trigger:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Retrieve GitHub App Credentials from Vault
17+
id: get-secrets
18+
uses: grafana/shared-workflows/actions/get-vault-secrets@28361cdb22223e5f1e34358c86c20908e7248760 # v1.1.0
19+
with:
20+
repo_secrets: |
21+
APP_ID=mimir-github-bot:app_id
22+
PRIVATE_KEY=mimir-github-bot:private_key
23+
24+
- name: Generate GitHub App Token
25+
id: app-token
26+
uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0
27+
with:
28+
# Variables generated by the previous step get-secrets
29+
app-id: ${{ env.APP_ID }}
30+
private-key: ${{ env.PRIVATE_KEY }}
31+
owner: ${{ github.repository_owner }}
32+
33+
- name: Send repository_dispatch to grafana/backend-enterprise
34+
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0
35+
with:
36+
token: ${{ steps.app-token.outputs.token }}
37+
repository: grafana/backend-enterprise
38+
event-type: mimir-branch-push
39+
client-payload: '{"branch_name": "${{ github.ref_name }}"}'

.github/workflows/update-vendored-mimir-prometheus.yml

Lines changed: 63 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
default: 'main'
1515
type: string
1616

17+
repository_dispatch:
18+
types: [ mimir-prometheus-branch-push ]
19+
1720
permissions:
1821
contents: write
1922
pull-requests: write
@@ -23,10 +26,44 @@ jobs:
2326
update-mimir-prometheus:
2427
runs-on: ubuntu-latest
2528
steps:
29+
- name: Determine branch names (repository_dispatch)
30+
id: branch-names-dispatch
31+
if: github.event_name == 'repository_dispatch'
32+
env:
33+
MIMIR_PROMETHEUS_BRANCH: ${{ github.event.client_payload.branch_name }}
34+
run: |
35+
# For repository_dispatch, use the env-injected mimir_prometheus_branch.
36+
# The main use case is for weekly branches, so we just use the same branch name here too.
37+
echo "Triggered by repository_dispatch"
38+
echo "Using mimir-prometheus branch from payload: $MIMIR_PROMETHEUS_BRANCH"
39+
40+
echo "mimir_branch=$MIMIR_PROMETHEUS_BRANCH" >> $GITHUB_OUTPUT
41+
echo "mimir_prometheus_branch=$MIMIR_PROMETHEUS_BRANCH" >> $GITHUB_OUTPUT
42+
43+
- name: Determine branch names (workflow_dispatch)
44+
id: branch-names-manual
45+
if: github.event_name == 'workflow_dispatch'
46+
env:
47+
MIMIR_BRANCH: ${{ inputs.mimir_branch }}
48+
MIMIR_PROMETHEUS_BRANCH: ${{ inputs.mimir_prometheus_branch }}
49+
run: |
50+
# For workflow_dispatch, use the env-injected branch names.
51+
echo "Triggered by workflow_dispatch"
52+
echo "Using input values - mimir branch: $MIMIR_BRANCH, mimir-prometheus branch: $MIMIR_PROMETHEUS_BRANCH"
53+
54+
echo "mimir_branch=$MIMIR_BRANCH" >> $GITHUB_OUTPUT
55+
echo "mimir_prometheus_branch=$MIMIR_PROMETHEUS_BRANCH" >> $GITHUB_OUTPUT
56+
57+
- name: Determine branch names (combined)
58+
id: branch-names
59+
run: |
60+
echo "mimir_branch=${{ steps.branch-names-dispatch.outputs.mimir_branch || steps.branch-names-manual.outputs.mimir_branch }}" >> $GITHUB_OUTPUT
61+
echo "mimir_prometheus_branch=${{ steps.branch-names-dispatch.outputs.mimir_prometheus_branch || steps.branch-names-manual.outputs.mimir_prometheus_branch }}" >> $GITHUB_OUTPUT
62+
2663
- name: Check out repository
2764
uses: actions/checkout@v4
2865
with:
29-
ref: ${{ inputs.mimir_branch }}
66+
ref: ${{ steps.branch-names.outputs.mimir_branch }}
3067
token: ${{ secrets.GITHUB_TOKEN }}
3168
fetch-depth: 0
3269
set-safe-directory: '*'
@@ -60,7 +97,7 @@ jobs:
6097
- name: Get mimir-prometheus commit info
6198
id: get-commit-info
6299
env:
63-
MIMIR_PROMETHEUS_BRANCH: ${{ inputs.mimir_prometheus_branch }}
100+
MIMIR_PROMETHEUS_BRANCH: ${{ steps.branch-names.outputs.mimir_prometheus_branch }}
64101
run: |
65102
# Fetch the latest commit hash from the specified branch
66103
NEW_HASH=$(git ls-remote https://github.com/grafana/mimir-prometheus.git "${MIMIR_PROMETHEUS_BRANCH}" | cut -f1)
@@ -106,23 +143,43 @@ jobs:
106143
107144
echo "Dependencies updated successfully"
108145
146+
- name: Regenerate OTLP files
147+
run: make generate-otlp
148+
109149
- name: Create Pull Request
150+
id: create_pull_request
110151
uses: peter-evans/create-pull-request@4e1beaa7521e8b457b572c090b25bd3db56bf1c5 # v5.0.3
111152
with:
112153
token: ${{ steps.app-token.outputs.token }}
113-
title: \[${{ inputs.mimir_branch }}\] Update mimir-prometheus to ${{ steps.get-commit-info.outputs.short_hash }}
154+
title: '[${{ steps.branch-names.outputs.mimir_branch }}] Update mimir-prometheus to ${{ steps.get-commit-info.outputs.short_hash }}'
114155
body: |
115156
## Update mimir-prometheus dependency
116157
117158
*This PR was automatically created by the [update-vendored-mimir-prometheus.yml](https://github.com/grafana/mimir/blob/main/.github/workflows/update-vendored-mimir-prometheus.yml) workflow.*
118159
119160
### Details:
120-
- **Source branch/ref**: ${{ format('[`{0}`](https://github.com/grafana/mimir-prometheus/tree/{0})', inputs.mimir_prometheus_branch) }}
161+
- **Source branch/ref**: ${{ format('[`{0}`](https://github.com/grafana/mimir-prometheus/tree/{0})', steps.branch-names.outputs.mimir_prometheus_branch) }}
121162
- **Previous commit**: ${{ format('[`{0}`](https://github.com/grafana/mimir-prometheus/commit/{0})', steps.get-commit-info.outputs.old_hash) }}
122163
- **New commit**: ${{ format('[`{0}`](https://github.com/grafana/mimir-prometheus/commit/{0})', steps.get-commit-info.outputs.new_hash) }}
123164
- **Changes**: ${{ format('[`{0}...{1}`](https://github.com/grafana/mimir-prometheus/compare/{0}...{1})', steps.get-commit-info.outputs.old_hash, steps.get-commit-info.outputs.new_hash) }}
124165
commit-message: Update mimir-prometheus to `${{ steps.get-commit-info.outputs.short_hash }}`
125-
branch: bot/${{ inputs.mimir_branch }}/update-mimir-prometheus-${{ steps.get-commit-info.outputs.short_hash }}-${{ steps.get-commit-info.outputs.timestamp }}
126-
base: ${{ inputs.mimir_branch }}
166+
branch: bot/${{ steps.branch-names.outputs.mimir_branch }}/update-mimir-prometheus-${{ steps.get-commit-info.outputs.short_hash }}-${{ steps.get-commit-info.outputs.timestamp }}
167+
base: ${{ steps.branch-names.outputs.mimir_branch }}
127168
labels: vendored-mimir-prometheus-update
128169
delete-branch: true
170+
171+
- name: Close Old Vendor PRs
172+
run: |
173+
prs=$(gh pr list --state open --json number --search 'label:vendored-mimir-prometheus-update' --base $BASE_BRANCH --jq '.[].number')
174+
echo "The following Mimir automatic vendor PRs are open: $prs"
175+
for pr in $prs; do
176+
if [ $pr == ${PULL_REQUEST_NUMBER} ]; then
177+
continue
178+
fi
179+
gh pr comment $pr -b "This pull request has been automatically closed because it has been superseded by #${PULL_REQUEST_NUMBER}."
180+
gh pr close $pr --delete-branch
181+
done
182+
env:
183+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
184+
BASE_BRANCH: ${{ steps.branch-names.outputs.mimir_branch }}
185+
PULL_REQUEST_NUMBER: ${{ steps.create_pull_request.outputs.pull-request-number }}

0 commit comments

Comments
 (0)