Skip to content

Commit be2a535

Browse files
authored
Merge branch 'main' into let_renovate_update_all_go.mods
2 parents 7eb2d74 + 07d14eb commit be2a535

Some content is hidden

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

47 files changed

+701
-223
lines changed

.github/renovate.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
],
66
"baseBranchPatterns": [
77
"main",
8+
"release/v0.15",
89
"release/v0.14",
910
"release/v0.13",
1011
"release/v0.12",
@@ -28,6 +29,14 @@
2829
"enabled": true,
2930
"minimumGroupSize": 2
3031
},
32+
{
33+
"matchBaseBranches": [
34+
"release/v0.15"
35+
],
36+
"extends": [
37+
"github>rancher/renovate-config//rancher-2.14#release"
38+
]
39+
},
3140
{
3241
"matchBaseBranches": [
3342
"release/v0.14"

.github/scripts/check-for-auto-generated-changes.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#!/bin/sh
2-
set -ue
1+
#!/bin/bash
2+
set -euo pipefail
33

44
go generate
55
ginkgo unfocus
66

77
if [ -n "$(git status --porcelain)" ]; then
8-
echo "Generated files have either been changed manually or were not updated.\n"
8+
printf 'Generated files have either been changed manually or were not updated.\n\n'
99

1010
echo "The following generated files did differ after regeneration:"
1111
git status --porcelain
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/bash
2+
#
3+
# Compute the Fleet and Rancher versions needed to open a release PR.
4+
#
5+
# Environment variables:
6+
# FLEET_BRANCH Fleet branch to release (e.g. release/v0.15 or main)
7+
# GH_TOKEN GitHub token for API calls
8+
# FLEET_REPO_DIR Path to the fleet checkout (default: ./fleet)
9+
# GITHUB_OUTPUT Path to the GitHub Actions output file
10+
11+
set -euo pipefail
12+
13+
FLEET_REPO_DIR="${FLEET_REPO_DIR:-./fleet}"
14+
15+
# Derive the Fleet minor version from the branch name.
16+
# For main, compute it as (highest release branch minor) + 1.
17+
# NOTE: Update 'v0.*' pattern if Fleet has a major version bump (e.g., search for 'v1.*').
18+
if [ "$FLEET_BRANCH" = "main" ]; then
19+
highest_minor=$(git -C "$FLEET_REPO_DIR" ls-remote --heads origin 'refs/heads/release/v0.*' \
20+
| grep -oE 'v0\.[0-9]+' | cut -d. -f2 | sort -n | tail -1)
21+
if [ -z "$highest_minor" ]; then
22+
printf 'ERROR: No release/v0.* branches found in fleet repo\n' >&2
23+
exit 1
24+
fi
25+
fleet_minor=$((highest_minor + 1))
26+
else
27+
fleet_minor=$(printf '%s' "$FLEET_BRANCH" | grep -oE '[0-9]+$')
28+
fi
29+
30+
# Calculate Rancher minor version based on Fleet minor.
31+
# NOTE: Update this formula if the version relationship changes (currently Fleet minor - 1).
32+
rancher_minor=$((fleet_minor - 1))
33+
# NOTE: Update '2' to '3' (or next major version) if Rancher has a major version bump.
34+
charts_branch="dev-v2.${rancher_minor}"
35+
36+
# Fetch the Fleet chart directory listing from the rancher/charts dev branch.
37+
chart_response=$(curl -fsSL \
38+
-H "Authorization: Bearer ${GH_TOKEN}" \
39+
"https://api.github.com/repos/rancher/charts/contents/charts/fleet?ref=${charts_branch}") || {
40+
printf 'ERROR: Could not list Fleet charts in rancher/charts branch %s\n' "$charts_branch" >&2
41+
exit 1
42+
}
43+
44+
latest_chart=$(printf '%s' "$chart_response" \
45+
| jq -r '.[] | select(.type == "dir") | .name' \
46+
| sort -V | tail -1)
47+
48+
if [ -z "$latest_chart" ]; then
49+
printf 'ERROR: No Fleet chart directories found in rancher/charts branch %s\n' "$charts_branch" >&2
50+
exit 1
51+
fi
52+
53+
# Chart directory names follow the pattern <chart-version>+up<fleet-version>,
54+
# e.g. 110.0.1+up0.15.1.
55+
new_fleet="${latest_chart##*+up}"
56+
new_chart="${latest_chart%%+*}"
57+
58+
# Target the Rancher release branch when it exists; fall back to main.
59+
# NOTE: Update '2' to '3' (or next major version) if Rancher has a major version bump.
60+
rancher_ref="release/v2.${rancher_minor}"
61+
http_status=$(curl -s -o /dev/null -w "%{http_code}" \
62+
-H "Authorization: Bearer ${GH_TOKEN}" \
63+
"https://api.github.com/repos/rancher/rancher/branches/release%2Fv2.${rancher_minor}")
64+
case "$http_status" in
65+
200) ;;
66+
404) rancher_ref="main" ;;
67+
*) printf 'ERROR: GitHub API returned HTTP %s while checking Rancher branch\n' "$http_status" >&2; exit 1 ;;
68+
esac
69+
70+
printf 'Charts branch: %s\n' "$charts_branch"
71+
printf 'New Fleet version: %s\n' "$new_fleet"
72+
printf 'New chart version: %s\n' "$new_chart"
73+
printf 'Rancher ref: %s\n' "$rancher_ref"
74+
75+
{
76+
printf 'new_fleet=%s\n' "$new_fleet"
77+
printf 'new_chart=%s\n' "$new_chart"
78+
printf 'rancher_ref=%s\n' "$rancher_ref"
79+
} >> "${GITHUB_OUTPUT:?GITHUB_OUTPUT is not set}"

.github/scripts/release-against-rancher.sh

Lines changed: 50 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
#!/bin/bash
22
#
3-
# Submit new Fleet version against rancher/rancher
3+
# Submit new Fleet version against rancher/rancher.
44

5-
set -ue
5+
set -euo pipefail
66

7-
NEW_FLEET_VERSION="$1" # e.g. 0.6.0-rc.3
8-
NEW_CHART_VERSION="$2" # e.g. 101.1.0
9-
BUMP_API="$3" # bump api if `true`
7+
NEW_FLEET_VERSION="$1" # e.g. 0.15.1
8+
NEW_CHART_VERSION="$2" # e.g. 110.0.1
109

1110
bump_fleet_api() {
12-
COMMIT=$1
13-
14-
go get -u "github.com/rancher/fleet/pkg/apis@v${NEW_FLEET_VERSION}" || go get -u "github.com/rancher/fleet/pkg/apis@${COMMIT}"
11+
go get -u "github.com/rancher/fleet/pkg/apis@v${NEW_FLEET_VERSION}"
1512
go mod tidy
1613
}
1714

18-
RANCHER_DIR=${RANCHER_DIR-"$(dirname -- "$0")/../../../rancher"}
15+
RANCHER_DIR="${RANCHER_DIR:-"$(dirname -- "$0")/../../../rancher"}"
1916

2017
pushd "${RANCHER_DIR}" > /dev/null
2118

@@ -24,35 +21,60 @@ if [ ! -e ~/.gitconfig ]; then
2421
git config --global user.email fleet@suse.de
2522
fi
2623

27-
# Check if version is available online
28-
CHART_DEFAULT_BRANCH=$(grep "ARG CHART_DEFAULT_BRANCH=" package/Dockerfile | cut -d'=' -f2)
29-
if ! curl -s --head --fail "https://github.com/rancher/charts/raw/${CHART_DEFAULT_BRANCH}/assets/fleet/fleet-${NEW_CHART_VERSION}+up${NEW_FLEET_VERSION}.tgz" > /dev/null; then
30-
echo "Version ${NEW_CHART_VERSION}+up${NEW_FLEET_VERSION} does not exist in the branch ${CHART_DEFAULT_BRANCH} in rancher/charts"
24+
# Guard: error if rancher/rancher already has this version or a newer one.
25+
if [ ! -f build.yaml ]; then
26+
printf 'ERROR: build.yaml not found in %s\n' "$(pwd)" >&2
3127
exit 1
3228
fi
3329

34-
if [ -e build.yaml ]; then
35-
sed -i -e "s/fleetVersion: .*$/fleetVersion: ${NEW_CHART_VERSION}+up${NEW_FLEET_VERSION}/" build.yaml
36-
go generate
37-
git add build.yaml pkg/buildconfig/constants.go
38-
else
39-
sed -i -e "s/ENV CATTLE_FLEET_VERSION=.*$/ENV CATTLE_FLEET_VERSION=${NEW_CHART_VERSION}+up${NEW_FLEET_VERSION}/" package/Dockerfile
40-
sed -i -e "s/ENV CATTLE_FLEET_MIN_VERSION=.*$/ENV CATTLE_FLEET_MIN_VERSION=${NEW_CHART_VERSION}+up${NEW_FLEET_VERSION}/" package/Dockerfile
41-
git add package/Dockerfile
30+
TARGET_VERSION="${NEW_CHART_VERSION}+up${NEW_FLEET_VERSION}"
31+
CURRENT_VERSION=$(grep 'fleetVersion:' build.yaml | awk '{print $2}')
32+
33+
if [ -z "$CURRENT_VERSION" ]; then
34+
printf 'ERROR: fleetVersion not found in build.yaml\n' >&2
35+
exit 1
4236
fi
4337

44-
if [ "${BUMP_API}" == "true" ]; then
45-
pushd ../fleet > /dev/null
46-
COMMIT=$(git rev-list -n 1 "v${NEW_FLEET_VERSION}")
47-
popd > /dev/null
38+
if [ "$CURRENT_VERSION" = "$TARGET_VERSION" ]; then
39+
printf 'ERROR: rancher/rancher already contains Fleet %s\n' "$TARGET_VERSION" >&2
40+
exit 1
41+
fi
42+
43+
# Compare only the chart version numbers (before the '+') to detect downgrades.
44+
current_chart="${CURRENT_VERSION%%+*}"
45+
target_chart="${TARGET_VERSION%%+*}"
46+
if [ "$(printf '%s\n%s\n' "$current_chart" "$target_chart" | sort -V | tail -1)" = "$current_chart" ] \
47+
&& [ "$current_chart" != "$target_chart" ]; then
48+
printf 'ERROR: rancher/rancher already has a newer Fleet version: %s\n' "$CURRENT_VERSION" >&2
49+
exit 1
50+
fi
51+
52+
# Guard against replacing a final release with a pre-release of the same or older base.
53+
# sort -V treats "0.11.12-rc.3" > "0.11.12" (lexicographic suffix), so pre-release
54+
# vs final requires an explicit check.
55+
current_fleet="${CURRENT_VERSION##*+up}"
56+
if ! printf '%s' "$current_fleet" | grep -q '-' && printf '%s' "$NEW_FLEET_VERSION" | grep -q '-'; then
57+
target_fleet_base="${NEW_FLEET_VERSION%%-*}"
58+
if [ "$(printf '%s\n%s\n' "$current_fleet" "$target_fleet_base" | sort -V | tail -1)" = "$current_fleet" ]; then
59+
printf 'ERROR: rancher/rancher has final Fleet %s; refusing pre-release %s\n' \
60+
"$current_fleet" "$NEW_FLEET_VERSION" >&2
61+
exit 1
62+
fi
63+
fi
64+
65+
sed -i "s/fleetVersion: .*$/fleetVersion: ${TARGET_VERSION}/" build.yaml
66+
go generate
67+
git add build.yaml pkg/buildconfig/constants.go
4868

49-
bump_fleet_api "${COMMIT}"
69+
# Bump the Fleet API when a pkg/apis tag for this exact version exists in the fleet repo.
70+
if git -C ../fleet tag -l "pkg/apis/v${NEW_FLEET_VERSION}" | grep -q .; then
71+
bump_fleet_api
5072

5173
pushd pkg/apis > /dev/null
52-
bump_fleet_api "${COMMIT}"
74+
bump_fleet_api
5375
popd > /dev/null
5476

55-
git add go.* pkg/apis/go.*
77+
git add go.mod go.sum pkg/apis/go.mod pkg/apis/go.sum
5678
fi
5779

5880
git commit -m "Updating to Fleet v${NEW_FLEET_VERSION}"

.github/workflows/benchmark.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
fetch-depth: 0
4343

4444
- name: Setup Go
45-
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
45+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
4646
with:
4747
go-version-file: "go.mod"
4848
check-latest: true
@@ -109,7 +109,7 @@ jobs:
109109
echo "Found report: $safe_file"
110110
111111
- name: Upload benchmark JSON
112-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
112+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
113113
with:
114114
name: benchmark-report
115115
path: ${{ steps.report.outputs.report }}

.github/workflows/check-changes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
with:
1919
fetch-depth: 0
2020
-
21-
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
21+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
2222
with:
2323
go-version-file: 'go.mod'
2424
check-latest: true

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
helm plugin install https://github.com/helm-unittest/helm-unittest.git --version v1.0.2
3535
helm unittest ./charts/fleet
3636
-
37-
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
37+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
3838
with:
3939
go-version-file: 'go.mod'
4040
check-latest: true
@@ -50,7 +50,7 @@ jobs:
5050
with:
5151
fetch-depth: 0
5252
-
53-
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
53+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
5454
with:
5555
go-version-file: 'go.mod'
5656
check-latest: true
@@ -72,7 +72,7 @@ jobs:
7272
with:
7373
fetch-depth: 0
7474
-
75-
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
75+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
7676
with:
7777
go-version-file: 'go.mod'
7878
check-latest: true

.github/workflows/e2e-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
with:
4545
fetch-depth: 0
4646
-
47-
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
47+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
4848
with:
4949
go-version-file: 'go.mod'
5050
check-latest: true
@@ -270,7 +270,7 @@ jobs:
270270
ginkgo --github-output --trace e2e/require-secrets
271271
-
272272
name: Upload Logs
273-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
273+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
274274
if: failure()
275275
with:
276276
name: gha-fleet-e2e-logs-${{ github.sha }}-${{ matrix.k3s.version }}-${{ matrix.test_type.name }}-${{ github.run_id }}

.github/workflows/e2e-fleet-upgrade-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
with:
2929
fetch-depth: 0
3030
-
31-
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
31+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
3232
with:
3333
go-version-file: 'go.mod'
3434
check-latest: true
@@ -116,7 +116,7 @@ jobs:
116116
ginkgo --github-output --trace --label-filter="!multi-cluster" e2e/installation
117117
-
118118
name: Upload Logs
119-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
119+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
120120
if: failure()
121121
with:
122122
name: gha-fleet-e2e-logs-${{ github.sha }}-${{ matrix.k3s.version }}-${{ github.run_id }}

.github/workflows/e2e-multicluster-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
with:
2525
fetch-depth: 0
2626
-
27-
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
27+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
2828
with:
2929
go-version-file: 'go.mod'
3030
check-latest: true
@@ -246,7 +246,7 @@ jobs:
246246
crust-gather collect --exclude-namespace=kube-system --exclude-kind=Lease --duration=5s -f tmp/downstream
247247
-
248248
name: Upload Logs
249-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
249+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
250250
if: failure()
251251
with:
252252
name: gha-fleet-mc-e2e-logs-${{ github.sha }}-${{ github.run_id }}

0 commit comments

Comments
 (0)