Skip to content

Commit

Permalink
Update Tekton dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
SaschaSchwarze0 committed Aug 16, 2022
1 parent 8b7bbba commit 9af8e8b
Show file tree
Hide file tree
Showing 127 changed files with 9,391 additions and 7,716 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ To find out more on what's the best strategy or what else can Shipwright do for
| Dependency | Supported versions |
| -------------------------------------| ---------------------------- |
| [Kubernetes](https://kubernetes.io/) | v1.22,\*, v1.23.\*, v1.24.\* |
| [Tekton](https://tekton.dev) | v0.34.\*, v0.35.\*, v0.36.\*, v0.37.\*, v0.38.\* |
| [Tekton](https://tekton.dev) | v0.36.\*, v0.37.\*, v0.38.\* |
### Platform support
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/prometheus/client_model v0.2.0
github.com/spf13/cobra v1.5.0
github.com/spf13/pflag v1.0.5
github.com/tektoncd/pipeline v0.35.1
github.com/tektoncd/pipeline v0.38.3
go.uber.org/zap v1.22.0
k8s.io/api v0.23.5
k8s.io/apimachinery v0.23.5
Expand Down
6 changes: 3 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudevents/sdk-go/v2 v2.5.0 h1:Ts6aLHbBUJfcNcZ4ouAfJ4+Np7SE1Yf2w4ADKRCd7Fo=
github.com/cloudevents/sdk-go/v2 v2.10.1 h1:qNFovJ18fWOd8Q9ydWJPk1oiFudXyv1GxJIP7MwPjuM=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
Expand Down Expand Up @@ -690,8 +690,8 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stvp/go-udp-testing v0.0.0-20201019212854-469649b16807/go.mod h1:7jxmlfBCDBXRzr0eAQJ48XC1hBu1np4CS5+cHEYfwpc=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/tektoncd/pipeline v0.35.1 h1:cgEVV+DqXQRyduFDnqLjuK6uMcau3betM0iV+F1vjPQ=
github.com/tektoncd/pipeline v0.35.1/go.mod h1:+Jc1ESROXrzosXmpAKMWY8CJhUu52mK+wigjpVMgOio=
github.com/tektoncd/pipeline v0.38.3 h1:yMmEW5HRlCDJhepfPzaKhjbhZfAEf9GR34bJMZE5wQY=
github.com/tektoncd/pipeline v0.38.3/go.mod h1:9uQZ6PdOZXPtoceupLMyChXUR6elsTuHpVNlEGAIJXU=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
Expand Down
25 changes: 13 additions & 12 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"time"

"github.com/prometheus/client_golang/prometheus"
pipeline "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
)
Expand Down Expand Up @@ -92,10 +93,10 @@ var (
// can be set to use on the Build controllers
type Config struct {
CtxTimeOut time.Duration
GitContainerTemplate corev1.Container
MutateImageContainerTemplate corev1.Container
BundleContainerTemplate corev1.Container
WaiterContainerTemplate corev1.Container
GitContainerTemplate pipeline.Step
MutateImageContainerTemplate pipeline.Step
BundleContainerTemplate pipeline.Step
WaiterContainerTemplate pipeline.Step
RemoteArtifactsContainerImage string
TerminationLogPath string
Prometheus PrometheusConfig
Expand Down Expand Up @@ -144,7 +145,7 @@ type KubeAPIOptions struct {
func NewDefaultConfig() *Config {
return &Config{
CtxTimeOut: contextTimeout,
GitContainerTemplate: corev1.Container{
GitContainerTemplate: pipeline.Step{
Image: gitDefaultImage,
Command: []string{
"/ko-app/git",
Expand All @@ -154,7 +155,7 @@ func NewDefaultConfig() *Config {
RunAsGroup: nonRoot,
},
},
BundleContainerTemplate: corev1.Container{
BundleContainerTemplate: pipeline.Step{
Image: bundleDefaultImage,
Command: []string{
"/ko-app/bundle",
Expand All @@ -165,7 +166,7 @@ func NewDefaultConfig() *Config {
},
},
RemoteArtifactsContainerImage: remoteArtifactsDefaultImage,
MutateImageContainerTemplate: corev1.Container{
MutateImageContainerTemplate: pipeline.Step{
Image: mutateImageDefaultImage,
Command: []string{
"/ko-app/mutate-image",
Expand All @@ -192,7 +193,7 @@ func NewDefaultConfig() *Config {
},
},
},
WaiterContainerTemplate: corev1.Container{
WaiterContainerTemplate: pipeline.Step{
Image: waiterDefaultImage,
Command: []string{
"/ko-app/waiter",
Expand Down Expand Up @@ -247,7 +248,7 @@ func (c *Config) SetConfigFromEnv() error {
}

if gitContainerTemplate := os.Getenv(gitContainerTemplateEnvVar); gitContainerTemplate != "" {
c.GitContainerTemplate = corev1.Container{}
c.GitContainerTemplate = pipeline.Step{}
if err := json.Unmarshal([]byte(gitContainerTemplate), &c.GitContainerTemplate); err != nil {
return err
}
Expand All @@ -262,7 +263,7 @@ func (c *Config) SetConfigFromEnv() error {
}

if mutateImageContainerTemplate := os.Getenv(mutateImageContainerTemplateEnvVar); mutateImageContainerTemplate != "" {
c.MutateImageContainerTemplate = corev1.Container{}
c.MutateImageContainerTemplate = pipeline.Step{}
if err := json.Unmarshal([]byte(mutateImageContainerTemplate), &c.MutateImageContainerTemplate); err != nil {
return err
}
Expand All @@ -283,7 +284,7 @@ func (c *Config) SetConfigFromEnv() error {
}

if bundleContainerTemplate := os.Getenv(bundleContainerTemplateEnvVar); bundleContainerTemplate != "" {
c.BundleContainerTemplate = corev1.Container{}
c.BundleContainerTemplate = pipeline.Step{}
if err := json.Unmarshal([]byte(bundleContainerTemplate), &c.BundleContainerTemplate); err != nil {
return err
}
Expand All @@ -298,7 +299,7 @@ func (c *Config) SetConfigFromEnv() error {
}

if waiterContainerTemplate := os.Getenv(waiterContainerTemplateEnvVar); waiterContainerTemplate != "" {
c.WaiterContainerTemplate = corev1.Container{}
c.WaiterContainerTemplate = pipeline.Step{}
if err := json.Unmarshal([]byte(waiterContainerTemplate), &c.WaiterContainerTemplate); err != nil {
return err
}
Expand Down
17 changes: 9 additions & 8 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
pipeline "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/utils/pointer"
Expand Down Expand Up @@ -107,7 +108,7 @@ var _ = Describe("Config", func() {
}

configWithEnvVariableOverrides(overrides, func(config *Config) {
Expect(config.GitContainerTemplate).To(Equal(corev1.Container{
Expect(config.GitContainerTemplate).To(Equal(pipeline.Step{
Image: "myregistry/custom/git-image",
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
Expand All @@ -126,7 +127,7 @@ var _ = Describe("Config", func() {

configWithEnvVariableOverrides(overrides, func(config *Config) {
nonRoot := pointer.Int64(1000)
Expect(config.GitContainerTemplate).To(Equal(corev1.Container{
Expect(config.GitContainerTemplate).To(Equal(pipeline.Step{
Image: "myregistry/custom/git-image",
Command: []string{
"/ko-app/git",
Expand All @@ -146,7 +147,7 @@ var _ = Describe("Config", func() {
}

configWithEnvVariableOverrides(overrides, func(config *Config) {
Expect(config.GitContainerTemplate).To(Equal(corev1.Container{
Expect(config.GitContainerTemplate).To(Equal(pipeline.Step{
Image: "myregistry/custom/git-image:override",
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
Expand All @@ -164,7 +165,7 @@ var _ = Describe("Config", func() {
}

configWithEnvVariableOverrides(overrides, func(config *Config) {
Expect(config.MutateImageContainerTemplate).To(Equal(corev1.Container{
Expect(config.MutateImageContainerTemplate).To(Equal(pipeline.Step{
Image: "myregistry/custom/mutate-image",
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
Expand All @@ -182,7 +183,7 @@ var _ = Describe("Config", func() {
}

configWithEnvVariableOverrides(overrides, func(config *Config) {
Expect(config.WaiterContainerTemplate).To(Equal(corev1.Container{
Expect(config.WaiterContainerTemplate).To(Equal(pipeline.Step{
Image: "myregistry/custom/image",
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
Expand All @@ -201,7 +202,7 @@ var _ = Describe("Config", func() {
}

configWithEnvVariableOverrides(overrides, func(config *Config) {
Expect(config.MutateImageContainerTemplate).To(Equal(corev1.Container{
Expect(config.MutateImageContainerTemplate).To(Equal(pipeline.Step{
Image: "myregistry/custom/mutate-image:override",
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
Expand All @@ -221,7 +222,7 @@ var _ = Describe("Config", func() {

configWithEnvVariableOverrides(overrides, func(config *Config) {
nonRoot := pointer.Int64(1000)
Expect(config.WaiterContainerTemplate).To(Equal(corev1.Container{
Expect(config.WaiterContainerTemplate).To(Equal(pipeline.Step{
Image: "myregistry/custom/image",
Command: []string{"/ko-app/waiter"},
Args: []string{"start"},
Expand All @@ -240,7 +241,7 @@ var _ = Describe("Config", func() {
}

configWithEnvVariableOverrides(overrides, func(config *Config) {
Expect(config.WaiterContainerTemplate).To(Equal(corev1.Container{
Expect(config.WaiterContainerTemplate).To(Equal(pipeline.Step{
Image: "myregistry/custom/image:override",
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
Expand Down
8 changes: 3 additions & 5 deletions pkg/reconciler/buildrun/resources/mutate.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@ func amendTaskSpecWithImageMutate(
buildOutput, buildRunOutput buildv1alpha1.Image,
) {
// initialize the step from the template
mutateStep := tektonv1beta1.Step{
Container: *cfg.MutateImageContainerTemplate.DeepCopy(),
}
mutateStep := *cfg.MutateImageContainerTemplate.DeepCopy()

mutateStep.Container.Name = imageMutateContainerName
mutateStep.Name = imageMutateContainerName

// if labels or annotations are specified in buildRun then merge them with build's
labels := mergeMaps(buildOutput.Labels, buildRunOutput.Labels)
annotations := mergeMaps(buildOutput.Annotations, buildRunOutput.Annotations)

mutateStep.Container.Args = mutateArgs(annotations, labels)
mutateStep.Args = mutateArgs(annotations, labels)

// append the mutate step
taskSpec.Steps = append(taskSpec.Steps, mutateStep)
Expand Down
40 changes: 17 additions & 23 deletions pkg/reconciler/buildrun/resources/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,20 +309,18 @@ var _ = Describe("isStepReferencingParameter", func() {
Context("for a Step referencing parameters in different ways", func() {

step := &pipeline.Step{
Container: corev1.Container{
Command: []string{
"some-command",
"$(params.first-param)",
},
Args: []string{
"--flag=$(params['dot.param'])",
"$(params.array-param[*])",
},
Env: []corev1.EnvVar{{
Name: "MY_ENV_VAR",
Value: "hohe $(params[\"another.dot.param\"])",
}},
Command: []string{
"some-command",
"$(params.first-param)",
},
Args: []string{
"--flag=$(params['dot.param'])",
"$(params.array-param[*])",
},
Env: []corev1.EnvVar{{
Name: "MY_ENV_VAR",
Value: "hohe $(params[\"another.dot.param\"])",
}},
}

It("returns true for a classical referenced parameter in the command", func() {
Expand Down Expand Up @@ -357,19 +355,15 @@ var _ = Describe("HandleTaskRunParam", func() {
TaskSpec: &pipeline.TaskSpec{
Steps: []pipeline.Step{
{
Container: corev1.Container{
Name: "first-container",
Args: []string{
"--an-argument=$(params.string-parameter)",
},
Name: "first-container",
Args: []string{
"--an-argument=$(params.string-parameter)",
},
},
{
Container: corev1.Container{
Name: "second-container",
Args: []string{
"$(params.array-parameter[*])",
},
Name: "second-container",
Args: []string{
"$(params.array-parameter[*])",
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/reconciler/buildrun/resources/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ func updateBuildRunStatusWithOutputResult(ctx context.Context, buildRun *build.B
for _, result := range taskRunResult {
switch result.Name {
case generateOutputResultName(imageDigestResult):
buildRun.Status.Output.Digest = result.Value
buildRun.Status.Output.Digest = result.Value.StringVal

case generateOutputResultName(imageSizeResult):
if size, err := strconv.ParseInt(result.Value, 10, 64); err != nil {
if size, err := strconv.ParseInt(result.Value.StringVal, 10, 64); err != nil {
ctxlog.Info(ctx, "invalid value for output image size from taskRun result", namespace, request.Namespace, name, request.Name, "error", err)
} else {
buildRun.Status.Output.Size = size
Expand Down
Loading

0 comments on commit 9af8e8b

Please sign in to comment.