Skip to content

Commit

Permalink
Reflect tektoncd/pipeline release version as an annotation on pod
Browse files Browse the repository at this point in the history
As a followup to #1650 ,
the `tekton.dev/release` annotation is set on the pod to reflect
the value of version.PipelineVersion

Signed-off-by: Vibhav Bobade <[email protected]>
  • Loading branch information
waveywaves committed Dec 17, 2019
1 parent 0f20c35 commit 33471ea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/pod/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package pod
import (
"errors"
"fmt"
"github.com/tektoncd/pipeline/pkg/version"
"path/filepath"
"strings"

Expand Down
9 changes: 8 additions & 1 deletion pkg/pod/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package pod

import (
"fmt"
"github.com/tektoncd/pipeline/pkg/version"
"path/filepath"

"github.com/tektoncd/pipeline/pkg/apis/pipeline"
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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{
Expand Down

0 comments on commit 33471ea

Please sign in to comment.