Skip to content

Commit 447e56d

Browse files
TylerGillsonmikeshngkarl-cardenas-codingarturshadnikahmad-ibra
authored
feat: fleetconfig-controller for declarative orchestration of OCM multi-clusters (#1)
* init repo setup Signed-off-by: Mike Ng <ming@redhat.com> * fix: authorize GITHUB_TOKEN to commit reviewable diff, override image repo Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * fix: set image.repository properly Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * docs: document CI assumptions Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * fix: overhaul image build process Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * docs: update READMEs Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * fix: update smoketests & tweak devspace accordingly Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * ci: tweaks Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * ci: monorepo tweaks and docs Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * fix: install support-bundle; add serve.sh Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * ci: deduplicate repo list; fix artifact upload Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * ci: compact repo JSON Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * ci: compact repo JSON Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * ci: fix repo root in generate-repo-matrix composite action Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * ci: prefix E2E artifacts w/ github.workspace Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * docs: remove skip for fleetConfig and add param prefixes in values.yaml (#2) Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * chore: add changelog.py Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * chore: fix values.yaml Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * ci: fix E2E devspace config Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * ci: fix E2E devspace config Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * ci: fix changelog.py; PRs must be labelled w/ project name Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * chore: make reviewable w/ latest readme-generator-for-helm Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> * fix: revert resource cleanup checks during cleanup; simplify tests; retry if AMW exists (#3) Signed-off-by: Artur Shad Nik <37195151+arturshadnik@users.noreply.github.com> * chore: bump clusteradm and ocm versions to v1.0.0 (#1) * chore: bump clusteradm version to v1.0.0 * chore: bump bundleVersion in values.yaml to v1.0.0 * chore: bump OCM_VERSION adn CLUSTERADM_VERSION in .versions.env * chore: make reviewable Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> --------- Signed-off-by: Mike Ng <ming@redhat.com> Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com> Signed-off-by: Artur Shad Nik <37195151+arturshadnik@users.noreply.github.com> Co-authored-by: Mike Ng <ming@redhat.com> Co-authored-by: Karl Cardenas <29551334+karl-cardenas-coding@users.noreply.github.com> Co-authored-by: Artur Shad Nik <37195151+arturshadnik@users.noreply.github.com> Co-authored-by: Ahmad Malik Ibrahim <ahm.ibr@hotmail.com>
1 parent 02e81f6 commit 447e56d

File tree

5,748 files changed

+1762267
-5
lines changed

Some content is hidden

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

5,748 files changed

+1762267
-5
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Generate Repository Matrix
2+
description: Generates a matrix of repositories from the repositories.json file
3+
inputs:
4+
repoRoot:
5+
description: The root directory of the repository
6+
required: true
7+
type: string
8+
outputs:
9+
matrix:
10+
description: JSON matrix of repositories
11+
value: ${{ steps.generate.outputs.matrix }}
12+
repositories:
13+
description: Complete repositories configuration as JSON
14+
value: ${{ steps.generate.outputs.repositories }}
15+
runs:
16+
using: 'composite'
17+
steps:
18+
- name: generate matrix
19+
id: generate
20+
shell: bash
21+
run: |
22+
set -e
23+
24+
# Read repositories.json and properly escape for GitHub Actions
25+
repositories_json=$(cat ${{ inputs.repoRoot }}/.github/repositories.json | jq -c .)
26+
echo "repositories=$repositories_json" >> $GITHUB_OUTPUT
27+
28+
# Extract repository names for matrix
29+
repository_names=$(echo "$repositories_json" | jq -r 'keys')
30+
matrix_json=$(echo "$repository_names" | jq -c '{"repository": .}')
31+
echo "matrix=$matrix_json" >> $GITHUB_OUTPUT

.github/dependabot.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: gomod
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
commit-message:
8+
prefix: ":seedling:"
9+
open-pull-requests-limit: 3
10+
- package-ecosystem: "github-actions"
11+
directory: "/"
12+
schedule:
13+
interval: "weekly"
14+
commit-message:
15+
prefix: ":seedling:"
16+
groups:
17+
github-actions:
18+
patterns:
19+
- "*"
20+
# These actions directly influence the build process and are excluded from grouped updates
21+
exclude-patterns:
22+
- "actions/setup-go"
23+
- "arduino/setup-protoc"
24+
- "goreleaser/goreleaser-action"

.github/repositories.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"fleetconfig-controller": {
3+
"e2e-artifacts": ["hub-bundle.tar.gz", "spoke-bundle.tar.gz"]
4+
}
5+
}

.github/workflows/chart-upload.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: ChartUpload
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
release:
8+
types: [published]
9+
10+
jobs:
11+
env:
12+
name: prepare release env
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 1
19+
path: go/src/open-cluster-management.io/lab
20+
21+
- name: get release version
22+
run: |
23+
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
24+
25+
- name: get major release version
26+
run: |
27+
echo "MAJOR_RELEASE_VERSION=${RELEASE_VERSION%.*}" >> $GITHUB_ENV
28+
echo "TRIMMED_RELEASE_VERSION=${RELEASE_VERSION#v}" >> $GITHUB_ENV
29+
30+
- name: generate matrix
31+
id: generate-matrix
32+
uses: ./go/src/open-cluster-management.io/lab/.github/actions/generate-repo-matrix
33+
with:
34+
repoRoot: go/src/open-cluster-management.io/lab
35+
outputs:
36+
MAJOR_RELEASE_VERSION: ${{ env.MAJOR_RELEASE_VERSION }}
37+
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
38+
TRIMMED_RELEASE_VERSION: ${{ env.TRIMMED_RELEASE_VERSION }}
39+
MATRIX: ${{ steps.generate-matrix.outputs.matrix }}
40+
41+
upload:
42+
name: upload
43+
runs-on: ubuntu-latest
44+
needs: [env]
45+
permissions:
46+
contents: write
47+
strategy:
48+
matrix: ${{ fromJson(needs.env.outputs.MATRIX) }}
49+
steps:
50+
- name: submit fleetconfig-controller chart to OCM chart repo
51+
if: github.event_name != 'pull_request'
52+
uses: actions/github-script@v7
53+
with:
54+
github-token: ${{ secrets.OCM_BOT_PAT }}
55+
script: |
56+
try {
57+
const result = await github.rest.actions.createWorkflowDispatch({
58+
owner: 'open-cluster-management-io',
59+
repo: 'helm-charts',
60+
workflow_id: 'download-chart.yml',
61+
ref: 'main',
62+
inputs: {
63+
repo: "${{ github.repository }}",
64+
version: "${{ needs.env.outputs.TRIMMED_RELEASE_VERSION }}",
65+
"chart-name": "${{ matrix.repository }}",
66+
},
67+
})
68+
console.log(result);
69+
} catch(error) {
70+
console.error(error);
71+
core.setFailed(error);
72+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Dependency Review Action
2+
#
3+
# This Action will scan dependency manifest files that change as part of a Pull Request,
4+
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
5+
# Once installed, if the workflow run is marked as required,
6+
# PRs introducing known-vulnerable packages will be blocked from merging.
7+
#
8+
# Source repository: https://github.com/actions/dependency-review-action
9+
name: 'Dependency Review'
10+
on: [pull_request]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
dependency-review:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
21+
with:
22+
egress-policy: audit
23+
24+
- name: 'Checkout Repository'
25+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
26+
27+
- name: 'Dependency Review'
28+
uses: actions/dependency-review-action@ce3cf9537a52e8119d91fd484ab5b8a807627bf8 # v4.6.0

.github/workflows/e2e.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: E2E
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
repo:
7+
required: true
8+
type: string
9+
artifacts:
10+
required: false
11+
type: string
12+
13+
env:
14+
GO_REQUIRED_MIN_VERSION: ''
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
e2e:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Install DevSpace
27+
uses: loft-sh/setup-devspace@main
28+
29+
- name: Setup Go
30+
uses: actions/setup-go@v5
31+
with:
32+
go-version: 1.24.4
33+
34+
- name: Test E2E
35+
run: |
36+
cd ${{ inputs.repo }} && make test-e2e
37+
38+
- name: Upload Artifacts
39+
if: |
40+
(success() || failure()) && inputs.artifacts != ''
41+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
42+
with:
43+
name: e2e-artifacts
44+
path: ${{ inputs.artifacts }}
45+
if-no-files-found: ignore
46+
retention-days: 7

.github/workflows/planner.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Planner
2+
3+
on:
4+
pull_request:
5+
pull_request_target:
6+
types: [unlabeled]
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: planner-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
generate-matrix:
15+
runs-on: ubuntu-latest
16+
# Skip this job (and subsequently all other planner jobs) if the PR has the `skip-ci` label
17+
if: |
18+
! contains(github.event.pull_request.labels.*.name, 'skip-ci')
19+
permissions:
20+
contents: read
21+
id-token: write
22+
outputs:
23+
matrix: ${{ steps.generate.outputs.matrix }}
24+
repositories: ${{ steps.repo-matrix.outputs.repositories }}
25+
artifacts: ${{ steps.generate.outputs.artifacts }}
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
29+
with:
30+
fetch-depth: 0
31+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
32+
33+
- name: Compute diff refs
34+
id: compute-refs
35+
run: |
36+
set -e
37+
38+
BASE_SHA=${{ github.event.pull_request.base.sha }}
39+
HEAD_SHA=${{ github.event.after || github.event.pull_request.head.sha }}
40+
41+
# Ensure we have both the base and head commits
42+
git fetch --depth=1 origin $BASE_SHA
43+
git fetch --depth=1 origin $HEAD_SHA
44+
echo "BASE_SHA=$BASE_SHA" >> $GITHUB_ENV
45+
echo "HEAD_SHA=$HEAD_SHA" >> $GITHUB_ENV
46+
47+
echo "Diff will compare main ($BASE_SHA) with $HEAD_SHA"
48+
49+
- name: Generate repository matrix
50+
id: repo-matrix
51+
uses: ./.github/actions/generate-repo-matrix
52+
with:
53+
repoRoot: "."
54+
55+
- name: Build changed project matrix
56+
id: generate
57+
run: |
58+
set -e
59+
60+
# Get repository names and check for changes
61+
repositories_json='${{ steps.repo-matrix.outputs.repositories }}'
62+
changed_repos=()
63+
64+
# Check each repository for changes
65+
while IFS= read -r repo; do
66+
if git diff --name-only $BASE_SHA $HEAD_SHA | grep "^$repo/" > /dev/null 2>&1; then
67+
changed_repos+=("$repo")
68+
fi
69+
done < <(echo "$repositories_json" | jq -r 'keys[]')
70+
71+
if [ ${#changed_repos[@]} -eq 0 ]; then
72+
echo "No changes detected for any project"
73+
echo "matrix=" >> $GITHUB_OUTPUT
74+
echo "artifacts={}" >> $GITHUB_OUTPUT
75+
else
76+
# Convert changed repos array to JSON
77+
changed_repos_json=$(printf '%s\n' "${changed_repos[@]}" | jq -R . | jq -s .)
78+
matrixJson=$(echo "$changed_repos_json" | jq -c '{"repo": .}')
79+
80+
# Generate artifacts JSON with workspace prefix
81+
artifacts_json=$(echo "$repositories_json" | jq -c \
82+
--argjson changed_repos "$changed_repos_json" \
83+
--arg workspace "${{ github.workspace }}" \
84+
'to_entries |
85+
map(select(.key as $repo | $changed_repos | index($repo) != null)) |
86+
from_entries |
87+
with_entries(.key as $repo | .value = (.value["e2e-artifacts"] | map($workspace + "/" + $repo + "/" + .) | join("\n")))')
88+
89+
echo "matrix=$matrixJson" >> $GITHUB_OUTPUT
90+
echo "artifacts=$artifacts_json" >> $GITHUB_OUTPUT
91+
fi
92+
93+
echo "Matrix: $matrixJson"
94+
echo "Artifacts: $artifacts_json"
95+
96+
call-test:
97+
name: test
98+
needs: generate-matrix
99+
if: |
100+
needs.generate-matrix.outputs.matrix != ''
101+
strategy:
102+
fail-fast: false
103+
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
104+
uses: ./.github/workflows/test.yml
105+
with:
106+
repo: ${{ matrix.repo }}
107+
secrets: inherit
108+
109+
call-e2e:
110+
name: e2e
111+
needs: generate-matrix
112+
if: |
113+
needs.generate-matrix.outputs.matrix != ''
114+
strategy:
115+
fail-fast: false
116+
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
117+
uses: ./.github/workflows/e2e.yml
118+
with:
119+
repo: ${{ matrix.repo }}
120+
artifacts: ${{ fromJson(needs.generate-matrix.outputs.artifacts)[matrix.repo] }}
121+
secrets: inherit

0 commit comments

Comments
 (0)