Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Set default behavior to automatically normalize line endings
* text=auto

# Force bash scripts to always use LF line endings
*.sh text eol=lf

# Force batch scripts to always use CRLF line endings
*.bat text eol=crlf
*.cmd text eol=crlf
6 changes: 6 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ jobs:
with:
go-version-file: go/src/github.com/kptdev/kpt/go.mod
cache: true
cache-dependency-path: |
go/src/github.com/kptdev/kpt/go.sum
go/src/github.com/kptdev/kpt/go.mod
- name: Build, Test, Lint
working-directory: ${{ env.GOPATH }}/src/github.com/kptdev/kpt
run: |
Expand All @@ -80,6 +83,9 @@ jobs:
with:
go-version-file: go/src/github.com/kptdev/kpt/go.mod
cache: true
cache-dependency-path: |
go/src/github.com/kptdev/kpt/go.sum
go/src/github.com/kptdev/kpt/go.mod
- name: Build
working-directory: ${{ env.GOPATH }}/src/github.com/kptdev/kpt
run: |
Expand Down
10 changes: 1 addition & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult [GitHub Help] for more
information on using pull requests.

Process for code reviews. Before requesting human review, a PR must:

* All tests passing
* All linting passing
* Meeting project code quality requirements, including passing all configured static analysis / SonarCloud quality gates and not reducing automated test coverage for the affected components
* The comments from the first run of automatically generated comments (AI generated comments, SonarCloud comments, bot generated comments, etc.) of the PR are addressed (addressing further re-runs of AI are optional)
* If it is not possible to resolve an automatic comment, please add a sub-comment indicating why the automated comment cannot be resolved or ask for help in resolving the comment

## Community Guidelines

This project follows a [Code of Conduct].
Expand Down Expand Up @@ -134,7 +126,7 @@ It's usually a good idea to test locally for the following:

#### Update docs

Docs are under [documentation/](documentation/). Refer to the [README.md](documentation/README.md) in the folder for details about
Docs are under [documentation/]. Refer to (the README,md)[documentation/README.md] in the folder to details about
documentation contributions.


Expand Down
4 changes: 3 additions & 1 deletion commands/fn/render/cmdrender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ func TestCmd_flagAndArgParsing_Symlink(t *testing.T) {
err := os.MkdirAll(filepath.Join(dir, "path", "to", "pkg", "dir"), 0700)
assert.NoError(t, err)
err = os.Symlink(filepath.Join("path", "to", "pkg", "dir"), "foo")
assert.NoError(t, err)
if err != nil {
t.Skip("skipping symlink test; user likely lacks privilege to create symlinks on Windows")
}

// verify the branch ref is set to the correct value
r := NewRunner(fake.CtxWithDefaultPrinter(), "kpt")
Expand Down
115 changes: 78 additions & 37 deletions e2e/testdata/fn-render/all-resource-deletion/.expected/diff.patch
Original file line number Diff line number Diff line change
@@ -1,51 +1,92 @@
diff --git a/Kptfile b/Kptfile
index 3c93e9e..5404a5a 100644
index 20fac6a..7f10467 100644
--- a/Kptfile
+++ b/Kptfile
@@ -2,6 +2,9 @@ apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: app
+ namespace: staging
@@ -1,14 +1,16 @@
-apiVersion: kpt.dev/v1
-kind: Kptfile
-metadata:
- name: app
-pipeline:
- mutators:
- - image: ghcr.io/kptdev/krm-functions-catalog/starlark:latest
- configPath: delete-all.yaml
- - image: ghcr.io/kptdev/krm-functions-catalog/set-namespace:latest
- configMap:
- namespace: staging
- - image: ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5
- configMap:
- tier: backend
+apiVersion: kpt.dev/v1
+kind: Kptfile
+metadata:
+ name: app
+ labels:
+ tier: backend
pipeline:
mutators:
- image: ghcr.io/kptdev/krm-functions-catalog/starlark:latest
@@ -12,3 +15,16 @@ pipeline:
- image: ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5
configMap:
tier: backend
+status:
+ conditions:
+ - type: Rendered
+ status: "True"
+ reason: RenderSuccess
+ renderStatus:
+ mutationSteps:
+ - image: ghcr.io/kptdev/krm-functions-catalog/starlark:latest
+ exitCode: 0
+ - image: ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0
+ exitCode: 0
+ - image: ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5
+ exitCode: 0
+pipeline:
+ mutators:
+ - image: ghcr.io/kptdev/krm-functions-catalog/starlark:latest
+ configPath: delete-all.yaml
+ - image: ghcr.io/kptdev/krm-functions-catalog/set-namespace:latest
+ configMap:
+ namespace: staging
+ - image: ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5
+ configMap:
+ tier: backend
diff --git a/delete-all.yaml b/delete-all.yaml
index 3c86d8b..6754b0a 100644
index 9ddbbe2..bea1693 100644
--- a/delete-all.yaml
+++ b/delete-all.yaml
@@ -17,6 +17,9 @@ metadata:
name: delete-all
annotations:
config.kubernetes.io/local-config: "true"
+ namespace: staging
@@ -1,22 +1,24 @@
-# Copyright 2021 The kpt Authors
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-apiVersion: fn.kpt.dev/v1alpha1
-kind: StarlarkRun
-metadata:
- name: delete-all
- annotations:
- config.kubernetes.io/local-config: "true"
-source: |-
- # delete all resources
- ctx.resource_list["items"] = [x for x in ctx.resource_list["items"] if x["kind"] in ["Kptfile", "StarlarkRun"]]
+# Copyright 2021 The kpt Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+apiVersion: fn.kpt.dev/v1alpha1
+kind: StarlarkRun
+metadata:
+ name: delete-all
+ annotations:
+ config.kubernetes.io/local-config: "true"
+ labels:
+ tier: backend
source: |-
# delete all resources
ctx.resource_list["items"] = [x for x in ctx.resource_list["items"] if x["kind"] in ["Kptfile", "StarlarkRun"]]
+source: |-
+ # delete all resources
+ ctx.resource_list["items"] = [x for x in ctx.resource_list["items"] if x["kind"] in ["Kptfile", "StarlarkRun"]]
diff --git a/deployment.yaml b/deployment.yaml
deleted file mode 100644
index 990ca9b..0000000
index 73d3f5e..0000000
--- a/deployment.yaml
+++ /dev/null
@@ -1,24 +0,0 @@
Expand Down Expand Up @@ -75,7 +116,7 @@ index 990ca9b..0000000
- image: kennethreitz/httpbin
diff --git a/resources.yaml b/resources.yaml
deleted file mode 100644
index 239f0d6..0000000
index 027731c..0000000
--- a/resources.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
Expand Down
2 changes: 1 addition & 1 deletion e2e/testdata/fn-render/all-resource-deletion/Kptfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pipeline:
mutators:
- image: ghcr.io/kptdev/krm-functions-catalog/starlark:latest
configPath: delete-all.yaml
- image: ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0
- image: ghcr.io/kptdev/krm-functions-catalog/set-namespace:latest
configMap:
namespace: staging
- image: ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: app
pipeline:
mutators:
- image: ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0
- image: ghcr.io/kptdev/krm-functions-catalog/set-namespace:latest
configMap:
namespace: staging
- image: ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5
Expand Down
134 changes: 84 additions & 50 deletions e2e/testdata/fn-render/basicpipeline-semver/.expected/diff.patch
Original file line number Diff line number Diff line change
@@ -1,66 +1,100 @@
diff --git a/Kptfile b/Kptfile
index 2336da4..ca2bcea 100644
index 68ea4fc..85f42f5 100644
--- a/Kptfile
+++ b/Kptfile
@@ -2,13 +2,34 @@ apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: app
+ labels:
+ tier: backend
pipeline:
mutators:
- image: ghcr.io/kptdev/krm-functions-catalog/set-namespace
@@ -1,14 +1,16 @@
-apiVersion: kpt.dev/v1
-kind: Kptfile
-metadata:
- name: app
-pipeline:
- mutators:
- - image: ghcr.io/kptdev/krm-functions-catalog/set-namespace
- tag: "0.4.1 - 0.4.3"
configMap:
namespace: staging
+ tag: 0.4.1 - 0.4.3
- image: ghcr.io/kptdev/krm-functions-catalog/set-labels
- configMap:
- namespace: staging
- - image: ghcr.io/kptdev/krm-functions-catalog/set-labels
- tag: "~0.2"
configMap:
tier: backend
+ tag: ~0.2
+status:
+ conditions:
+ - type: Rendered
+ status: "True"
+ reason: RenderSuccess
+ renderStatus:
+ mutationSteps:
+ - image: ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.4.3
+ exitCode: 0
+ results:
+ - message: namespace [default] updated to "staging", 1 value(s) changed
+ severity: info
+ - message: all `depends-on` annotations are up-to-date. no `namespace` changed
+ severity: info
+ - image: ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.2.4
+ exitCode: 0
+ results:
+ - message: set 4 labels in total
+ severity: info
- configMap:
- tier: backend
+apiVersion: kpt.dev/v1
+kind: Kptfile
+metadata:
+ name: app
+ labels:
+ tier: backend
+pipeline:
+ mutators:
+ - image: ghcr.io/kptdev/krm-functions-catalog/set-namespace
+ tag: "0.4.1 - 0.4.3"
+ configMap:
+ namespace: staging
+ - image: ghcr.io/kptdev/krm-functions-catalog/set-labels
+ tag: "~0.2"
+ configMap:
+ tier: backend
diff --git a/resources.yaml b/resources.yaml
index 1f15150..936d957 100644
index ffbb3d7..936d957 100644
--- a/resources.yaml
+++ b/resources.yaml
@@ -15,12 +15,20 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
@@ -1,26 +1,34 @@
-# Copyright 2026 The kpt Authors
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: nginx-deployment
-spec:
- replicas: 3
----
-apiVersion: custom.io/v1
-kind: Custom
-metadata:
- name: custom
-spec:
- image: nginx:1.2.3
+# Copyright 2026 The kpt Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: nginx-deployment
+ namespace: staging
+ labels:
+ tier: backend
spec:
replicas: 3
+spec:
+ replicas: 3
+ selector:
+ matchLabels:
+ tier: backend
---
apiVersion: custom.io/v1
kind: Custom
metadata:
name: custom
+---
+apiVersion: custom.io/v1
+kind: Custom
+metadata:
+ name: custom
+ labels:
+ tier: backend
spec:
image: nginx:1.2.3
+spec:
+ image: nginx:1.2.3
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ stdErrStripLines:
stdErr: |-
[WARN] resolved symlink "new-link" to ".", please note that the symlinks within the package are ignored
Package: "basicpipeline-symlink"
[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0"
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:v0.2.0" in 0s
[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:latest"
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-namespace:latest" in 0s
[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5"
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-labels:v0.1.5" in 0s
Successfully executed 2 function(s) in 1 package(s).
Loading
Loading