Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Automatic release tag labels #507

Merged
merged 2 commits into from
Aug 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions camel/source/config/100-namespace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ apiVersion: v1
kind: Namespace
metadata:
name: knative-sources
labels:
contrib.eventing.knative.dev/release: devel
2 changes: 2 additions & 0 deletions camel/source/config/200-serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ kind: ServiceAccount
metadata:
name: camel-controller-manager
namespace: knative-sources
labels:
contrib.eventing.knative.dev/release: devel
2 changes: 2 additions & 0 deletions camel/source/config/201-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: camel-controller
labels:
contrib.eventing.knative.dev/release: devel
rules:
- apiGroups:
- apps
Expand Down
4 changes: 4 additions & 0 deletions camel/source/config/202-clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: camel-controller-rolebinding
labels:
contrib.eventing.knative.dev/release: devel
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand All @@ -31,6 +33,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: eventing-sources-camel-controller-addressable-resolver
labels:
contrib.eventing.knative.dev/release: devel
subjects:
- kind: ServiceAccount
name: camel-controller-manager
Expand Down
1 change: 1 addition & 0 deletions camel/source/config/300-camelsource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ kind: CustomResourceDefinition
metadata:
creationTimestamp: null
labels:
contrib.eventing.knative.dev/release: devel
eventing.knative.dev/source: "true"
knative.dev/crd-install: "true"
name: camelsources.sources.eventing.knative.dev
Expand Down
1 change: 1 addition & 0 deletions camel/source/config/400-controller-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ apiVersion: v1
kind: Service
metadata:
labels:
contrib.eventing.knative.dev/release: devel
control-plane: camel-controller-manager
name: camel-controller-manager
namespace: knative-sources
Expand Down
1 change: 1 addition & 0 deletions camel/source/config/500-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
contrib.eventing.knative.dev/release: devel
control-plane: camel-controller-manager
name: camel-controller-manager
namespace: knative-sources
Expand Down
11 changes: 10 additions & 1 deletion hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,20 @@ COMPONENTS=(
readonly COMPONENTS

function build_release() {
# Update release labels if this is a tagged release
if [[ -n "${TAG}" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

who sets this TAG env variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's set by the release helpers when both --tag-release and --version are set.

echo "Tagged release, updating release labels to contrib.eventing.knative.dev/release: \"${TAG}\""
LABEL_YAML_CMD=(sed -e "s|contrib.eventing.knative.dev/release: devel|contrib.eventing.knative.dev/release: \"${TAG}\"|")
else
echo "Untagged release, will NOT update release labels"
LABEL_YAML_CMD=(cat)
fi

local all_yamls=()
for yaml in "${!COMPONENTS[@]}"; do
local config="${COMPONENTS[${yaml}]}"
echo "Building Knative Eventing Sources - ${config}"
ko resolve ${KO_FLAGS} -f ${config}/ > ${yaml}
ko resolve ${KO_FLAGS} -f ${config}/ | "${LABEL_YAML_CMD[@]}" > ${yaml}
all_yamls+=(${yaml})
done
ARTIFACTS_TO_PUBLISH="${all_yamls[@]}"
Expand Down
2 changes: 2 additions & 0 deletions kafka/source/config/100-namespace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ apiVersion: v1
kind: Namespace
metadata:
name: knative-sources
labels:
contrib.eventing.knative.dev/release: devel
2 changes: 2 additions & 0 deletions kafka/source/config/200-serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ kind: ServiceAccount
metadata:
name: kafka-controller-manager
namespace: knative-sources
labels:
contrib.eventing.knative.dev/release: devel
2 changes: 2 additions & 0 deletions kafka/source/config/201-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: eventing-sources-kafka-controller
labels:
contrib.eventing.knative.dev/release: devel
rules:

- apiGroups:
Expand Down
6 changes: 5 additions & 1 deletion kafka/source/config/202-clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: eventing-sources-kafka-controller
labels:
contrib.eventing.knative.dev/release: devel
subjects:
- kind: ServiceAccount
name: kafka-controller-manager
Expand All @@ -30,7 +32,9 @@ roleRef:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: eventing-sources-kafka-controller-addressable-resolver
name: eventing-sources-kafka-controller-addressable-resolver
labels:
contrib.eventing.knative.dev/release: devel
subjects:
- kind: ServiceAccount
name: kafka-controller-manager
Expand Down
1 change: 1 addition & 0 deletions kafka/source/config/300-kafkasource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
labels:
contrib.eventing.knative.dev/release: devel
eventing.knative.dev/source: "true"
knative.dev/crd-install: "true"
name: kafkasources.sources.eventing.knative.dev
Expand Down
1 change: 1 addition & 0 deletions kafka/source/config/400-controller-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ metadata:
name: kafka-controller
namespace: knative-sources
labels:
contrib.eventing.knative.dev/release: devel
control-plane: kafka-controller-manager
spec:
selector:
Expand Down
1 change: 1 addition & 0 deletions kafka/source/config/500-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ metadata:
name: kafka-controller-manager
namespace: knative-sources
labels:
contrib.eventing.knative.dev/release: devel
control-plane: kafka-controller-manager
spec:
selector:
Expand Down