Skip to content

Commit da3ce14

Browse files
rokejcursoragent
andauthored
🌱 Bootstrap standalone repo for graduation from addon-contrib (#1)
* 🌱 Bootstrap standalone repo for graduation from addon-contrib Add OCM governance files, expand OWNERS, document the repo/module name split, implement make verify and chart lint, and add standalone CI/CD workflows for presubmit, DCO, release, image publish, and chart upload. Include weekly Dependabot configuration for Go modules and GitHub Actions. removed an invalid user Signed-off-by: Roke Jung <roke@redhat.com> Co-Authored-By: Cursor <cursoragent@cursor.com> * 🐛 Fix golangci-lint issues so make verify passes Address errcheck, line length, staticcheck, and related lint findings across controllers, addon agent, RBAC, and tests. Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Roke Jung <roke@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Roke Jung <roke@redhat.com> --------- Signed-off-by: Roke Jung <roke@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent a450b6b commit da3ce14

24 files changed

Lines changed: 977 additions & 85 deletions

.github/dependabot.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gomod"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
open-pull-requests-limit: 3
8+
groups:
9+
k8s-io:
10+
patterns:
11+
- "k8s.io/*"
12+
- "sigs.k8s.io/*"
13+
go-opentelemetry-io:
14+
patterns:
15+
- "go.opentelemetry.io/*"
16+
open-cluster-management-io:
17+
patterns:
18+
- "open-cluster-management.io/*"
19+
prometheus:
20+
patterns:
21+
- "github.com/prometheus/*"
22+
google:
23+
patterns:
24+
- "github.com/google/*"
25+
spf13:
26+
patterns:
27+
- "github.com/spf13/*"
28+
testing:
29+
patterns:
30+
- "github.com/onsi/*"
31+
commit-message:
32+
prefix: ":seedling: ci"
33+
include: "scope"
34+
- package-ecosystem: "github-actions"
35+
directory: "/"
36+
schedule:
37+
interval: "weekly"
38+
commit-message:
39+
prefix: ":seedling:"
40+
groups:
41+
github-actions:
42+
patterns:
43+
- "*"

.github/workflows/chart-upload.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: ChartUpload
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
release:
8+
types: [published]
9+
10+
env:
11+
CHART_NAME: dynamic-scoring-framework
12+
13+
jobs:
14+
env:
15+
name: prepare release env
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 1
22+
- name: Get release version
23+
run: echo "RELEASE_VERSION=${{ github.event.release.tag_name }}" >> "$GITHUB_ENV"
24+
- name: Get trimmed release version
25+
run: echo "TRIMED_RELEASE_VERSION=${RELEASE_VERSION#v}" >> "$GITHUB_ENV"
26+
- name: Verify chart version
27+
run: |
28+
grep -q "version: ${TRIMED_RELEASE_VERSION}" "./charts/${CHART_NAME}/Chart.yaml"
29+
outputs:
30+
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
31+
TRIMED_RELEASE_VERSION: ${{ env.TRIMED_RELEASE_VERSION }}
32+
33+
upload:
34+
name: upload
35+
runs-on: ubuntu-latest
36+
needs: [env]
37+
permissions:
38+
contents: read
39+
steps:
40+
- name: Submit chart to OCM chart repo
41+
uses: actions/github-script@v7
42+
with:
43+
github-token: ${{ secrets.OCM_BOT_PAT }}
44+
script: |
45+
try {
46+
const result = await github.rest.actions.createWorkflowDispatch({
47+
owner: 'open-cluster-management-io',
48+
repo: 'helm-charts',
49+
workflow_id: 'download-chart.yml',
50+
ref: 'main',
51+
inputs: {
52+
repo: '${{ github.repository }}',
53+
version: '${{ needs.env.outputs.TRIMED_RELEASE_VERSION }}',
54+
'chart-name': '${{ env.CHART_NAME }}',
55+
},
56+
});
57+
console.log(result);
58+
} catch (error) {
59+
console.error(error);
60+
core.setFailed(error);
61+
}

.github/workflows/dco.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright Contributors to the Open Cluster Management project
2+
3+
name: DCO
4+
5+
on:
6+
workflow_dispatch: {}
7+
pull_request:
8+
branches:
9+
- main
10+
- release-*
11+
12+
jobs:
13+
dco_check:
14+
runs-on: ubuntu-latest
15+
name: DCO Check
16+
steps:
17+
- name: Get PR Commits
18+
id: get-pr-commits
19+
uses: tim-actions/get-pr-commits@master
20+
with:
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
- name: DCO Check
23+
uses: tim-actions/dco@master
24+
with:
25+
commits: ${{ steps.get-pr-commits.outputs.commits }}

.github/workflows/go-presubmit.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Go
2+
3+
on:
4+
workflow_dispatch: {}
5+
push:
6+
branches:
7+
- main
8+
- release-*
9+
pull_request:
10+
branches:
11+
- main
12+
- release-*
13+
14+
env:
15+
GO_VERSION: "1.24"
16+
17+
jobs:
18+
verify:
19+
name: verify
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
- name: Install Go
25+
uses: actions/setup-go@v5
26+
with:
27+
go-version: ${{ env.GO_VERSION }}
28+
cache: true
29+
- name: Setup Helm
30+
uses: azure/setup-helm@v4
31+
with:
32+
version: v3.11.2
33+
- name: Verify
34+
run: make verify
35+
36+
build:
37+
name: build
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
- name: Install Go
43+
uses: actions/setup-go@v5
44+
with:
45+
go-version: ${{ env.GO_VERSION }}
46+
cache: true
47+
- name: Build
48+
run: make build
49+
50+
unit:
51+
name: unit
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Checkout
55+
uses: actions/checkout@v4
56+
- name: Install Go
57+
uses: actions/setup-go@v5
58+
with:
59+
go-version: ${{ env.GO_VERSION }}
60+
cache: true
61+
- name: Unit tests
62+
run: make test-unit
63+
64+
integration:
65+
name: integration
66+
runs-on: ubuntu-latest
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@v4
70+
- name: Install Go
71+
uses: actions/setup-go@v5
72+
with:
73+
go-version: ${{ env.GO_VERSION }}
74+
cache: true
75+
- name: Integration tests
76+
run: make test-integration
77+
78+
chart:
79+
name: chart
80+
runs-on: ubuntu-latest
81+
steps:
82+
- name: Checkout
83+
uses: actions/checkout@v4
84+
- name: Setup Helm
85+
uses: azure/setup-helm@v4
86+
with:
87+
version: v3.11.2
88+
- name: Chart tests
89+
run: make test-chart

.github/workflows/release.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: GoRelease
2+
3+
on:
4+
workflow_dispatch: {}
5+
push:
6+
tags:
7+
- "v*.*.*"
8+
9+
env:
10+
GO_VERSION: "1.24"
11+
GITHUB_REF: ${{ github.ref }}
12+
CHART_NAME: dynamic-scoring-framework
13+
14+
jobs:
15+
env:
16+
name: prepare release env
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 1
23+
- name: Get release version
24+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_ENV"
25+
- name: Get trimmed release version
26+
run: echo "TRIMED_RELEASE_VERSION=${RELEASE_VERSION#v}" >> "$GITHUB_ENV"
27+
- name: Verify chart version
28+
run: |
29+
grep -q "version: ${TRIMED_RELEASE_VERSION}" "./charts/${CHART_NAME}/Chart.yaml"
30+
grep -q "appVersion: \"${TRIMED_RELEASE_VERSION}\"" "./charts/${CHART_NAME}/Chart.yaml"
31+
outputs:
32+
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
33+
TRIMED_RELEASE_VERSION: ${{ env.TRIMED_RELEASE_VERSION }}
34+
35+
release:
36+
name: release
37+
runs-on: ubuntu-latest
38+
needs: [env]
39+
permissions:
40+
contents: write
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
with:
45+
fetch-depth: 1
46+
- name: Setup Helm
47+
uses: azure/setup-helm@v4
48+
with:
49+
version: v3.11.2
50+
- name: Package chart
51+
run: |
52+
mkdir -p release
53+
helm package "charts/${CHART_NAME}" \
54+
--version "${{ needs.env.outputs.TRIMED_RELEASE_VERSION }}" \
55+
--destination release
56+
- name: Generate changelog
57+
run: |
58+
echo "# Dynamic Scoring Framework ${{ needs.env.outputs.RELEASE_VERSION }}" > changelog.txt
59+
- name: Publish release
60+
uses: softprops/action-gh-release@v2
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
with:
64+
body_path: changelog.txt
65+
files: release/*.tgz
66+
draft: true
67+
prerelease: false
68+
generate_release_notes: true

.github/workflows/releaseimage.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: ImageRelease
2+
3+
on:
4+
workflow_dispatch: {}
5+
push:
6+
tags:
7+
- "v*.*.*"
8+
9+
env:
10+
GO_VERSION: "1.24"
11+
GITHUB_REF: ${{ github.ref }}
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
env:
18+
name: prepare release env
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 1
25+
- name: Get release version
26+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_ENV"
27+
outputs:
28+
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
29+
30+
images:
31+
name: images
32+
runs-on: ubuntu-latest
33+
needs: [env]
34+
strategy:
35+
matrix:
36+
arch: [amd64, arm64]
37+
image: [controller, addon]
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 1
43+
- name: Install Go
44+
uses: actions/setup-go@v5
45+
with:
46+
go-version: ${{ env.GO_VERSION }}
47+
cache: true
48+
- name: Log in to Quay
49+
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login quay.io --username "${{ secrets.DOCKER_USER }}" --password-stdin
50+
- name: Build and push controller image
51+
if: matrix.image == 'controller'
52+
env:
53+
IMAGE_BUILD_EXTRA_FLAGS: --build-arg OS=linux --build-arg ARCH=${{ matrix.arch }}
54+
CONTROLLER_IMAGE_TAG: ${{ needs.env.outputs.RELEASE_VERSION }}-${{ matrix.arch }}
55+
run: |
56+
make docker-build-controller
57+
make docker-push-controller
58+
- name: Build and push addon image
59+
if: matrix.image == 'addon'
60+
env:
61+
IMAGE_BUILD_EXTRA_FLAGS: --build-arg OS=linux --build-arg ARCH=${{ matrix.arch }}
62+
ADDON_IMAGE_TAG: ${{ needs.env.outputs.RELEASE_VERSION }}-${{ matrix.arch }}
63+
run: |
64+
make docker-build-addon
65+
make docker-push-addon
66+
67+
image-manifest:
68+
name: image manifest
69+
runs-on: ubuntu-latest
70+
needs: [env, images]
71+
strategy:
72+
matrix:
73+
image: [controller, addon]
74+
steps:
75+
- name: Checkout
76+
uses: actions/checkout@v4
77+
with:
78+
fetch-depth: 1
79+
- name: Log in to Quay
80+
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login quay.io --username "${{ secrets.DOCKER_USER }}" --password-stdin
81+
- name: Create and push controller manifest
82+
if: matrix.image == 'controller'
83+
env:
84+
CONTROLLER_IMAGE_TAG: ${{ needs.env.outputs.RELEASE_VERSION }}
85+
run: make image-manifest-controller
86+
- name: Create and push addon manifest
87+
if: matrix.image == 'addon'
88+
env:
89+
ADDON_IMAGE_TAG: ${{ needs.env.outputs.RELEASE_VERSION }}
90+
run: make image-manifest-addon

0 commit comments

Comments
 (0)