diff --git a/pkg/pod/entrypoint.go b/pkg/pod/entrypoint.go index 20e286b1408..52090b8c6ea 100644 --- a/pkg/pod/entrypoint.go +++ b/pkg/pod/entrypoint.go @@ -19,6 +19,7 @@ package pod import ( "errors" "fmt" + "github.com/tektoncd/pipeline/pkg/version" "path/filepath" "strings" diff --git a/pkg/pod/pod.go b/pkg/pod/pod.go index 0455968a9be..3739aa1ca81 100644 --- a/pkg/pod/pod.go +++ b/pkg/pod/pod.go @@ -18,6 +18,7 @@ package pod import ( "fmt" + "github.com/tektoncd/pipeline/pkg/version" "path/filepath" "github.com/tektoncd/pipeline/pkg/apis/pipeline" @@ -42,6 +43,9 @@ const ( // These are effectively const, but Go doesn't have such an annotation. var ( + releaseAnnotation = "tekon.dev/release" + releaseAnnotationValue = version.PipelineVersion + groupVersionKind = schema.GroupVersionKind{ Group: v1alpha1.SchemeGroupVersion.Group, Version: v1alpha1.SchemeGroupVersion.Version, @@ -179,6 +183,9 @@ func MakePod(images pipeline.Images, taskRun *v1alpha1.TaskRun, taskSpec v1alpha mergedPodContainers = append(mergedPodContainers, sc) } + podAnnotations := taskRun.Annotations + podAnnotations[releaseAnnotation] = releaseAnnotationValue + return &corev1.Pod{ ObjectMeta: metav1.ObjectMeta{ // We execute the build's pod in the same namespace as where the build was @@ -193,7 +200,7 @@ func MakePod(images pipeline.Images, taskRun *v1alpha1.TaskRun, taskSpec v1alpha OwnerReferences: []metav1.OwnerReference{ *metav1.NewControllerRef(taskRun, groupVersionKind), }, - Annotations: taskRun.Annotations, + Annotations: podAnnotations, Labels: makeLabels(taskRun), }, Spec: corev1.PodSpec{