-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/parameterize-mixin
- Loading branch information
Showing
99 changed files
with
19,665 additions
and
4,066 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: helm-weekly-release-pr | ||
|
||
on: | ||
release: | ||
types: | ||
- released | ||
|
||
jobs: | ||
weekly-release-pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- id: "get_github_app_token" | ||
name: "get github app token" | ||
uses: "actions/create-github-app-token@v1" | ||
with: | ||
app-id: "${{ secrets.APP_ID }}" | ||
owner: "${{ github.repository_owner }}" | ||
private-key: "${{ secrets.APP_PRIVATE_KEY }}" | ||
|
||
- name: Update/regenerate files | ||
id: update | ||
run: bash .github/workflows/scripts/helm-tagged-release.sh ${{ github.event.release.tag_name }} | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ steps.get_github_app_token.outputs.token }} | ||
title: Release loki Helm chart ${{ steps.update.outputs.new_chart_version }} | ||
body: Automated PR created by [helm-tagged-release-pr.yaml](https://github.com/grafana/loki/blob/main/.github/workflows/helm-tagged-release-pr.yaml) | ||
commit-message: Update loki chart to ${{ steps.update.outputs.new_chart_version }} | ||
branch: helm-chart-tagged-${{ steps.update.outputs.new_chart_version }} | ||
base: main | ||
labels: helm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: helm-weekly-release-pr | ||
|
||
on: | ||
schedule: | ||
- cron: '0 10 * * 1-5' # 10 UTC on weekdays; if we miss published images one day, they should align the day after | ||
|
||
workflow_dispatch: # for manual testing | ||
|
||
jobs: | ||
weekly-release-pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: imjasonh/[email protected] | ||
|
||
- id: "get_github_app_token" | ||
name: "get github app token" | ||
uses: "actions/create-github-app-token@v1" | ||
with: | ||
app-id: "${{ secrets.APP_ID }}" | ||
owner: "${{ github.repository_owner }}" | ||
private-key: "${{ secrets.APP_PRIVATE_KEY }}" | ||
|
||
- name: Update/regenerate files | ||
id: update | ||
run: bash .github/workflows/scripts/helm-weekly-release.sh | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ steps.get_github_app_token.outputs.token }} | ||
title: Release loki Helm chart ${{ steps.update.outputs.new_chart_version }} | ||
body: Automated PR created by [helm-weekly-release-pr.yaml](https://github.com/grafana/loki/blob/main/.github/workflows/helm-weekly-release-pr.yaml) | ||
commit-message: Update loki chart to ${{ steps.update.outputs.new_chart_version }} | ||
branch: helm-chart-weekly-${{ steps.update.outputs.new_chart_version }} | ||
base: main | ||
labels: helm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -exo pipefail | ||
|
||
# This generates a new file where the yaml node is updated. | ||
# The problem is that yq strips new lines when you update the file. | ||
# So we use a workaround from https://github.com/mikefarah/yq/issues/515 which: | ||
# generates the new file, diffs it with the original, removes all non-whitespace changes, and applies that to the original file. | ||
update_yaml_node() { | ||
local filename=$1 | ||
local yaml_node=$2 | ||
local new_value=$3 | ||
patch "${filename}" <<<"$(diff -U0 -w -b --ignore-blank-lines "${filename}" <(yq eval "${yaml_node} = \"${new_value}\"" "${filename}"))" | ||
} | ||
|
||
get_yaml_node() { | ||
local filename=$1 | ||
local yaml_node=$2 | ||
yq "${yaml_node}" "${filename}" | ||
} | ||
|
||
# Increments the part of the semver string | ||
# $1: version itself | ||
# $2: number of part: 0 – major, 1 – minor, 2 – patch | ||
increment_semver() { | ||
local delimiter=. | ||
local array=("$(echo "$1" | tr "${delimiter}" '\n')") | ||
array[$2]=$((array[$2] + 1)) | ||
echo "$( | ||
local IFS=${delimiter} | ||
echo "${array[*]}" | ||
)" | ||
} | ||
|
||
# Sets the patch segment of a semver to 0 | ||
# $1: version itself | ||
set_semver_patch_to_zero() { | ||
local delimiter=. | ||
local array=("$(echo "$1" | tr "${delimiter}" '\n')") | ||
array[2]="0" | ||
echo "$( | ||
local IFS=${delimiter} | ||
echo "${array[*]}" | ||
)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env bash | ||
# SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
set -exo pipefail | ||
|
||
script_dir=$(cd "$(dirname "$0")" && pwd) | ||
# shellcheck disable=SC2250,SC1091 | ||
source "${script_dir}/common.sh" | ||
|
||
calculate_next_chart_version() { | ||
local current_chart_version=$1 | ||
|
||
local current_chart_semver | ||
current_chart_semver="$(echo "${current_chart_version}" | grep -P -o '^(\d+.){2}\d+')" | ||
local new_chart_semver="${current_chart_semver}" | ||
new_chart_semver=$(increment_semver "${current_chart_semver}" 1) | ||
new_chart_semver=$(set_semver_patch_to_zero "${new_chart_semver}") | ||
echo "${new_chart_semver}" | ||
} | ||
|
||
validate_version_update() { | ||
local new_chart_version=$1 | ||
local current_chart_version=$2 | ||
local latest_loki_tag=$3 | ||
|
||
if [[ "${new_chart_version}" == "${current_chart_version}" ]]; then | ||
echo "New chart version (${new_chart_version}) is the same as current version (${current_chart_version}); not submitting PR" | ||
exit 1 | ||
fi | ||
} | ||
|
||
latest_loki_tag=$(sed -E "s/v(.*)/\1/g" <<<"$1") | ||
|
||
values_file=production/helm/loki/values.yaml | ||
chart_file=production/helm/loki/Chart.yaml | ||
|
||
current_chart_version=$(get_yaml_node "${chart_file}" .version) | ||
new_chart_version=$(calculate_next_chart_version "${current_chart_version}") | ||
|
||
validate_version_update "${new_chart_version}" "${current_chart_version}" "${latest_loki_tag}" | ||
|
||
update_yaml_node "${values_file}" .loki.image.tag "${latest_loki_tag}" | ||
|
||
update_yaml_node "${values_file}" .enterprise.image.tag "${latest_loki_tag}" | ||
update_yaml_node "${chart_file}" .appVersion "${latest_loki_tag}" | ||
update_yaml_node "${chart_file}" .version "${new_chart_version}" | ||
|
||
sed --in-place \ | ||
--regexp-extended \ | ||
"s/(.*\<AUTOMATED_UPDATES_LOCATOR\>.*)/\1\n\n## ${new_chart_version}\n\n- \[CHANGE\] Changed version of Grafana Loki to ${latest_loki_tag}/g" production/helm/loki/CHANGELOG.md | ||
|
||
make TTY='' helm-docs | ||
|
||
echo "::set-output name=new_chart_version::${new_chart_version}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/usr/bin/env bash | ||
# SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
set -exo pipefail | ||
|
||
script_dir=$(cd "$(dirname "$0")" && pwd) | ||
# shellcheck disable=SC2250,SC1091 | ||
source "${script_dir}/common.sh" | ||
|
||
# Uses docker hub image tags to figure out what is the latest image tag | ||
find_latest_image_tag() { | ||
local docker_hub_repo=$1 | ||
local regExp="^(k|weekly-k)\d+-[a-z0-9]+" | ||
crane ls "${docker_hub_repo}" | grep -P "${regExp}" | sed -E "s/([weekly-]*k[[:digit:]]*)-([^-]*).*/\1-\2/g" | uniq | sort -Vur | head -1 | ||
} | ||
|
||
# takes k197-abcdef and returns r197, k197-abcdef-arm64 and returns k197, weekly-k197-abcdef and returns k197 | ||
extract_k_version() { | ||
sed -E "s/[weekly-]*(k[[:digit:]]*).*/\1/g" <<<"$1" | ||
} | ||
|
||
calculate_next_chart_version() { | ||
local current_chart_version=$1 | ||
local latest_image_tag=$2 | ||
|
||
local current_chart_semver | ||
current_chart_semver=$(echo "${current_chart_version}" | grep -P -o '^(\d+.){2}\d+') | ||
local new_chart_weekly | ||
new_chart_weekly=$(extract_k_version "${latest_image_tag}" | grep -P -o '\d+') | ||
local new_chart_semver="${current_chart_semver}" | ||
if [[ "${current_chart_version}" != *weekly* ]]; then | ||
# If previous version was not a weekly, then it was a stable release. | ||
# _This_ weekly release should have a semver that's one above the stable release. | ||
new_chart_semver=$(increment_semver "${current_chart_semver}" 1) | ||
# Also reset the patch release number to 0. | ||
new_chart_semver=$(set_semver_patch_to_zero "${new_chart_semver}") | ||
fi | ||
echo "${new_chart_semver}-weekly.${new_chart_weekly}" | ||
} | ||
|
||
validate_version_update() { | ||
local new_chart_version=$1 | ||
local current_chart_version=$2 | ||
local latest_gel_tag=$3 | ||
local latest_loki_tag=$4 | ||
|
||
if [[ "${new_chart_version}" == "${current_chart_version}" ]]; then | ||
echo "New chart version (${new_chart_version}) is the same as current version (${current_chart_version}); not submitting weekly PR" | ||
exit 1 | ||
fi | ||
|
||
local gel_weekly_version | ||
gel_weekly_version=$(extract_k_version "${latest_gel_tag}") | ||
local loki_weekly_version | ||
loki_weekly_version=$(extract_k_version "${latest_loki_tag}") | ||
echo "Comparing GEL weekly version (${gel_weekly_version}) with Loki weekly version (${loki_weekly_version})" | ||
if [[ "${gel_weekly_version}" != "${loki_weekly_version}" ]]; then | ||
echo "GEL weekly version (${gel_weekly_version}) does not match Loki weekly version (${loki_weekly_version}); not submitting PR" | ||
exit 1 | ||
fi | ||
} | ||
|
||
values_file=production/helm/loki/values.yaml | ||
chart_file=production/helm/loki/Chart.yaml | ||
|
||
latest_loki_tag=$(find_latest_image_tag grafana/loki) | ||
latest_gel_tag=$(find_latest_image_tag grafana/enterprise-logs) | ||
current_chart_version=$(get_yaml_node "${chart_file}" .version) | ||
new_chart_version=$(calculate_next_chart_version "${current_chart_version}" "${latest_loki_tag}") | ||
|
||
validate_version_update "${new_chart_version}" "${current_chart_version}" "${latest_gel_tag}" "${latest_loki_tag}" | ||
|
||
update_yaml_node "${values_file}" .loki.image.tag "${latest_loki_tag}" | ||
update_yaml_node "${values_file}" .enterprise.image.tag "${latest_gel_tag}" | ||
update_yaml_node "${chart_file}" .appVersion "$(extract_k_version "${latest_loki_tag}")" | ||
update_yaml_node "${chart_file}" .version "${new_chart_version}" | ||
|
||
sed --in-place \ | ||
--regexp-extended \ | ||
"s/(.*\<AUTOMATED_UPDATES_LOCATOR\>.*)/\1\n\n## ${new_chart_version}\n\n- \[CHANGE\] Changed version of Grafana Loki to ${latest_loki_tag}\n- \[CHANGE\] Changed version of Grafana Enterprise Logs to ${latest_gel_tag}/g" production/helm/loki/CHANGELOG.md | ||
|
||
make TTY='' helm-docs | ||
|
||
echo "::set-output name=new_chart_version::${new_chart_version}" |
This file was deleted.
Oops, something went wrong.
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM ruby:3.3.4 AS build | ||
FROM ruby:3.3.5 AS build | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
|
Oops, something went wrong.