Skip to content

Commit 331fd64

Browse files
committed
Update templated files to rev 2ef5a91 (#70)
Automatically created PR based on commit 2ef5a917cce8d1710e1ce0d099947663f74b4428 in stackabletech/operator-templating repo. Triggered by: Daily run triggered
1 parent 808ab66 commit 331fd64

File tree

6 files changed

+79
-69
lines changed

6 files changed

+79
-69
lines changed

.github/pull_request_template.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
## Description
1+
2+
# Description
23

34
*Please add a description here. This will become the commit message of the merge request later.*
45

56
<!-- Commit message above. Everything below is not added to the message. Do not change this line! -->
67

78
## Review Checklist
9+
810
- [ ] Code contains useful comments
911
- [ ] (Integration-)Test cases added (or not applicable)
1012
- [ ] Documentation added (or not applicable)

.pre-commit-config.yaml

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,39 @@
22
# See https://pre-commit.com for more information
33
# See https://pre-commit.com/hooks.html for more hooks
44
repos:
5-
- repo: https://github.com/pre-commit/pre-commit-hooks
6-
rev: v3.2.0
7-
hooks:
8-
- id: trailing-whitespace
9-
- id: end-of-file-fixer
10-
- id: detect-aws-credentials
11-
args: ["--allow-missing-credentials"]
12-
- id: detect-private-key
13-
- repo: https://github.com/doublify/pre-commit-rust
14-
rev: v1.0
15-
hooks:
16-
- id: fmt
17-
- id: clippy
18-
args: ["--all-targets"]
19-
- repo: https://github.com/adrienverge/yamllint
20-
rev: v1.26.3
21-
hooks:
22-
- id: yamllint
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v4.2.0
7+
hooks:
8+
- id: trailing-whitespace
9+
- id: end-of-file-fixer
10+
- id: detect-aws-credentials
11+
args: ["--allow-missing-credentials"]
12+
- id: detect-private-key
13+
14+
- repo: https://github.com/doublify/pre-commit-rust
15+
rev: v1.0
16+
hooks:
17+
- id: fmt
18+
args: ["--all", "--", "--check"]
19+
- id: clippy
20+
args: ["--all-targets", "--", "-D", "warnings"]
21+
22+
- repo: https://github.com/adrienverge/yamllint
23+
rev: v1.26.3
24+
hooks:
25+
- id: yamllint
26+
27+
- repo: https://github.com/igorshubovych/markdownlint-cli
28+
rev: v0.31.1
29+
hooks:
30+
- id: markdownlint
31+
32+
- repo: https://github.com/PyCQA/flake8
33+
rev: 4.0.1
34+
hooks:
35+
- id: flake8
36+
37+
- repo: https://github.com/PyCQA/pylint
38+
rev: v2.13.9
39+
hooks:
40+
- id: pylint

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ docker: docker-build docker-publish
3131
docker-release: docker-build-latest docker-publish
3232

3333
## Chart related targets
34-
compile-chart: version crds config
34+
compile-chart: version crds config
3535

3636
chart-clean:
3737
rm -rf deploy/helm/spark-k8s-operator/configs

deploy/helm/spark-k8s-operator/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,3 @@ The operator has example requests included in the [`/examples`](https://github.c
2525
## Links
2626

2727
https://github.com/stackabletech/spark-k8s-operator
28-

deploy/helm/spark-k8s-operator/templates/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ Labels for Kubernetes objects created by helm test
7373
*/}}
7474
{{- define "operator.testLabels" -}}
7575
helm.sh/test: {{ include "operator.chart" . }}
76-
{{- end }}
76+
{{- end }}

python/cargo_version.py

Lines changed: 38 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,10 @@
55
#
66
# usage: cargo-version.py [-h] [-p PROJECT] [-r] [-n {major,minor,patch}] [-s SET] [-o] [-m PRERELEASE]
77
#
8-
# Change versions of cargo projects.
9-
#
10-
# optional arguments:
11-
# -h, --help show this help message and exit
12-
# -p PROJECT, --project PROJECT
13-
# Project folder
14-
# -r, --release Version
15-
# -n {major,minor,patch}, --next {major,minor,patch}
16-
# Version
17-
# -s SET, --set SET Version
18-
# -o, --show Version
19-
# -m PRERELEASE, --prerelease PRERELEASE
20-
# Set pre-prelease string.
21-
#
8+
import argparse
9+
2210
import toml
2311
import semver
24-
import argparse
2512

2613

2714
class Crate:
@@ -41,20 +28,22 @@ def finalize(cls, version):
4128

4229
@classmethod
4330
def bump_level(cls, version, level):
44-
v = semver.VersionInfo.parse(version)
31+
ver = semver.VersionInfo.parse(version)
4532
if level == "major":
46-
return str(v.bump_major())
47-
elif level == "minor":
48-
return str(v.bump_minor())
49-
elif level == "patch":
50-
return str(v.bump_patch())
51-
else:
52-
return str(v.bump_prerelease("nightly"))[:-2] # remove the .1 suffix that semver always adds to the prererelease.
33+
return str(ver.bump_major())
34+
if level == "minor":
35+
return str(ver.bump_minor())
36+
if level == "patch":
37+
return str(ver.bump_patch())
38+
39+
return str(ver.bump_prerelease("nightly"))[
40+
:-2
41+
] # remove the .1 suffix that semver always adds to the prererelease.
5342

5443
@classmethod
5544
def prerelease(cls, version, prerelease):
56-
v = semver.VersionInfo.parse(version)
57-
return str(semver.VersionInfo(v.major, v.minor, v.patch, prerelease))
45+
ver = semver.VersionInfo.parse(version)
46+
return str(semver.VersionInfo(ver.major, ver.minor, ver.patch, prerelease))
5847

5948
def finalize_version(self):
6049
return Crate(
@@ -94,25 +83,25 @@ def show_version(self):
9483
def save(self, previous):
9584
contents = []
9685
cargo_file = f"{self.path}/Cargo.toml"
97-
with open(cargo_file, "r") as r:
98-
for line in r.readlines():
86+
with open(cargo_file, "r", encoding="utf8") as ctl:
87+
for line in ctl.readlines():
9988
if line.startswith("version"):
10089
line = line.replace(previous.version, self.version)
10190
else:
10291
for dname, dversion in self.dependencies.items():
10392
if line.startswith(dname):
10493
line = line.replace(previous.dependencies[dname], dversion)
10594
contents.append(line)
106-
with open(cargo_file, "w") as w:
107-
w.write("".join(contents))
95+
with open(cargo_file, "w", encoding="utf8") as ctl:
96+
ctl.write("".join(contents))
10897

10998
def __str__(self):
11099
return f"Crate({self.path}, {self.name}, {self.version}, {self.dependencies})"
111100

112101

113102
class Workspace:
114103
def __init__(self, crates):
115-
names = set([c.name for c in crates])
104+
names = {c.name for c in crates}
116105
self.crates = {c.name: c.with_dependencies(names) for c in crates}
117106

118107
def finalize_version(self):
@@ -136,8 +125,8 @@ def next_version(self):
136125
return Workspace(Workspace.update_dependencies(crates).values())
137126

138127
def show_version(self):
139-
for c in self.crates.values():
140-
return c.show_version()
128+
for cts in self.crates.values():
129+
return cts.show_version()
141130
return "0.0.0"
142131

143132
@classmethod
@@ -151,26 +140,28 @@ def __str__(self):
151140
return f"Workspace({[str(c) for c in self.crates.values()]})"
152141

153142
def save(self, previous):
154-
for cn in self.crates.keys():
155-
self.crates[cn].save(previous.crates[cn])
143+
for crn in self.crates.keys():
144+
self.crates[crn].save(previous.crates[crn])
156145

157146

158147
def load(root):
159-
r = toml.load(f"{root}/Cargo.toml")
160-
if "workspace" in r:
161-
return Workspace([load(f"{root}/{path}") for path in r["workspace"]["members"]])
162-
else:
163-
return Crate(
164-
path=root,
165-
name=r["package"]["name"],
166-
version=r["package"]["version"],
167-
dependencies={
168-
dn: r["dependencies"][dn]["version"]
169-
for dn in r["dependencies"]
170-
if "version" in r["dependencies"][dn]
171-
},
148+
ctl = toml.load(f"{root}/Cargo.toml")
149+
if "workspace" in ctl:
150+
return Workspace(
151+
[load(f"{root}/{path}") for path in ctl["workspace"]["members"]]
172152
)
173153

154+
return Crate(
155+
path=root,
156+
name=ctl["package"]["name"],
157+
version=ctl["package"]["version"],
158+
dependencies={
159+
dn: ctl["dependencies"][dn]["version"]
160+
for dn in ctl["dependencies"]
161+
if "version" in ctl["dependencies"][dn]
162+
},
163+
)
164+
174165

175166
def parse_args():
176167
parser = argparse.ArgumentParser(description="Change versions of cargo projects.")

0 commit comments

Comments
 (0)