From 150c384d78a5327db1c89fee1a9e9ad38cc83453 Mon Sep 17 00:00:00 2001 From: Marco Voelz Date: Tue, 28 Nov 2023 10:51:37 +0100 Subject: [PATCH] Add vpa release pipeline (#258) * Add pipeline for releasing VPA * Add scripts for reading/writing VPA version to go file * Fix yaml indentation * Add boilerplate header to scripts * Add new ci scripts to boilerplate ignore list * Make sure VPA release tags don't conflict with CA --- .ci/pipeline_definitions | 85 +++++++++++++++++++++++++++++++++ .ci/read-vpa-version.sh | 17 +++++++ .ci/write-vpa-version.sh | 17 +++++++ hack/boilerplate/boilerplate.py | 4 +- 4 files changed, 122 insertions(+), 1 deletion(-) create mode 100755 .ci/read-vpa-version.sh create mode 100755 .ci/write-vpa-version.sh diff --git a/.ci/pipeline_definitions b/.ci/pipeline_definitions index fa599d648d60..2fc17f51ecca 100644 --- a/.ci/pipeline_definitions +++ b/.ci/pipeline_definitions @@ -63,3 +63,88 @@ autoscaler: slack_cfg_name: 'scp_workspace' component_descriptor: snapshot_ctx_repository: gardener-public +vertical-pod-autoscaler: + template: 'default' + base_definition: + repo: + source_labels: + - name: 'cloud.gardener.cnudie/dso/scanning-hints/source_analysis/v1' + value: + policy: 'scan' + path_config: + exclude_paths: + - '^vendor/.*' + - '.*/vendor/.*' + - '^addon-resizer/.*' + - '^balancer/.*' + - '^cluster-autoscaler/.*' + traits: + version: + inject_effective_version: true + read_callback: .ci/read-vpa-version.sh + write_callback: .ci/write-vpa-version.sh + publish: + oci-builder: docker-buildx + platforms: + - linux/amd64 + - linux/arm64 + dockerimages: + vpa-recommender: + inputs: + repos: + source: ~ # default + steps: + build: ~ + registry: 'gcr-readwrite' + image: 'eu.gcr.io/gardener-project/gardener/autoscaler/vertical-pod-autoscaler/vpa-recommender' + dockerfile: './vertical-pod-autoscaler/pkg/recommender/Dockerfile' + vpa-updater: + inputs: + repos: + source: ~ # default + steps: + build: ~ + registry: 'gcr-readwrite' + image: 'eu.gcr.io/gardener-project/gardener/autoscaler/vertical-pod-autoscaler/vpa-updater' + dockerfile: './vertical-pod-autoscaler/pkg/updater/Dockerfile' + vpa-admission-controller: + inputs: + repos: + source: ~ # default + steps: + build: ~ + registry: 'gcr-readwrite' + image: 'eu.gcr.io/gardener-project/gardener/autoscaler/vertical-pod-autoscaler/vpa-admission-controller' + dockerfile: './vertical-pod-autoscaler/pkg/admission-controller/Dockerfile' + steps: + test: + image: 'golang:1.20.5' + build: + image: 'golang:1.20.5' + output_dir: 'binary' + jobs: + head-update: + traits: + component_descriptor: + snapshot_ctx_repository: gardener-public + draft_release: ~ + pull-request: + traits: + pull-request: ~ + release: + traits: + version: + preprocess: 'finalize' + release: + nextversion: 'bump_minor' + git_tags: + - ref_template: refs/tags/vpa-{VERSION} + on_tag_conflict: 'fail' + slack: + default_channel: 'internal_scp_workspace' + channel_cfgs: + internal_scp_workspace: + channel_name: 'C017KSLTF4H' # gardener-autoscaling + slack_cfg_name: 'scp_workspace' + component_descriptor: + snapshot_ctx_repository: gardener-public diff --git a/.ci/read-vpa-version.sh b/.ci/read-vpa-version.sh new file mode 100755 index 000000000000..09c5cb6b4de6 --- /dev/null +++ b/.ci/read-vpa-version.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env sh + +# Copyright (c) 2023 SAP SE or an SAP affiliate company. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cat ../vertical-pod-autoscaler/common/version.go | grep 'const VerticalPodAutoscalerVersion' | cut -d " " -f 4 | tr -d '"' \ No newline at end of file diff --git a/.ci/write-vpa-version.sh b/.ci/write-vpa-version.sh new file mode 100755 index 000000000000..b8e8d60b96d0 --- /dev/null +++ b/.ci/write-vpa-version.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env sh + +# Copyright (c) 2023 SAP SE or an SAP affiliate company. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +sed -i s/'^\(const VerticalPodAutoscalerVersion = "\).*"'/\\1$1'"'/ vertical-pod-autoscaler/common/version.go \ No newline at end of file diff --git a/hack/boilerplate/boilerplate.py b/hack/boilerplate/boilerplate.py index 7051b3751da4..7f84ae120bcf 100755 --- a/hack/boilerplate/boilerplate.py +++ b/hack/boilerplate/boilerplate.py @@ -163,7 +163,9 @@ def file_extension(filename): "cluster-autoscaler/cloudprovider/mcm", "cluster-autoscaler/integration", "cluster-autoscaler/hack", - "cluster-autoscaler/cloudprovider/builder/builder_all.go" + "cluster-autoscaler/cloudprovider/builder/builder_all.go", + ".ci/read-vpa-version.sh", + ".ci/write-vpa-version.sh" ] # list all the files contain 'DO NOT EDIT', but are not generated