Open MichaelSp opened 2 years ago
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle stale
/lifecycle rotten
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
/remove-lifecycle stale
Hit us today. This hurts our automation and made us revert to YQ instead (which is far from ideal)
I can reproduce this issue. Same thing happens on v4.5.7 as well. My output is mostly the same, except the second resource is an empty string instead of being removed. Please see below.
# some important comment to below file:
resources:
- https://raw.githubusercontent.com/argoproj/argo-cd/v2.2.5/manifests/ha/install.yaml
- ""
images:
- name: argo
newName: argo
newTag: "234"
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
/triage accepted
If anyone is interested in picking this up, I think one potential solution could be to use kyaml's CopyComments
and SyncOrder
functions to maintain the comments and field order of the kustomization.
This probably isn't specific to set image
, I imagine all the kustomize edit commands have similar problems.
/help /label "good first issue"
@natasha41575: This request has been marked as needing help from a contributor.
Please ensure that the issue body includes answers to the following questions:
For more details on the requirements of such an issue, please see here and ensure that they are met.
If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-help
command.
Thanks @annasong20 for confirming the issue!
I'm new to contribute this repo. If it is ok, I'll try this issue.
Is here right place to discuss how I fix this issue? Or should I discuss a question on slack?
sigs.k8s.io/kustomize/kyaml/yaml.Parse(string)
removes some blank lines in kustomization file and it causes breaking some test cases.
For example, break lines in a Yaml file are removed when the Parse was called. Here is a failed test case I added.
--- FAIL: TestCommentOrder (0.13s)
/home/cloud-user/go/src/k8s-sig.io/kustomize/kustomize/commands/internal/kustfile/kustomizationfile_test.go:239: Mismatch (-expected, +actual):
[]uint8(
"""
-
-
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
... // 3 identical lines
# some comments to below kubernetes file:
- https://example.com/kubernetes.yaml # comment
-
images:
- name: example
... // 3 identical lines
"""
Is there a way to avoid above issue?
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.
This bot triages PRs according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the PR is closedYou can:
/remove-lifecycle stale
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
Hi,
Today I have also faced this issue. Probably we have similar case, when pipeline triggered by new repo tag has to commit new dockerimage version to separate repository. Also I have found out that this issue has been for a while without sufficient solution.
{Version:kustomize/v4.4.0 GitCommit:63ec6bdb3d737a7c66901828c5743656c49b60e1 BuildDate:2021-09-27T16:24:12Z GoOs:linux GoArch:amd64}
I have managed to bypass this issue using yq
:
TAG=$TAG yq -i '(.images[] | select( .name == "image") | .newTag) = strenv(TAG)' kustomization.yaml
ref: https://github.com/kubernetes-sigs/kustomize/issues/3323
/assign
/remove-lifecycle stale
/lifecycle frozen
Describe the bug
After running
kustomize edit set image
. The commentsFiles that can reproduce the issue
before
running command
kustomize edit set image argo=argo:234
Expected outputI could also live with this output:
Actual output
Especially the comment has to stay in the line above the resource!
Kustomize version
{Version:kustomize/v4.5.2 GitCommit:9091919699baf1c5a5bf71b32ca73a993e98088b BuildDate:2022-02-09T23:19:28Z GoOs:darwin GoArch:amd64}