Skip to content

Commit 8a9d0a0

Browse files
committed
Merge remote-tracking branch 'cncf/main' into backportMarch
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
2 parents 5de2741 + 43438fa commit 8a9d0a0

197 files changed

Lines changed: 26582 additions & 6277 deletions

File tree

Some content is hidden

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

.github/copilot-instructions.md

Lines changed: 115 additions & 208 deletions
Large diffs are not rendered by default.

.github/workflows/chart.yml

Lines changed: 69 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,86 @@ name: Helm Chart Publisher
22

33
on:
44
push:
5-
branches:
6-
- main
7-
paths:
8-
- ".github/workflows/chart.yaml"
9-
- "charts/**"
10-
create:
11-
# Publish semver tags as releases.
12-
tags: [ 'v*.*.*' ]
13-
5+
tags:
6+
- "v*.*.*"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "Release tag (e.g., v1.0.0)"
11+
required: true
12+
type: string
1413
permissions:
1514
contents: write
15+
packages: write
16+
17+
env:
18+
REGISTRY: ghcr.io
1619

1720
jobs:
18-
deploy:
21+
export-registry:
22+
uses: ./.github/workflows/setup-release.yml
23+
with:
24+
tag: ${{ inputs.tag || github.ref_name }}
25+
26+
publish-github-pages:
27+
needs: export-registry
1928
runs-on: ubuntu-latest
2029
steps:
21-
- uses: actions/checkout@v6.0.1
30+
- uses: actions/checkout@v6.0.2
2231
with:
2332
submodules: true
2433
fetch-depth: 0
25-
- name: Publish Helm chart
34+
- name: Publish Helm chart to GitHub Pages
2635
uses: stefanprodan/helm-gh-pages@v1.7.0
2736
with:
2837
token: ${{ secrets.GITHUB_TOKEN }}
2938
charts_dir: charts
3039
target_dir: charts
31-
linting: off
40+
linting: on
41+
42+
publish-oci:
43+
needs: export-registry
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Checkout code
47+
uses: actions/checkout@v6.0.2
48+
49+
- name: Login to GitHub Container Registry
50+
uses: docker/login-action@v3.6.0
51+
with:
52+
registry: ${{ env.REGISTRY }}
53+
username: ${{ github.actor }}
54+
password: ${{ secrets.GITHUB_TOKEN }}
55+
56+
- name: Package and push Helm charts to GHCR via Makefile
57+
run: |
58+
set -euo pipefail
59+
60+
RELEASE_VERSION="${{ needs.export-registry.outputs.version }}"
61+
62+
OCI_REGISTRY="${{ needs.export-registry.outputs.registry }}/charts"
63+
make helm-push REGISTRY="${OCI_REGISTRY}" TAG="${RELEASE_VERSION}"
64+
65+
- name: Verify chart appVersion matches release tag
66+
run: |
67+
set -euo pipefail
68+
69+
RELEASE_VERSION="${{ needs.export-registry.outputs.version }}"
70+
CHART_VERSION="${RELEASE_VERSION}"
71+
EXPECTED_APP_VERSION="${RELEASE_VERSION}"
72+
73+
rm -rf .helm-verify
74+
mkdir -p .helm-verify
75+
76+
for chart in hub-agent member-agent; do
77+
helm pull "oci://${{ needs.export-registry.outputs.registry }}/charts/${chart}" --version "${CHART_VERSION}" --destination .helm-verify >/dev/null
78+
packaged=".helm-verify/${chart}-${CHART_VERSION}.tgz"
79+
actual_app_version=$(tar -xOf "${packaged}" "${chart}/Chart.yaml" | awk -F': ' '/^appVersion:/ {gsub(/"/, "", $2); print $2}')
80+
if [[ "${actual_app_version}" != "${EXPECTED_APP_VERSION}" ]]; then
81+
echo "ERROR: ${chart} appVersion (${actual_app_version}) does not match release tag (${EXPECTED_APP_VERSION})"
82+
exit 1
83+
fi
84+
echo "✅ ${chart} appVersion=${actual_app_version} matches release tag=${EXPECTED_APP_VERSION}"
85+
done
86+
87+
rm -rf .helm-verify

.github/workflows/ci.yml

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ on:
1313
paths-ignore: [docs/**, "**.md", "**.mdx", "**.png", "**.jpg"]
1414

1515
env:
16-
GO_VERSION: '1.24.9'
16+
GO_VERSION: '1.24.13'
17+
CERT_MANAGER_VERSION: 'v1.16.2'
1718

1819
jobs:
1920
detect-noop:
@@ -29,7 +30,7 @@ jobs:
2930
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
3031
concurrent_skipping: false
3132

32-
unit-tests:
33+
unit-and-integration-tests:
3334
runs-on: ubuntu-latest
3435
needs: detect-noop
3536
if: needs.detect-noop.outputs.noop != 'true'
@@ -40,23 +41,48 @@ jobs:
4041
go-version: ${{ env.GO_VERSION }}
4142

4243
- name: Check out code into the Go module directory
43-
uses: actions/checkout@v6.0.1
44+
uses: actions/checkout@v6.0.2
4445

4546
- name: Set up Ginkgo CLI
4647
run: |
4748
go install github.com/onsi/ginkgo/v2/ginkgo@v2.19.1
4849
49-
- name: Run unit tests & Generate coverage
50-
run: make test
50+
- name: Prepare necessary environment variables
51+
run: |
52+
echo "CGO_ENABLED=1" >> $GITHUB_ENV
53+
KUBEBUILDER_ASSETS=$(make --silent kubebuilder-assets-path)
54+
echo "KUBEBUILDER_ASSETS="$KUBEBUILDER_ASSETS"" >> $GITHUB_ENV
55+
56+
# Certain tests that require special setup (e.g., those that should be run with Ginkgo CLI only) will
57+
# be skipped in this step.
58+
#
59+
# Note that the skipping only applies to the CI environment.
60+
- name: Run unit and integration tests with default setup & generate coverage
61+
run: |
62+
make test
63+
env:
64+
KUBEFLEET_CI_TEST_RUNNER_NAME: 'default'
65+
66+
# The work applier integration tests use in-memory Kubernetes environment setup; due to resource constraints
67+
# and the way the tests are organized, running the suite with as many parallel Ginkgo processes as possible (i.e.,
68+
# the number of all CPU cores) might not lead to the optimal outcome.
69+
#
70+
# Note (chenyu1): switch to test matrices if we need to test with more configuration combos in the future.
71+
- name: Run work applier unit and integration tests with Ginkgo CLI & generate coverage
72+
run: |
73+
ginkgo -v -p --procs=4 --race --cover -coverprofile=work-applier-it-coverage.out ./pkg/controllers/workapplier/
74+
KUBEFLEET_CI_WORK_APPLIER_RUN_WITH_PRIORITY_QUEUE=true ginkgo -v -p --procs=4 --race --cover -coverprofile=work-applier-it-no-pri-q-coverage.out ./pkg/controllers/workapplier/
75+
env:
76+
KUBEFLEET_CI_TEST_RUNNER_NAME: 'ginkgo'
5177

5278
- name: Upload Codecov report
5379
uses: codecov/codecov-action@v5
5480
with:
55-
## Repository upload token - get it from codecov.io. Required only for private repositories
81+
## Repository upload token - get it from codecov.io. Required only for private repositories
5682
token: ${{ secrets.CODECOV_TOKEN }}
57-
## Comma-separated list of files to upload
58-
files: ./ut-coverage.xml
59-
83+
# The codecov action will auto-search all coverage files by default. All uploaded coverage will be
84+
# merged automatically.
85+
6086
e2e-tests:
6187
strategy:
6288
fail-fast: false
@@ -90,7 +116,7 @@ jobs:
90116
go-version: ${{ env.GO_VERSION }}
91117

92118
- name: Check out code into the Go module directory
93-
uses: actions/checkout@v6.0.1
119+
uses: actions/checkout@v6.0.2
94120

95121
- name: Move Docker data directory to /mnt
96122
# The default storage device on GitHub-hosted runners is running low during e2e tests.
@@ -143,7 +169,8 @@ jobs:
143169
PROPERTY_PROVIDER: 'azure'
144170
RESOURCE_SNAPSHOT_CREATION_MINIMUM_INTERVAL: ${{ matrix.resource-snapshot-creation-minimum-interval }}
145171
RESOURCE_CHANGES_COLLECTION_DURATION: ${{ matrix.resource-changes-collection-duration }}
146-
172+
CERT_MANAGER_VERSION: ${{ env.CERT_MANAGER_VERSION }}
173+
147174
- name: Collect logs
148175
if: always()
149176
# Wait for a bit before log collection; this gives the agent pods some time to shut down
@@ -157,7 +184,7 @@ jobs:
157184

158185
- name: Upload logs
159186
if: always()
160-
uses: actions/upload-artifact@v5
187+
uses: actions/upload-artifact@v6
161188
with:
162189
name: e2e-logs-${{ matrix.customized-settings }}
163190
path: test/e2e/logs-${{ matrix.customized-settings }}/

.github/workflows/code-lint.yml

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ on:
1414

1515
env:
1616
# Common versions
17-
GO_VERSION: '1.24.9'
17+
GO_VERSION: "1.24.13"
1818

1919
jobs:
20-
2120
detect-noop:
2221
runs-on: ubuntu-latest
2322
outputs:
@@ -43,7 +42,7 @@ jobs:
4342
go-version: ${{ env.GO_VERSION }}
4443

4544
- name: Checkout
46-
uses: actions/checkout@v6.0.1
45+
uses: actions/checkout@v6.0.2
4746
with:
4847
submodules: true
4948

@@ -58,13 +57,33 @@ jobs:
5857
contents: read
5958

6059
steps:
61-
- name: Set up Go ${{ env.GO_VERSION }}
62-
uses: actions/setup-go@v6
63-
with:
64-
go-version: ${{ env.GO_VERSION }}
60+
- name: Set up Go ${{ env.GO_VERSION }}
61+
uses: actions/setup-go@v6
62+
with:
63+
go-version: ${{ env.GO_VERSION }}
6564

66-
- name: Check out code into the Go module directory
67-
uses: actions/checkout@v6.0.1
65+
- name: Check out code into the Go module directory
66+
uses: actions/checkout@v6.0.2
67+
68+
- name: golangci-lint
69+
run: make lint
70+
71+
helm-lint:
72+
name: "Helm Lint"
73+
runs-on: ubuntu-latest
74+
needs: detect-noop
75+
if: needs.detect-noop.outputs.noop != 'true'
76+
77+
steps:
78+
- name: Check out code
79+
uses: actions/checkout@v6.0.2
80+
81+
- name: Set up Helm
82+
uses: azure/setup-helm@v4
83+
with:
84+
version: v3.17.0
6885

69-
- name: golangci-lint
70-
run: make lint
86+
- name: Lint Helm charts
87+
run: |
88+
helm lint charts/hub-agent
89+
helm lint charts/member-agent

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
steps:
4040
- name: Checkout repository
41-
uses: actions/checkout@v6.0.1
41+
uses: actions/checkout@v6.0.2
4242

4343
# Initializes the CodeQL tools for scanning.
4444
- name: Initialize CodeQL

.github/workflows/codespell.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Harden Runner
15-
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
15+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
1616
with:
1717
egress-policy: audit
1818

19-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
19+
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v4.1.7
2020
- uses: codespell-project/actions-codespell@8f01853be192eb0f849a5c7d721450e7a467c579 # master
2121
with:
2222
check_filenames: true

.github/workflows/markdown-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
markdown-link-check:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v6.0.1
13+
- uses: actions/checkout@v6.0.2
1414
- uses: tcort/github-action-markdown-link-check@v1
1515
with:
1616
# this will only show errors in the output

.github/workflows/release.yml

Whitespace-only changes.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Setup Release
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
tag:
7+
description: "Release tag (e.g., v1.0.0)"
8+
required: true
9+
type: string
10+
outputs:
11+
registry:
12+
description: "OCI registry repository path (e.g., ghcr.io/org/repo)"
13+
value: ${{ jobs.export.outputs.registry }}
14+
tag:
15+
description: "Release tag (e.g., v1.0.0)"
16+
value: ${{ jobs.export.outputs.tag }}
17+
version:
18+
description: "Release version without v prefix (e.g., 1.0.0)"
19+
value: ${{ jobs.export.outputs.version }}
20+
21+
env:
22+
REGISTRY: ghcr.io
23+
24+
jobs:
25+
export:
26+
runs-on: ubuntu-latest
27+
outputs:
28+
registry: ${{ steps.setup.outputs.registry }}
29+
tag: ${{ steps.setup.outputs.tag }}
30+
version: ${{ steps.setup.outputs.version }}
31+
steps:
32+
- id: setup
33+
run: |
34+
TAG="${{ inputs.tag }}"
35+
if [[ ! "${TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
36+
echo "Error: Invalid release tag '${TAG}'. Expected format: v*.*.*"
37+
exit 1
38+
fi
39+
40+
# registry must be in lowercase
41+
echo "registry=$(echo "${{ env.REGISTRY }}/${{ github.repository }}" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
42+
echo "tag=${TAG}" >> $GITHUB_OUTPUT
43+
echo "version=${TAG#v}" >> $GITHUB_OUTPUT
44+
echo "Release tag: ${TAG}, version: ${TAG#v}"

.github/workflows/trivy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818
MEMBER_AGENT_IMAGE_NAME: member-agent
1919
REFRESH_TOKEN_IMAGE_NAME: refresh-token
2020

21-
GO_VERSION: '1.24.9'
21+
GO_VERSION: '1.24.13'
2222

2323
jobs:
2424
export-registry:
@@ -44,10 +44,10 @@ jobs:
4444
go-version: ${{ env.GO_VERSION }}
4545

4646
- name: Checkout code
47-
uses: actions/checkout@v6.0.1
47+
uses: actions/checkout@v6.0.2
4848

4949
- name: Login to ${{ env.REGISTRY }}
50-
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef
50+
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9
5151
with:
5252
registry: ${{ env.REGISTRY }}
5353
username: ${{ github.actor }}

0 commit comments

Comments
 (0)