diff --git a/pkg/apis/build/v1alpha2/build_pod.go b/pkg/apis/build/v1alpha2/build_pod.go index 925ed78ef..addd07694 100644 --- a/pkg/apis/build/v1alpha2/build_pod.go +++ b/pkg/apis/build/v1alpha2/build_pod.go @@ -30,11 +30,10 @@ const ( secretVolumeNameTemplate = "secret-volume-%v" pullSecretVolumeNameTemplate = "pull-secret-volume-%v" - completionTerminationMessagePathWindows = "/dev/termination-log" - completionTerminationMessagePathLinux = "/tmp/termination-log" - cosignDefaultSecretPath = "/var/build-secrets/cosign/%s" - defaultSecretPath = "/var/build-secrets/%s" - ReportTOMLPath = "/var/report/report.toml" + completionTerminationMessagePath = "/tmp/termination-log" + cosignDefaultSecretPath = "/var/build-secrets/cosign/%s" + defaultSecretPath = "/var/build-secrets/%s" + ReportTOMLPath = "/var/report/report.toml" BuildLabel = "kpack.io/build" k8sOSLabel = "kubernetes.io/os" @@ -99,9 +98,9 @@ func (bpi *BuildPodImages) completion(os string) string { func terminationMsgPath(os string) string { switch os { case "windows": - return completionTerminationMessagePathWindows + return "" default: - return completionTerminationMessagePathLinux + return completionTerminationMessagePath } } @@ -345,7 +344,7 @@ func (b *Build) BuildPod(images BuildPodImages, buildContext BuildContext) (*cor if err != nil { return nil, errors.Wrapf(err, "parsing creation time %s", b.Spec.CreationTime) } - + return &corev1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: b.PodName(), @@ -374,7 +373,7 @@ func (b *Build) BuildPod(images BuildPodImages, buildContext BuildContext) (*cor Env: []corev1.EnvVar{ homeEnv, {Name: CacheTagEnvVar, Value: b.Spec.RegistryCacheTag()}, - {Name: TerminationMessagePathEnvVar, Value: terminationMsgPath(buildContext.os())}, + {Name: TerminationMessagePathEnvVar, Value: completionTerminationMessagePath}, }, Args: args( b.notaryArgs(), @@ -604,7 +603,7 @@ func (b *Build) BuildPod(images BuildPodImages, buildContext BuildContext) (*cor if dateTime != nil { return corev1.EnvVar{Name: "SOURCE_DATE_EPOCH", Value: strconv.Itoa(int(dateTime.Unix()))} } - return corev1.EnvVar{Name:"", Value:""} + return corev1.EnvVar{Name: "", Value: ""} }(), func() corev1.EnvVar { return corev1.EnvVar{ @@ -853,7 +852,7 @@ func (b *Build) rebasePod(buildContext BuildContext, images BuildPodImages) (*co Command: []string{"/cnb/process/completion"}, Env: []corev1.EnvVar{ {Name: CacheTagEnvVar, Value: b.Spec.RegistryCacheTag()}, - {Name: TerminationMessagePathEnvVar, Value: terminationMsgPath(buildContext.os())}, + {Name: TerminationMessagePathEnvVar, Value: completionTerminationMessagePath}, }, Args: args( b.notaryArgs(), @@ -1234,7 +1233,6 @@ func envs(envs []corev1.EnvVar, envVars ...corev1.EnvVar) []corev1.EnvVar { return envs } - func parseTime(providedTime string) (*time.Time, error) { var parsedTime time.Time switch providedTime { diff --git a/pkg/apis/build/v1alpha2/build_pod_test.go b/pkg/apis/build/v1alpha2/build_pod_test.go index cc1c455c7..37ad9c380 100644 --- a/pkg/apis/build/v1alpha2/build_pod_test.go +++ b/pkg/apis/build/v1alpha2/build_pod_test.go @@ -2640,7 +2640,7 @@ func testBuildPod(t *testing.T, when spec.G, it spec.S) { assert.Equal(t, completionContainer.Env, []corev1.EnvVar{ {Name: "USERPROFILE", Value: "/builder/home"}, {Name: "CACHE_TAG", Value: ""}, - {Name: "TERMINATION_MESSAGE_PATH", Value: "/dev/termination-log"}, + {Name: "TERMINATION_MESSAGE_PATH", Value: "/tmp/termination-log"}, }) }) diff --git a/pkg/apis/build/v1alpha2/cluster_stack_conversion.go b/pkg/apis/build/v1alpha2/cluster_stack_conversion.go index ef78c2545..8d1c6f908 100644 --- a/pkg/apis/build/v1alpha2/cluster_stack_conversion.go +++ b/pkg/apis/build/v1alpha2/cluster_stack_conversion.go @@ -59,7 +59,7 @@ func (cs *ClusterStackSpec) convertTo(to *v1alpha1.ClusterStackSpec) { func (cs *ClusterStackSpec) convertToAnnotations(toAnnotations map[string]string) error { if cs.ServiceAccountRef != nil { bytes, err := json.Marshal(cs.ServiceAccountRef) - if err!= nil { + if err != nil { return err } toAnnotations[clusterStackServiceAccountRefAnnotation] = string(bytes) diff --git a/pkg/apis/build/v1alpha2/cluster_stack_conversion_test.go b/pkg/apis/build/v1alpha2/cluster_stack_conversion_test.go index 7e757aa9f..f9669867d 100644 --- a/pkg/apis/build/v1alpha2/cluster_stack_conversion_test.go +++ b/pkg/apis/build/v1alpha2/cluster_stack_conversion_test.go @@ -20,7 +20,7 @@ func testClusterStackConversion(t *testing.T, when spec.G, it spec.S) { when("converting to and from v1alpha1", func() { v1alpha2ClusterStack := &ClusterStack{ ObjectMeta: metav1.ObjectMeta{ - Name: "test-clusterstack", + Name: "test-clusterstack", Annotations: map[string]string{}, }, Spec: ClusterStackSpec{ diff --git a/pkg/apis/build/v1alpha2/cluster_store_conversion.go b/pkg/apis/build/v1alpha2/cluster_store_conversion.go index 94493ec56..ae5541e8e 100644 --- a/pkg/apis/build/v1alpha2/cluster_store_conversion.go +++ b/pkg/apis/build/v1alpha2/cluster_store_conversion.go @@ -39,7 +39,7 @@ func (s *ClusterStore) ConvertTo(_ context.Context, to apis.Convertible) error { func (cs *ClusterStoreSpec) convertToAnnotations(toAnnotations map[string]string) error { if cs.ServiceAccountRef != nil { bytes, err := json.Marshal(cs.ServiceAccountRef) - if err!= nil { + if err != nil { return err } toAnnotations[clusterStoreServiceAccountRefAnnotation] = string(bytes) diff --git a/pkg/apis/build/v1alpha2/cluster_store_conversion_test.go b/pkg/apis/build/v1alpha2/cluster_store_conversion_test.go index fc2c32851..659b1ef98 100644 --- a/pkg/apis/build/v1alpha2/cluster_store_conversion_test.go +++ b/pkg/apis/build/v1alpha2/cluster_store_conversion_test.go @@ -58,9 +58,9 @@ func testClusterStoreConversion(t *testing.T, when spec.G, it spec.S) { v1alpha1ClusterStore := &v1alpha1.ClusterStore{ ObjectMeta: metav1.ObjectMeta{ - Name: "test-cluster-store", + Name: "test-cluster-store", Annotations: map[string]string{ - "some-key": "some-value", + "some-key": "some-value", "kpack.io/clusterStoreServiceAccountRef": `{"namespace":"some-namespace","name":"some-service-account"}`, }, }, diff --git a/pkg/apis/build/v1alpha2/image_conversion.go b/pkg/apis/build/v1alpha2/image_conversion.go index c8d4c912f..ef7423872 100644 --- a/pkg/apis/build/v1alpha2/image_conversion.go +++ b/pkg/apis/build/v1alpha2/image_conversion.go @@ -79,7 +79,7 @@ func (is *ImageSpec) convertTo(to *v1alpha1.ImageSpec) { } } -func (i *Image)convertFromAnnotations(fromAnnotations *map[string]string) error { +func (i *Image) convertFromAnnotations(fromAnnotations *map[string]string) error { is := &i.Spec ia := i.Annotations if servicesJson, ok := (*fromAnnotations)[servicesConversionAnnotation]; ok { @@ -144,7 +144,7 @@ func (i *Image)convertFromAnnotations(fromAnnotations *map[string]string) error if is.Build == nil { is.Build = &ImageBuild{} } - temp , err := strconv.ParseInt(buildTimeout, 10, 64) + temp, err := strconv.ParseInt(buildTimeout, 10, 64) if err != nil { return err } @@ -193,7 +193,7 @@ func (i *Image)convertFromAnnotations(fromAnnotations *map[string]string) error return nil } -func (is *ImageSpec)convertToAnnotations(toAnnotations map[string]string) error{ +func (is *ImageSpec) convertToAnnotations(toAnnotations map[string]string) error { if build := is.Build; build != nil { if len(build.Services) > 0 { bytes, err := json.Marshal(build.Services) diff --git a/pkg/apis/build/v1alpha2/image_conversion_test.go b/pkg/apis/build/v1alpha2/image_conversion_test.go index b5905eac8..19a7fb45a 100644 --- a/pkg/apis/build/v1alpha2/image_conversion_test.go +++ b/pkg/apis/build/v1alpha2/image_conversion_test.go @@ -64,7 +64,7 @@ func testImageConversion(t *testing.T, when spec.G, it spec.S) { }, Tolerations: []corev1.Toleration{ { - Key: "some-key", + Key: "some-key", Value: "some-value", }, }, @@ -78,11 +78,11 @@ func testImageConversion(t *testing.T, when spec.G, it spec.S) { Limits: corev1.ResourceList{"some-limit": resource.Quantity{}}, Requests: corev1.ResourceList{"some-request": resource.Quantity{}}, }, - NodeSelector: map[string]string{"some-node-selector-key":"some-node-selector-value"}, - Affinity: &affinity, + NodeSelector: map[string]string{"some-node-selector-key": "some-node-selector-value"}, + Affinity: &affinity, RuntimeClassName: &runtimeClassName, - SchedulerName: "some-scheduler-name", - BuildTimeout: &buildTimeout, + SchedulerName: "some-scheduler-name", + BuildTimeout: &buildTimeout, }, Notary: &corev1alpha1.NotaryConfig{ V1: &corev1alpha1.NotaryV1Config{ @@ -129,17 +129,17 @@ func testImageConversion(t *testing.T, when spec.G, it spec.S) { Name: "my-super-convertable-image", Annotations: map[string]string{ "kpack.io/services": `[{"kind":"Secret","name":"some-secret","apiVersion":"v1"}]`, - "kpack.io/tolerations": `[{"key":"some-key","value":"some-value"}]`, - "kpack.io/nodeSelector": `{"some-node-selector-key":"some-node-selector-value"}`, - "kpack.io/affinity": `{}`, - "kpack.io/runtimeClassName": "some-runtime-class-name", - "kpack.io/schedulerName": "some-scheduler-name", - "kpack.io/buildTimeout": "7", + "kpack.io/tolerations": `[{"key":"some-key","value":"some-value"}]`, + "kpack.io/nodeSelector": `{"some-node-selector-key":"some-node-selector-value"}`, + "kpack.io/affinity": `{}`, + "kpack.io/runtimeClassName": "some-runtime-class-name", + "kpack.io/schedulerName": "some-scheduler-name", + "kpack.io/buildTimeout": "7", "kpack.io/cache.volume.storageClassName": "some-storage-class", - "kpack.io/cache.registry.tag": "some-tag", - "kpack.io/projectDescriptorPath": "some-project-descriptor-path", - "kpack.io/cosignAnnotation": `[{"name":"some-cosign-name","value":"some-cosign-value"}]`, - "kpack.io/defaultProcess": "some-default-process", + "kpack.io/cache.registry.tag": "some-tag", + "kpack.io/projectDescriptorPath": "some-project-descriptor-path", + "kpack.io/cosignAnnotation": `[{"name":"some-cosign-name","value":"some-cosign-value"}]`, + "kpack.io/defaultProcess": "some-default-process", }, }, Spec: v1alpha1.ImageSpec{ diff --git a/pkg/apis/build/v1alpha2/image_validation_test.go b/pkg/apis/build/v1alpha2/image_validation_test.go index b74d85d98..001e7c349 100644 --- a/pkg/apis/build/v1alpha2/image_validation_test.go +++ b/pkg/apis/build/v1alpha2/image_validation_test.go @@ -268,7 +268,7 @@ func testImageValidation(t *testing.T, when spec.G, it spec.S) { assert.Nil(t, err) }) - it ("pass if it sets to a valid timestamp", func() { + it("pass if it sets to a valid timestamp", func() { image.Spec.Build.CreationTime = "1566172801" //Mon Aug 19 2019 00:00:01 GMT+0000 err := image.Validate(ctx) assert.Nil(t, err) diff --git a/pkg/openapi/openapi_generated.go b/pkg/openapi/openapi_generated.go index 36f1d8e6f..af752e377 100644 --- a/pkg/openapi/openapi_generated.go +++ b/pkg/openapi/openapi_generated.go @@ -4506,7 +4506,7 @@ func schema_pkg_apis_core_v1alpha1_Condition(ref common.ReferenceCallback) commo SchemaProps: spec.SchemaProps{ Description: "LastTransitionTime is the last time the condition transitioned from one status to another. We use VolatileTime in place of metav1.Time to exclude this from creating equality.Semantic differences (all other things held constant).", Default: map[string]interface{}{}, - Type: []string{"string"}, Format: "", + Type: []string{"string"}, Format: "", }, }, "reason": {