Skip to content

Commit

Permalink
fix(devenv): detect kpt in skaffold.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
vkumbhar94 committed Oct 21, 2023
1 parent f8991b6 commit b1ab140
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 0 additions & 1 deletion fixtures/skaffold.yaml/manifests/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ kind: Config
metadata:
name: skaffold-fixture
manifests:
# FIXME: ktp cli isn't yet on pkgx pantry
kpt: []
kustomize: {}
helm:
Expand Down
2 changes: 0 additions & 2 deletions fixtures/skaffold.yaml/std/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ deploy:
kubeContext: minikube
kubectl: {}
helm: {}
# FIXME: ktp cli isn't yet on pkgx pantry
kpt: {}
docker:
images: []
manifests:
# FIXME: ktp cli isn't yet on pkgx pantry
kpt: []
kustomize: {}
helm:
Expand Down
5 changes: 4 additions & 1 deletion src/utils/devenv.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,16 @@ Deno.test("devenv.ts", async runner => {
const f = Path.mktemp().join('skaffold.yaml').touch()
f.parent().join("skaffold.yaml").rm().write({text: ""})
const {env, pkgs} = await specimen(f.parent())
console.assert(pkgs.length === 0, "invalid skaffold.yaml should not return any dep")
// only skafflold.dev, no other dep expected
assert(pkgs.length === 1, "invalid skaffold.yaml should not return any dep")

const keyfiles = [
[
'skaffold.yaml/std/skaffold.yaml',
'skaffold.dev',
'kubernetes.io/kubectl',
'helm.sh',
'kpt.dev',
'kubernetes.io/minikube',
'docker.com/cli',
'kubernetes.io/kustomize'
Expand All @@ -166,6 +168,7 @@ Deno.test("devenv.ts", async runner => {
'skaffold.yaml/manifests/skaffold.yaml',
'skaffold.dev',
'helm.sh',
'kpt.dev',
'kubernetes.io/kustomize'
],
]
Expand Down
6 changes: 6 additions & 0 deletions src/utils/devenv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ export default async function(dir: Path) {
constraint: new semver.Range(`*`)
})
}
if (yaml.deploy?.kpt || yaml.manifests?.kpt){
pkgs.push({
project: "kpt.dev",
constraint: new semver.Range(`*`)
})
}
if (yaml.manifests?.kustomize){
pkgs.push({
project: "kubernetes.io/kustomize",
Expand Down

0 comments on commit b1ab140

Please sign in to comment.