From b51dba096940e885cde868c1168580e102bcba9d Mon Sep 17 00:00:00 2001 From: Sundara Gurunathan Date: Sat, 24 Jan 2026 01:22:40 +0000 Subject: [PATCH 1/5] add multi-stage CI for build, test, helm and docker --- .github/workflows/ci.yaml | 122 ++++++++++++++++++ .../network_config_reconciler_test.go | 10 +- 2 files changed, 127 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..f154310e --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,122 @@ +name: CI + +on: + push: + branches: [ "main", "develop" ] + pull_request: + branches: [ "main", "develop" ] + +env: + GOFLAGS: "-mod=mod" + CONTAINER_ENGINE: docker + +jobs: + # ========================= + # Build + Generate + Manifests + # ========================= + build: + name: Build & Generate + runs-on: ubuntu-22.04 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y make gcc git curl + + - name: Vendor dependencies + run: make vendor + + - name: Generate code + run: make generate + + - name: Build manager binary + run: make manager + + - name: Generate manifests + run: make manifests + + # ========================= + # Unit tests + # ========================= + unit-test: + name: Unit Tests + runs-on: ubuntu-22.04 + needs: build + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Run unit tests + run: make unit-test + + # ========================= + # Helm build (k8s) + # ========================= + helm-build: + name: Helm Build (k8s) + runs-on: ubuntu-22.04 + needs: build + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y make curl + + - name: Install Helm + uses: azure/setup-helm@v4 + with: + version: v3.14.4 + + - name: Generate Helm charts (k8s) + run: make helm-k8s + + # ========================= + # Docker image build + # ========================= + docker-build: + name: Docker Build + runs-on: ubuntu-22.04 + needs: build + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + + - name: Build Docker image + run: make docker-build + diff --git a/internal/controllers/network_config_reconciler_test.go b/internal/controllers/network_config_reconciler_test.go index c49dfe74..c903eb0b 100644 --- a/internal/controllers/network_config_reconciler_test.go +++ b/internal/controllers/network_config_reconciler_test.go @@ -94,7 +94,7 @@ var _ = Describe("getLabelsPerModules", func() { BeforeEach(func() { ctrl := gomock.NewController(GinkgoT()) kubeClient = mock_client.NewMockClient(ctrl) - dcrh = newNetworkConfigReconcilerHelper(kubeClient, nil, nil, nil, nil, nil, nil, nil, nil) + dcrh = newNetworkConfigReconcilerHelper(kubeClient, nil, nil, nil, nil, nil, nil, nil) }) ctx := context.Background() @@ -139,7 +139,7 @@ var _ = Describe("setFinalizer", func() { BeforeEach(func() { ctrl := gomock.NewController(GinkgoT()) kubeClient = mock_client.NewMockClient(ctrl) - dcrh = newNetworkConfigReconcilerHelper(kubeClient, nil, nil, nil, nil, nil, nil, nil, nil) + dcrh = newNetworkConfigReconcilerHelper(kubeClient, nil, nil, nil, nil, nil, nil, nil) }) ctx := context.Background() @@ -175,7 +175,7 @@ var _ = PDescribe("finalizeNetworkConfig", func() { BeforeEach(func() { ctrl := gomock.NewController(GinkgoT()) kubeClient = mock_client.NewMockClient(ctrl) - dcrh = newNetworkConfigReconcilerHelper(kubeClient, nil, nil, nil, nil, nil, nil, nil, nil) + dcrh = newNetworkConfigReconcilerHelper(kubeClient, nil, nil, nil, nil, nil, nil, nil) }) ctx := context.Background() @@ -345,7 +345,7 @@ var _ = PDescribe("handleKMMModule", func() { ctrl := gomock.NewController(GinkgoT()) kubeClient = mock_client.NewMockClient(ctrl) kmmHelper = kmmmodule.NewMockKMMModuleAPI(ctrl) - dcrh = newNetworkConfigReconcilerHelper(kubeClient, kmmHelper, nil, nil, nil, nil, nil, nil, nil) + dcrh = newNetworkConfigReconcilerHelper(kubeClient, kmmHelper, nil, nil, nil, nil, nil, nil) }) ctx := context.Background() @@ -413,7 +413,7 @@ var _ = Describe("handleBuildConfigMap", func() { ctrl := gomock.NewController(GinkgoT()) kubeClient = mock_client.NewMockClient(ctrl) kmmHelper = kmmmodule.NewMockKMMModuleAPI(ctrl) - dcrh = newNetworkConfigReconcilerHelper(kubeClient, kmmHelper, nil, nil, nil, nil, nil, nil, nil) + dcrh = newNetworkConfigReconcilerHelper(kubeClient, kmmHelper, nil, nil, nil, nil, nil, nil) }) ctx := context.Background() From 42debd10b35dfa8f39bc106bad33181b8e1ec547 Mon Sep 17 00:00:00 2001 From: Sundara Gurunathan Date: Sat, 24 Jan 2026 01:31:30 +0000 Subject: [PATCH 2/5] gitmodules change --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 9aa86a34..271cbb7e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "external/common-infra-operator"] path = external/common-infra-operator - url = git@github.com:ROCm/common-infra-operator.git + url = https://github.com/ROCm/common-infra-operator.git branch = main From e322a4ea9693eb8b66ac5237cfc484e1a565fe2b Mon Sep 17 00:00:00 2001 From: Sundara Gurunathan Date: Sat, 24 Jan 2026 01:32:21 +0000 Subject: [PATCH 3/5] Revert "gitmodules change" This reverts commit 42debd10b35dfa8f39bc106bad33181b8e1ec547. --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 271cbb7e..9aa86a34 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "external/common-infra-operator"] path = external/common-infra-operator - url = https://github.com/ROCm/common-infra-operator.git + url = git@github.com:ROCm/common-infra-operator.git branch = main From e99b7fb6f9ac312f73b58d1cb4d27cd3451952d6 Mon Sep 17 00:00:00 2001 From: Sundara Gurunathan Date: Sat, 24 Jan 2026 01:33:26 +0000 Subject: [PATCH 4/5] skip submodule pull --- .github/workflows/ci.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f154310e..28964d2b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,11 +19,6 @@ jobs: runs-on: ubuntu-22.04 steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Set up Go uses: actions/setup-go@v5 with: From 16bab965af8b7d5f53cbb5f20befb297a0c8729e Mon Sep 17 00:00:00 2001 From: Sundara Gurunathan Date: Sat, 24 Jan 2026 01:35:00 +0000 Subject: [PATCH 5/5] skip vendor --- .github/workflows/ci.yaml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 28964d2b..9e1eef61 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,20 +19,6 @@ jobs: runs-on: ubuntu-22.04 steps: - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - cache: true - - - name: Install system dependencies - run: | - sudo apt-get update - sudo apt-get install -y make gcc git curl - - - name: Vendor dependencies - run: make vendor - - name: Generate code run: make generate