Skip to content

Commit b8ebb68

Browse files
committed
Squashed 'release-tools/' changes from 78c0fb7..c10b678
c10b678 Merge pull request kubernetes-csi#227 from coulof/check-sidecar-supported-versions b055535 Header bd0a10b typo c39d73c Add comments f6491af Script to verify EOL sidecar version 4133d1d Merge pull request kubernetes-csi#226 from msau42/cloudbuild 8d519d2 Pin buildkit to v0.10.6 to workaround v0.11 bug with docker manifest 6e04a03 Merge pull request kubernetes-csi#224 from msau42/cloudbuild 26fdfff Update cloudbuild image 6613c39 Merge pull request kubernetes-csi#223 from sunnylovestiramisu/update 0e7ae99 Update k8s image repo url 77e47cc Merge pull request kubernetes-csi#222 from xinydev/fix-dep-version 155854b Fix dep version mismatch 8f83905 Merge pull request kubernetes-csi#221 from sunnylovestiramisu/go-update 1d3f94d Update go version to 1.20 to match k/k v1.27 e322ce5 Merge pull request kubernetes-csi#220 from andyzhangx/fix-golint-error b74a512 test: fix golint error aa61bfd Merge pull request kubernetes-csi#218 from xing-yang/update_csi_driver 7563d19 Update CSI_PROW_DRIVER_VERSION to v1.11.0 a2171be Merge pull request kubernetes-csi#216 from msau42/process cb98782 Merge pull request kubernetes-csi#217 from msau42/owners a11216e add new reviewers and remove inactive reviewers dd98675 Add step for checking builds b66c082 Merge pull request kubernetes-csi#214 from pohly/junit-fixes b9b6763 filter-junit.go: fix loss of testcases when parsing Ginkgo v2 JUnit d427783 filter-junit.go: preserve system error log 38e1146 prow.sh: publish individual JUnit files as separate artifacts git-subtree-dir: release-tools git-subtree-split: c10b67804e07a324fe33595040afd13f020ee000
1 parent b7b698a commit b8ebb68

7 files changed

+196
-17
lines changed

KUBERNETES_CSI_OWNERS_ALIASES

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@ aliases:
2222
- ggriffiths
2323
- gnufied
2424
- humblec
25+
- mauriciopoppe
2526
- j-griffith
26-
- Jiawei0227
2727
- jingxu97
2828
- jsafrane
2929
- pohly
3030
- RaunakShah
31+
- sunnylovestiramisu
3132
- xing-yang
3233

3334
# This documents who previously contributed to Kubernetes-CSI
3435
# as approver.
3536
emeritus_approvers:
37+
- Jiawei0227
3638
- lpabon
3739
- sbezverk
3840
- vladimirvivien

SIDECAR_RELEASE_PROCESS.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ naming convention `<hostpath-deployment-version>-on-<kubernetes-version>`.
9292
1. Check that all [canary CI
9393
jobs](https://k8s-testgrid.appspot.com/sig-storage-csi-ci) are passing,
9494
and that test coverage is adequate for the changes that are going into the release.
95+
1. Check that the post-\<sidecar\>-push-images builds are succeeding.
96+
[Example](https://k8s-testgrid.appspot.com/sig-storage-image-build#post-external-snapshotter-push-images)
9597
1. Make sure that no new PRs have merged in the meantime, and no PRs are in
9698
flight and soon to be merged.
9799
1. Create a new release following a previous release as a template. Be sure to select the correct
@@ -102,7 +104,7 @@ naming convention `<hostpath-deployment-version>-on-<kubernetes-version>`.
102104
1. Check [image build status](https://k8s-testgrid.appspot.com/sig-storage-image-build).
103105
1. Promote images from k8s-staging-sig-storage to k8s.gcr.io/sig-storage. From
104106
the [k8s image
105-
repo](https://github.com/kubernetes/k8s.io/tree/HEAD/k8s.gcr.io/images/k8s-staging-sig-storage),
107+
repo](https://github.com/kubernetes/k8s.io/tree/HEAD/registry.k8s.io/images/k8s-staging-sig-storage),
106108
run `./generate.sh > images.yaml`, and send a PR with the updated images.
107109
Once merged, the image promoter will copy the images from staging to prod.
108110
1. Update [kubernetes-csi/docs](https://github.com/kubernetes-csi/docs) sidecar

build.make

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ DOCKER_BUILDX_CREATE_ARGS ?=
148148
$(CMDS:%=push-multiarch-%): push-multiarch-%: check-pull-base-ref build-%
149149
set -ex; \
150150
export DOCKER_CLI_EXPERIMENTAL=enabled; \
151-
docker buildx create $(DOCKER_BUILDX_CREATE_ARGS) --use --name multiarchimage-buildertest; \
151+
docker buildx create $(DOCKER_BUILDX_CREATE_ARGS) --use --name multiarchimage-buildertest --driver-opt image=moby/buildkit:v0.10.6; \
152152
trap "docker buildx rm multiarchimage-buildertest" EXIT; \
153153
dockerfile_linux=$$(if [ -e ./$(CMDS_DIR)/$*/Dockerfile ]; then echo ./$(CMDS_DIR)/$*/Dockerfile; else echo Dockerfile; fi); \
154154
dockerfile_windows=$$(if [ -e ./$(CMDS_DIR)/$*/Dockerfile.Windows ]; then echo ./$(CMDS_DIR)/$*/Dockerfile.Windows; else echo Dockerfile.Windows; fi); \

cloudbuild.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ steps:
2626
# The image must contain bash and curl. Ideally it should also contain
2727
# the desired version of Go (currently defined in release-tools/prow.sh),
2828
# but that just speeds up the build and is not required.
29-
- name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20210917-12df099d55'
29+
- name: 'gcr.io/k8s-testimages/gcb-docker-gcloud:v20230424-910a2a439d'
3030
entrypoint: ./.cloudbuild.sh
3131
env:
3232
- GIT_TAG=${_GIT_TAG}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
# Copyright 2023 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import argparse
16+
import datetime
17+
import re
18+
from collections import defaultdict
19+
import subprocess
20+
import shutil
21+
from dateutil.relativedelta import relativedelta
22+
23+
def check_gh_command():
24+
"""
25+
Pretty much everything is processed from `gh`
26+
Check that the `gh` command is in the path before anything else
27+
"""
28+
if not shutil.which('gh'):
29+
print("Error: The `gh` command is not available in the PATH.")
30+
print("Please install the GitHub CLI (https://cli.github.com/) and try again.")
31+
exit(1)
32+
33+
def duration_ago(dt):
34+
"""
35+
Humanize duration ouputs
36+
"""
37+
delta = relativedelta(datetime.datetime.now(), dt)
38+
if delta.years > 0:
39+
return f"{delta.years} year{'s' if delta.years > 1 else ''} ago"
40+
elif delta.months > 0:
41+
return f"{delta.months} month{'s' if delta.months > 1 else ''} ago"
42+
elif delta.days > 0:
43+
return f"{delta.days} day{'s' if delta.days > 1 else ''} ago"
44+
elif delta.hours > 0:
45+
return f"{delta.hours} hour{'s' if delta.hours > 1 else ''} ago"
46+
elif delta.minutes > 0:
47+
return f"{delta.minutes} minute{'s' if delta.minutes > 1 else ''} ago"
48+
else:
49+
return "just now"
50+
51+
def parse_version(version):
52+
"""
53+
Parse version assuming it is in the form of v1.2.3
54+
"""
55+
pattern = r"v(\d+)\.(\d+)\.(\d+)"
56+
match = re.match(pattern, version)
57+
if match:
58+
major, minor, patch = map(int, match.groups())
59+
return (major, minor, patch)
60+
61+
def end_of_life_grouped_versions(versions):
62+
"""
63+
Calculate the end of life date for a minor release version according to : https://kubernetes-csi.github.io/docs/project-policies.html#support
64+
65+
The input is an array of tuples of:
66+
* grouped versions (e.g. 1.0, 1.1)
67+
* array of that contains all versions and their release date (e.g. 1.0.0, 01-01-2013)
68+
69+
versions structure example :
70+
[((3, 5), [('v3.5.0', datetime.datetime(2023, 4, 27, 22, 28, 6))]),
71+
((3, 4),
72+
[('v3.4.1', datetime.datetime(2023, 4, 5, 17, 41, 15)),
73+
('v3.4.0', datetime.datetime(2022, 12, 27, 23, 43, 41))])]
74+
"""
75+
supported_versions = []
76+
# Prepare dates for later calculation
77+
now = datetime.datetime.now()
78+
one_year = datetime.timedelta(days=365)
79+
three_months = datetime.timedelta(days=90)
80+
81+
# get the newer versions on top
82+
sorted_versions_list = sorted(versions.items(), key=lambda x: x[0], reverse=True)
83+
84+
# the latest version is always supported no matter the release date
85+
latest = sorted_versions_list.pop(0)
86+
supported_versions.append(latest[1][-1])
87+
88+
for v in sorted_versions_list:
89+
first_release = v[1][-1]
90+
last_release = v[1][0]
91+
# if the release is less than a year old we support the latest patch version
92+
if now - first_release[1] < one_year:
93+
supported_versions.append(last_release)
94+
# if the main release is older than a year and has a recent path, this is supported
95+
elif now - last_release[1] < three_months:
96+
supported_versions.append(last_release)
97+
return supported_versions
98+
99+
def get_release_docker_image(repo, version):
100+
"""
101+
Extract docker image name from the relase page documentation
102+
"""
103+
output = subprocess.check_output(['gh', 'release', '-R', repo, 'view', version], text=True)
104+
#Extract matching image name excluding `
105+
match = re.search(r"docker pull ([\.\/\-\:\w\d]*)", output)
106+
docker_image = match.group(1) if match else ''
107+
return((version, docker_image))
108+
109+
def get_versions_from_releases(repo):
110+
"""
111+
Using `gh` cli get the github releases page details then
112+
create a list of grouped version on major.minor
113+
and for each give all major.minor.patch with release dates
114+
"""
115+
# Run the `gh release` command to get the release list
116+
output = subprocess.check_output(['gh', 'release', '-R', repo, 'list'], text=True)
117+
# Parse the output and group by major and minor version numbers
118+
versions = defaultdict(lambda: [])
119+
for line in output.strip().split('\n'):
120+
parts = line.split('\t')
121+
# pprint.pprint(parts)
122+
version = parts[0]
123+
parsed_version = parse_version(version)
124+
if parsed_version is None:
125+
continue
126+
major, minor, patch = parsed_version
127+
128+
published = datetime.datetime.strptime(parts[3], '%Y-%m-%dT%H:%M:%SZ')
129+
versions[(major, minor)].append((version, published))
130+
return(versions)
131+
132+
133+
def main():
134+
manual = """
135+
This script lists the supported versions Github releases according to https://kubernetes-csi.github.io/docs/project-policies.html#support
136+
It has been designed to help to update the tables from : https://kubernetes-csi.github.io/docs/sidecar-containers.html\n\n
137+
It can take multiple repos as argument, for all CSI sidecars details you can run:
138+
./get_supported_version_csi-sidecar.py -R kubernetes-csi/external-attacher -R kubernetes-csi/external-provisioner -R kubernetes-csi/external-resizer -R kubernetes-csi/external-snapshotter -R kubernetes-csi/livenessprobe -R kubernetes-csi/node-driver-registrar -R kubernetes-csi/external-health-monitor\n
139+
With the output you can then update the documentation manually.
140+
"""
141+
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description=manual)
142+
parser.add_argument('--repo', '-R', required=True, action='append', dest='repos', help='The name of the repository in the format owner/repo.')
143+
parser.add_argument('--display', '-d', action='store_true', help='(default) Display EOL versions with their dates', default=True)
144+
parser.add_argument('--doc', '-D', action='store_true', help='Helper to https://kubernetes-csi.github.io/docs/ that prints Docker image for each EOL version')
145+
146+
args = parser.parse_args()
147+
148+
# Verify pre-reqs
149+
check_gh_command()
150+
151+
# Process all repos
152+
for repo in args.repos:
153+
versions = get_versions_from_releases(repo)
154+
eol_versions = end_of_life_grouped_versions(versions)
155+
156+
if args.display:
157+
print(f"Supported versions with release date and age of `{repo}`:\n")
158+
for version in eol_versions:
159+
print(f"{version[0]}\t{version[1].strftime('%Y-%m-%d')}\t{duration_ago(version[1])}")
160+
161+
# TODO : generate proper doc output for the tables of: https://kubernetes-csi.github.io/docs/sidecar-containers.html
162+
if args.doc:
163+
print("\nSupported Versions with docker images for each end of life version:\n")
164+
for version in eol_versions:
165+
_, image = get_release_docker_image(repo, version[0])
166+
print(f"{version[0]}\t{image}")
167+
print()
168+
169+
if __name__ == '__main__':
170+
main()

filter-junit.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ package main
2424
import (
2525
"encoding/xml"
2626
"flag"
27-
"io/ioutil"
2827
"os"
2928
"regexp"
3029
)
@@ -56,6 +55,7 @@ type TestCase struct {
5655
Name string `xml:"name,attr"`
5756
Time string `xml:"time,attr"`
5857
SystemOut string `xml:"system-out,omitempty"`
58+
SystemErr string `xml:"system-err,omitempty"`
5959
Failure string `xml:"failure,omitempty"`
6060
Skipped SkipReason `xml:"skipped,omitempty"`
6161
}
@@ -95,7 +95,7 @@ func main() {
9595
}
9696
} else {
9797
var err error
98-
data, err = ioutil.ReadFile(input)
98+
data, err = os.ReadFile(input)
9999
if err != nil {
100100
panic(err)
101101
}
@@ -109,7 +109,7 @@ func main() {
109109
if err := xml.Unmarshal(data, &junitv2); err != nil {
110110
panic(err)
111111
}
112-
junit = junitv2.TestSuite
112+
junit.TestCases = append(junit.TestCases, junitv2.TestSuite.TestCases...)
113113
}
114114
}
115115

@@ -142,7 +142,7 @@ func main() {
142142
panic(err)
143143
}
144144
} else {
145-
if err := ioutil.WriteFile(*output, data, 0644); err != nil {
145+
if err := os.WriteFile(*output, data, 0644); err != nil {
146146
panic(err)
147147
}
148148
}

prow.sh

+14-9
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ configvar CSI_PROW_BUILD_PLATFORMS "linux amd64 amd64; linux ppc64le ppc64le -pp
8686
# which is disabled with GOFLAGS=-mod=vendor).
8787
configvar GOFLAGS_VENDOR "$( [ -d vendor ] && echo '-mod=vendor' )" "Go flags for using the vendor directory"
8888

89-
configvar CSI_PROW_GO_VERSION_BUILD "1.19" "Go version for building the component" # depends on component's source code
89+
configvar CSI_PROW_GO_VERSION_BUILD "1.20" "Go version for building the component" # depends on component's source code
9090
configvar CSI_PROW_GO_VERSION_E2E "" "override Go version for building the Kubernetes E2E test suite" # normally doesn't need to be set, see install_e2e
9191
configvar CSI_PROW_GO_VERSION_SANITY "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building the csi-sanity test suite" # depends on CSI_PROW_SANITY settings below
9292
configvar CSI_PROW_GO_VERSION_KIND "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building 'kind'" # depends on CSI_PROW_KIND_VERSION below
@@ -196,7 +196,7 @@ kindest/node:v1.18.20@sha256:738cdc23ed4be6cc0b7ea277a2ebcc454c8373d7d8fb991a7fc
196196
# If the deployment script is called with CSI_PROW_TEST_DRIVER=<file name> as
197197
# environment variable, then it must write a suitable test driver configuration
198198
# into that file in addition to installing the driver.
199-
configvar CSI_PROW_DRIVER_VERSION "v1.8.0" "CSI driver version"
199+
configvar CSI_PROW_DRIVER_VERSION "v1.11.0" "CSI driver version"
200200
configvar CSI_PROW_DRIVER_REPO https://github.com/kubernetes-csi/csi-driver-host-path "CSI driver repo"
201201
configvar CSI_PROW_DEPLOYMENT "" "deployment"
202202
configvar CSI_PROW_DEPLOYMENT_SUFFIX "" "additional suffix in kubernetes-x.yy[suffix].yaml files"
@@ -245,7 +245,7 @@ configvar CSI_PROW_SANITY_CONTAINER "hostpath" "Kubernetes container with CSI dr
245245

246246
# The version of dep to use for 'make test-vendor'. Ignored if the project doesn't
247247
# use dep. Only binary releases of dep are supported (https://github.com/golang/dep/releases).
248-
configvar CSI_PROW_DEP_VERSION v0.5.1 "golang dep version to be used for vendor checking"
248+
configvar CSI_PROW_DEP_VERSION v0.5.4 "golang dep version to be used for vendor checking"
249249

250250
# Each job can run one or more of the following tests, identified by
251251
# a single word:
@@ -469,7 +469,7 @@ install_dep () {
469469
if dep version 2>/dev/null | grep -q "version:.*${CSI_PROW_DEP_VERSION}$"; then
470470
return
471471
fi
472-
run curl --fail --location -o "${CSI_PROW_WORK}/bin/dep" "https://github.com/golang/dep/releases/download/v0.5.4/dep-linux-amd64" &&
472+
run curl --fail --location -o "${CSI_PROW_WORK}/bin/dep" "https://github.com/golang/dep/releases/download/${CSI_PROW_DEP_VERSION}/dep-linux-amd64" &&
473473
chmod u+x "${CSI_PROW_WORK}/bin/dep"
474474
}
475475

@@ -1008,7 +1008,10 @@ run_e2e () (
10081008
# the full Kubernetes E2E testsuite while only running a few tests.
10091009
move_junit () {
10101010
if ls "${ARTIFACTS}"/junit_[0-9]*.xml 2>/dev/null >/dev/null; then
1011-
run_filter_junit -t="External.Storage|CSI.mock.volume" -o "${ARTIFACTS}/junit_${name}.xml" "${ARTIFACTS}"/junit_[0-9]*.xml && rm -f "${ARTIFACTS}"/junit_[0-9]*.xml
1011+
mkdir -p "${ARTIFACTS}/junit/${name}" &&
1012+
mkdir -p "${ARTIFACTS}/junit/steps" &&
1013+
run_filter_junit -t="External.Storage|CSI.mock.volume" -o "${ARTIFACTS}/junit/steps/junit_${name}.xml" "${ARTIFACTS}"/junit_[0-9]*.xml &&
1014+
mv "${ARTIFACTS}"/junit_[0-9]*.xml "${ARTIFACTS}/junit/${name}/"
10121015
fi
10131016
}
10141017
trap move_junit EXIT
@@ -1085,13 +1088,14 @@ kubectl exec "$pod" -c "${CSI_PROW_SANITY_CONTAINER}" -- /bin/sh -c "\${CHECK_PA
10851088
EOF
10861089
10871090
chmod u+x "${CSI_PROW_WORK}"/*dir_in_pod.sh
1091+
mkdir -p "${ARTIFACTS}/junit/steps"
10881092
10891093
# This cannot run in parallel, because -csi.junitfile output
10901094
# from different Ginkgo nodes would go to the same file. Also the
10911095
# staging and target directories are the same.
10921096
run_with_loggers "${CSI_PROW_WORK}/csi-sanity" \
10931097
-ginkgo.v \
1094-
-csi.junitfile "${ARTIFACTS}/junit_sanity.xml" \
1098+
-csi.junitfile "${ARTIFACTS}/junit/steps/junit_sanity.xml" \
10951099
-csi.endpoint "dns:///$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' csi-prow-control-plane):$(kubectl get "services/${CSI_PROW_SANITY_SERVICE}" -o "jsonpath={..nodePort}")" \
10961100
-csi.stagingdir "/tmp/staging" \
10971101
-csi.mountdir "/tmp/mount" \
@@ -1121,7 +1125,8 @@ make_test_to_junit () {
11211125
# Plain make-test.xml was not delivered as text/xml by the web
11221126
# server and ignored by spyglass. It seems that the name has to
11231127
# match junit*.xml.
1124-
out="${ARTIFACTS}/junit_make_test.xml"
1128+
out="${ARTIFACTS}/junit/steps/junit_make_test.xml"
1129+
mkdir -p "$(dirname "$out")"
11251130
testname=
11261131
echo "<testsuite>" >>"$out"
11271132
@@ -1385,8 +1390,8 @@ main () {
13851390
fi
13861391
13871392
# Merge all junit files into one. This gets rid of duplicated "skipped" tests.
1388-
if ls "${ARTIFACTS}"/junit_*.xml 2>/dev/null >&2; then
1389-
run_filter_junit -o "${CSI_PROW_WORK}/junit_final.xml" "${ARTIFACTS}"/junit_*.xml && rm "${ARTIFACTS}"/junit_*.xml && mv "${CSI_PROW_WORK}/junit_final.xml" "${ARTIFACTS}"
1393+
if ls "${ARTIFACTS}"/junit/steps/junit_*.xml 2>/dev/null >&2; then
1394+
run_filter_junit -o "${ARTIFACTS}/junit_final.xml" "${ARTIFACTS}"/junit/steps/junit_*.xml
13901395
fi
13911396
13921397
return "$ret"

0 commit comments

Comments
 (0)