Skip to content

Commit 54848c1

Browse files
committed
fix: support helm v4 beside v3 and remove -c flag for helm version as it does nothing
features.
1 parent 77b3446 commit 54848c1

12 files changed

Lines changed: 218 additions & 65 deletions

File tree

.github/workflows/apidiff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
1414
steps:
1515
- name: Clone the code
16-
uses: actions/checkout@v5
16+
uses: actions/checkout@v6
1717
with:
1818
fetch-depth: 0
1919
- name: Setup Go

.github/workflows/go.yml

Lines changed: 75 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@ name: Go
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master]
66
pull_request:
7-
branches: [ master ]
7+
branches: [master]
88

99
permissions:
1010
contents: read
1111

1212
jobs:
13+
## TODO: conditional-changes checker is not working
1314
conditional-changes:
1415
runs-on: ubuntu-latest
1516
permissions:
1617
pull-requests: read
1718
outputs:
1819
doc: ${{ steps.filter.outputs.doc }}
1920
steps:
20-
- uses: actions/checkout@v5
21+
- uses: actions/checkout@v6
2122
- uses: dorny/paths-filter@v3
2223
id: filter
2324
with:
@@ -27,18 +28,21 @@ jobs:
2728
2829
check-modules:
2930
name: check-synced-go-modules
30-
needs: conditional-changes
31+
# needs: conditional-changes
3132
# if: needs.conditional-changes.outputs.doc == 'false'
3233
runs-on: [ubuntu-latest]
3334
steps:
3435
- name: Check out code into the Go module directory
35-
uses: actions/checkout@v5
36+
uses: actions/checkout@v6
3637
with:
3738
fetch-depth: 0
3839
- name: Set up Go 1.x
3940
uses: actions/setup-go@v6
4041
with:
4142
go-version-file: go.work
43+
cache: true
44+
cache-dependency-path: |
45+
**/go.sum
4246
id: go
4347
- name: sync go modules
4448
run: make workspace-sync
@@ -47,84 +51,108 @@ jobs:
4751

4852
lint:
4953
name: Lint
50-
needs: conditional-changes
54+
# needs: conditional-changes
5155
# if: needs.conditional-changes.outputs.doc == 'false'
5256
runs-on: [ubuntu-latest]
5357
steps:
5458
- name: Check out code into the Go module directory
55-
uses: actions/checkout@v5
59+
uses: actions/checkout@v6
5660
with:
5761
fetch-depth: 0
5862
- name: Set up Go 1.x
5963
uses: actions/setup-go@v6
6064
with:
6165
go-version-file: go.work
66+
cache: true
67+
cache-dependency-path: |
68+
**/go.sum
6269
id: go
6370
- name: Lint
6471
run: make lint
6572
- name: Verify boilerplate
6673
run: make check-license
6774

68-
test-linux:
75+
## Test all modules without plugins and released modules
76+
test-non-released-modules:
6977
name: Test Linux
70-
needs: conditional-changes
78+
# needs: conditional-changes
7179
# if: needs.conditional-changes.outputs.doc == 'false'
7280
runs-on: [ubuntu-latest]
7381
steps:
7482
- name: Check out code into the Go module directory
75-
uses: actions/checkout@v5
83+
uses: actions/checkout@v6
7684
- name: Set up Go 1.x
7785
uses: actions/setup-go@v6
7886
with:
7987
go-version-file: go.work
88+
cache: true
89+
cache-dependency-path: |
90+
**/go.sum
8091
id: go
81-
- name: Test all modules
82-
run: make test-unit-non-plugin
92+
- name: Test all modules without plugins and released modules
93+
run: make test-unit-non-plugin-and-non-released
8394
env:
8495
KUSTOMIZE_DOCKER_E2E: true
8596

86-
test-macos:
87-
name: Test MacOS
88-
needs: conditional-changes
97+
test-modules:
98+
name: Test ${{ matrix.os }} - ${{ matrix.module }}
99+
# needs: conditional-changes
89100
# if: needs.conditional-changes.outputs.doc == 'false'
90-
runs-on: [macos-latest]
101+
runs-on: ${{ matrix.os }}
102+
strategy:
103+
fail-fast: false
104+
matrix:
105+
os: [ubuntu-latest, macos-latest, windows-latest]
106+
module:
107+
- kyaml
108+
- cmd/config
109+
- api
110+
- kustomize
111+
include:
112+
- module: kyaml
113+
test-cmd: go test -race -v -cover ./...
114+
- module: cmd/config
115+
test-cmd: go test -v -cover ./...
116+
- module: api
117+
test-cmd: go test -v -cover ./... -ldflags "-X sigs.k8s.io/kustomize/api/provenance.buildDate=2023-01-31T23:38:41Z -X sigs.k8s.io/kustomize/api/provenance.version=(test)"
118+
- module: kustomize
119+
test-cmd: go test -v -cover ./...
120+
- os: ubuntu-latest
121+
docker-e2e: true
122+
- os: macos-latest
123+
docker-e2e: false
124+
- os: windows-latest
125+
docker-e2e: false
126+
env:
127+
KUSTOMIZE_DOCKER_E2E: ${{ matrix.docker-e2e }}
91128
steps:
92129
- name: Check out code into the Go module directory
93-
uses: actions/checkout@v5
130+
uses: actions/checkout@v6
94131
- name: Set up Go 1.x
95132
uses: actions/setup-go@v6
96133
with:
97134
go-version-file: go.work
135+
cache: true
136+
cache-dependency-path: |
137+
**/go.sum
98138
id: go
99-
- name: Test all modules
100-
run: make test-unit-non-plugin
101-
env:
102-
KUSTOMIZE_DOCKER_E2E: false # docker not installed on mac
139+
- name: Test ${{ matrix.module }}
140+
run: ${{ matrix.test-cmd }}
141+
# TODO (#4001): replace specific modules above with this once Windows tests are passing.
142+
if: ${{ !(matrix.os == 'windows-latest' && (matrix.module == 'api' || matrix.module == 'kustomize')) }}
143+
working-directory: ./${{ matrix.module }}
103144

104-
test-windows:
105-
name: Test Windows
106-
needs: conditional-changes
107-
# if: needs.conditional-changes.outputs.doc == 'false'
108-
runs-on: [windows-latest]
145+
# Aggregation matrix tests from test-modules for branch protection rules
146+
test-modules-summary:
147+
name: Test Summary
148+
runs-on: ubuntu-latest
149+
needs: test-modules
150+
if: always()
109151
steps:
110-
- name: Check out code into the Go module directory
111-
uses: actions/checkout@v5
112-
- name: Set up Go 1.x
113-
uses: actions/setup-go@v6
114-
with:
115-
go-version-file: go.work
116-
id: go
117-
- name: Test kyaml
118-
run: go test -cover ./...
119-
working-directory: ./kyaml
120-
- name: Test cmd/config
121-
run: go test -cover ./...
122-
working-directory: ./cmd/config
123-
env:
124-
KUSTOMIZE_DOCKER_E2E: false # docker on windows not working well yet
125-
126-
# TODO (#4001): replace specific modules above with this once Windows tests are passing.
127-
#- name: Test all modules
128-
# run: make test-unit-non-plugin
129-
# env:
130-
# KUSTOMIZE_DOCKER_E2E: false # docker on windows not working well yet
152+
- name: Check test results
153+
run: |
154+
if [[ "${{ needs.test-modules.result }}" != "success" ]]; then
155+
echo "Some tests failed or were cancelled"
156+
exit 1
157+
fi
158+
echo "All tests passed successfully"

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Check out code into the Go module directory
19-
uses: actions/checkout@v5
19+
uses: actions/checkout@v6
2020
with:
2121
fetch-depth: 0
2222
- name: Set up Go 1.x

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,15 @@ test-unit-all: \
136136
test-unit-non-plugin \
137137
test-unit-kustomize-plugins
138138

139-
# This target is used by our Github Actions CI to run unit tests for all non-plugin modules in multiple GOOS environments.
140139
.PHONY: test-unit-non-plugin
141140
test-unit-non-plugin:
142141
./hack/for-each-module.sh "make test" "./plugin/*" 20
143142

143+
# This target is used by our Github Actions CI to run unit tests for all non-plugin and non-released modules in multiple GOOS environments.
144+
.PHONY: test-unit-non-plugin-and-non-released
145+
test-unit-non-plugin-and-non-released:
146+
./hack/for-each-module.sh "make test" "./plugin/*|./kyaml/go.mod|./cmd/config/go.mod|./api/go.mod|./kustomize/go.mod" 16
147+
144148
.PHONY: build-non-plugin-all
145149
build-non-plugin-all:
146150
./hack/for-each-module.sh "make build" "./plugin/*" 20
@@ -183,7 +187,7 @@ test-examples-kustomize-against-latest-release: $(MYGOBIN)/mdrip
183187
workspace-sync:
184188
go work sync
185189
./hack/doGoMod.sh tidy
186-
190+
187191
# --- Cleanup targets ---
188192
.PHONY: clean
189193
clean: clean-kustomize-external-go-plugin uninstall-tools

api/internal/builtins/HelmChartInflationGenerator.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/internal/builtins/PatchTransformer.go

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/internal/loader/fileloader_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,5 +686,5 @@ func TestLoaderHTTPMalformedURL(t *testing.T) {
686686
RestrictionRootOnly, MakeFakeFs([]testData{}), filesys.Separator)
687687
_, err := l1.Load(malformedURL)
688688
require.Error(err)
689-
require.Equal("HTTP Error: status code 500 (Internal Server Error)", err.Error())
689+
require.Equal("HTTP Error: status code 400 (Bad Request)", err.Error())
690690
}

api/krusty/helmchartinflationgenerator_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,6 @@ kind: Service
11741174
metadata:
11751175
annotations:
11761176
helm-namespace: helm-ns
1177-
internal.config.kubernetes.io/helm-generated: "true"
11781177
name: test-service
11791178
namespace: helm-ns
11801179
`)

0 commit comments

Comments
 (0)