Skip to content

Commit e349f77

Browse files
authored
feat: Repleaced kustomize binary with kubectl kustomize
Co-authored-by: wchomik <[email protected]>
1 parent 66f1f85 commit e349f77

File tree

10 files changed

+17
-51
lines changed

10 files changed

+17
-51
lines changed

manifests/test/kustomize/helloWorld/helloWorld.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,41 @@ data:
55
kind: ConfigMap
66
metadata:
77
labels:
8-
app: hello2
8+
app: hello3
99
name: the-map
1010
---
1111
apiVersion: v1
1212
kind: Service
1313
metadata:
1414
labels:
15-
app: hello2
15+
app: hello3
1616
name: the-service
1717
spec:
1818
ports:
1919
- port: 8666
2020
protocol: TCP
2121
targetPort: 8080
2222
selector:
23-
app: hello2
23+
app: hello3
2424
deployment: hello
2525
type: LoadBalancer
2626
---
2727
apiVersion: apps/v1
2828
kind: Deployment
2929
metadata:
3030
labels:
31-
app: hello2
31+
app: hello3
3232
name: the-deployment
3333
spec:
3434
replicas: 3
3535
selector:
3636
matchLabels:
37-
app: hello2
37+
app: hello3
3838
deployment: hello
3939
template:
4040
metadata:
4141
labels:
42-
app: hello2
42+
app: hello3
4343
deployment: hello
4444
spec:
4545
containers:

test/kustomize/helloWorld/.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.3
1+
1.2.4

test/kustomize/helloWorld/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
# Example configuration for the webserver
77
# at https://github.com/monopole/hello
88
commonLabels:
9-
app: hello2
9+
app: hello3
1010

1111
resources:
1212
- deployment.yaml

typescript/packages/k8s-manifest-templating/dist/index.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66811,15 +66811,7 @@ async function runKustomizeTemplating(prefix, GITHUB_WORKSPACE, listingYamlManif
6681166811
fs.mkdirSync(path.format(manifestTargetFolder), { recursive: true });
6681266812
core.debug('Created folder: ' + path.format(manifestTargetFolder));
6681366813
try {
66814-
// Check if kustomize is available
6681566814
const { execSync } = __nccwpck_require__(5317);
66816-
try {
66817-
execSync('which kustomize', { stdio: 'pipe' });
66818-
}
66819-
catch {
66820-
core.setFailed('kustomize command not found. Please install kustomize: https://kubectl.docs.kubernetes.io/installation/kustomize/');
66821-
return;
66822-
}
6682366815
// Determine the source path for kustomize build
6682466816
// We need to combine the base directory with the relative path to get the actual project directory
6682566817
const projectPath = path.join(GITHUB_WORKSPACE, listingYamlRelativePath);
@@ -66828,7 +66820,7 @@ async function runKustomizeTemplating(prefix, GITHUB_WORKSPACE, listingYamlManif
6682866820
const manifestFileName = `${prefix}${listingYamlRelativePath.split('/').pop()}.yaml`;
6682966821
const manifestFilePath = path.join(path.format(manifestTargetFolder), manifestFileName);
6683066822
core.info(`Running kustomize build on ${sourcePath}`);
66831-
const result = execSync(`kustomize build ${sourcePath}`, {
66823+
const result = execSync(`kubectl kustomize ${sourcePath}`, {
6683266824
encoding: 'utf8',
6683366825
stdio: 'pipe'
6683466826
});

typescript/packages/k8s-manifest-templating/dist/index.js.map

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

typescript/packages/k8s-manifest-templating/src/main.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -287,15 +287,7 @@ async function runKustomizeTemplating(
287287
core.debug('Created folder: ' + path.format(manifestTargetFolder))
288288

289289
try {
290-
// Check if kustomize is available
291290
const { execSync } = require('child_process')
292-
try {
293-
execSync('which kustomize', { stdio: 'pipe' })
294-
} catch {
295-
core.setFailed('kustomize command not found. Please install kustomize: https://kubectl.docs.kubernetes.io/installation/kustomize/')
296-
return
297-
}
298-
299291
// Determine the source path for kustomize build
300292
// We need to combine the base directory with the relative path to get the actual project directory
301293
const projectPath = path.join(GITHUB_WORKSPACE, listingYamlRelativePath)
@@ -306,7 +298,7 @@ async function runKustomizeTemplating(
306298
const manifestFilePath = path.join(path.format(manifestTargetFolder), manifestFileName)
307299

308300
core.info(`Running kustomize build on ${sourcePath}`)
309-
const result = execSync(`kustomize build ${sourcePath}`, {
301+
const result = execSync(`kubectl kustomize ${sourcePath}`, {
310302
encoding: 'utf8',
311303
stdio: 'pipe'
312304
})

typescript/packages/kustomize/manifest-validation/dist/index.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66646,18 +66646,9 @@ async function run() {
6664666646
// Check if validation is enabled for this directory
6664766647
if (dist_1.utils.isFunctionEnabled(dir, dist_1.constants.Functionality.kustomizeListing, true)) {
6664866648
try {
66649-
// Run kustomize build to validate the manifest
6665066649
core.info(`Validating Kustomize project in ${listingYamlDir}`);
66651-
// Check if kustomize is available
66652-
try {
66653-
(0, child_process_1.execSync)('which kustomize', { stdio: 'pipe' });
66654-
}
66655-
catch {
66656-
core.setFailed('kustomize command not found. Please install kustomize: https://kubectl.docs.kubernetes.io/installation/kustomize/');
66657-
return;
66658-
}
66659-
// Run kustomize build --dry-run to validate without applying
66660-
const result = (0, child_process_1.execSync)(`kustomize build ${listingYamlDir}`, {
66650+
// Run kubectl kustomize to validate
66651+
const result = (0, child_process_1.execSync)(`kubectl kustomize ${listingYamlDir}`, {
6666166652
encoding: 'utf8',
6666266653
stdio: 'pipe'
6666366654
});

typescript/packages/kustomize/manifest-validation/dist/index.js.map

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

typescript/packages/kustomize/manifest-validation/dist/src/main.d.ts.map

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

typescript/packages/kustomize/manifest-validation/src/main.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,10 @@ export async function run(): Promise<void> {
5757
// Check if validation is enabled for this directory
5858
if (utils.isFunctionEnabled(dir, constants.Functionality.kustomizeListing, true)) {
5959
try {
60-
// Run kustomize build to validate the manifest
6160
core.info(`Validating Kustomize project in ${listingYamlDir}`)
6261

63-
// Check if kustomize is available
64-
try {
65-
execSync('which kustomize', { stdio: 'pipe' })
66-
} catch {
67-
core.setFailed('kustomize command not found. Please install kustomize: https://kubectl.docs.kubernetes.io/installation/kustomize/')
68-
return
69-
}
70-
71-
// Run kustomize build --dry-run to validate without applying
72-
const result = execSync(`kustomize build ${listingYamlDir}`, {
62+
// Run kubectl kustomize to validate
63+
const result = execSync(`kubectl kustomize ${listingYamlDir}`, {
7364
encoding: 'utf8',
7465
stdio: 'pipe'
7566
})

0 commit comments

Comments
 (0)