Skip to content

Commit 264bcc4

Browse files
committed
Reflect tektoncd/pipeline release version as an annotation on pod
As a followup to tektoncd#1650 , the `tekton.dev/release` annotation is set on the pod to reflect the value of version.PipelineVersion Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
1 parent 0f20c35 commit 264bcc4

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

config/controller.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ spec:
2828
metadata:
2929
annotations:
3030
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
31+
# tekton.dev/release value replaced with inputs.params.versionTag in pipeline/tekton/publish.yaml
32+
tekton.dev/release: "devel"
3133
labels:
3234
app: tekton-pipelines-controller
3335
app.kubernetes.io/name: tekton-pipelines

pkg/pod/entrypoint.go

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package pod
1919
import (
2020
"errors"
2121
"fmt"
22+
"github.com/tektoncd/pipeline/pkg/version"
2223
"path/filepath"
2324
"strings"
2425

pkg/pod/pod.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package pod
1818

1919
import (
2020
"fmt"
21+
"github.com/tektoncd/pipeline/pkg/version"
2122
"path/filepath"
2223

2324
"github.com/tektoncd/pipeline/pkg/apis/pipeline"
@@ -42,6 +43,9 @@ const (
4243

4344
// These are effectively const, but Go doesn't have such an annotation.
4445
var (
46+
releaseAnnotation = "tekton.dev/release"
47+
releaseAnnotationValue = version.PipelineVersion
48+
4549
groupVersionKind = schema.GroupVersionKind{
4650
Group: v1alpha1.SchemeGroupVersion.Group,
4751
Version: v1alpha1.SchemeGroupVersion.Version,
@@ -179,6 +183,9 @@ func MakePod(images pipeline.Images, taskRun *v1alpha1.TaskRun, taskSpec v1alpha
179183
mergedPodContainers = append(mergedPodContainers, sc)
180184
}
181185

186+
podAnnotations := taskRun.Annotations
187+
podAnnotations[releaseAnnotation] = releaseAnnotationValue
188+
182189
return &corev1.Pod{
183190
ObjectMeta: metav1.ObjectMeta{
184191
// 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
193200
OwnerReferences: []metav1.OwnerReference{
194201
*metav1.NewControllerRef(taskRun, groupVersionKind),
195202
},
196-
Annotations: taskRun.Annotations,
203+
Annotations: podAnnotations,
197204
Labels: makeLabels(taskRun),
198205
},
199206
Spec: corev1.PodSpec{

tekton/publish.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ spec:
139139
ln -s ${TMPDIR}/source.tar.gz ${d}/kodata/
140140
done
141141
142+
# Rewrite "devel" to inputs.params.versionTag
143+
sed -i 's/devel/$(inputs.params.versionTag)/g' /workspace/go/src/github.com/tektoncd/pipeline/config/controller.yaml
144+
142145
# Publish images and create release.yaml
143146
ko resolve --preserve-import-paths -t $(inputs.params.versionTag) -f /workspace/go/src/github.com/tektoncd/pipeline/config/ > /workspace/output/bucket/latest/release.yaml
144147
volumeMounts:

0 commit comments

Comments
 (0)