-
Notifications
You must be signed in to change notification settings - Fork 255
Description
Expected behavior
Function pipeline output includes version tag of the running/passed/failed function image as specified in the Kptfile.
Actual behavior
When using the tag attribute (with or without a semantic version constraint) or when no version tag is included in either tag or image (defaulting to "latest"), function pipeline output does not include the version tag of the executed image.
Information
Results from the introduction of the tag attribute in #4383. This is a problem especially when using a semantic version constraint, as there is no way to tell from the output what actual image version was selected and run.
Take this example Kptfile from the attached sample.zip:
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
- image: ghcr.io/kptdev/krm-functions-catalog/set-labels
tag: "~0.2"
configMap:
tier: backendRunning kpt fn render results in the following output - note the lack of versions in the [RUNNING] and [PASS] lines:
Package: "sample"
[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-namespace"
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-namespace" in 1.5s
[Results]: [info]: all matching namespaces are already "staging". no value changed, [info]: all `depends-on` annotations are up-to-date. no `namespace` changed
[RUNNING] "ghcr.io/kptdev/krm-functions-catalog/set-labels"
[PASS] "ghcr.io/kptdev/krm-functions-catalog/set-labels" in 1.4s
[Results]: [info]: set 6 labels in total
Successfully executed 2 function(s) in 1 package(s).
We should include the selected version tag in the image names both before ([RUNNING] lines) and after running ([PASS] or [FAIL] lines). In the case of a semantic version constraint, where the version tag is not yet resolved when the [RUNNING] line is printed, the semantic version constraint from the tag attribute should be included in full to indicate the use of the constraint.
Ideally, this should cover the following cases:
tagnot set; exact version tag included inimage- OK in existing behaviour; should be preserved
tagnot set; no version tag inimage- kpt resolution defaults to "latest" but "latest" is not included in output
- for completeness' sake, code change: append "latest" tag to
[RUNNING],[PASS], or[FAIL]lines in this case
- for completeness' sake, code change: append "latest" tag to
- kpt resolution defaults to "latest" but "latest" is not included in output
tagset; no version tag inimage- code change: append value of
tagto image names in[RUNNING]lines - code change: append resolved version tag to image names in
[PASS]or[FAIL]lines
- code change: append value of
tagset; exact version tag inimage- kpt behaviour has
tagvalue override any version set inimage- BUT the output will show the version from
image, whereas the actual function image was the one fromtag!
- BUT the output will show the version from
- in this case, the value or resolved version from
tagmust replace the one fromimagefor the output:- code change: in
[RUNNING]lines, replace version tag in image names with value oftag - code change: in
[PASS]or[FAIL]lines, replace version tag in image names with resolved version tag
- code change: in
- kpt behaviour has
Steps to reproduce the behavior
- Build kpt from source on
mainbranch to obtaintagattribute and semantic version constraint functionality - Download and unzip the attached sample kpt package, sample.zip
cd samplekpt fn render, making sure to use the kpt binary built in step 1 (likely$GOPATH/bin/kpt)- Observe confusing lack of function image version information in the kpt output