Skip to content

Commit 3b55c81

Browse files
committed
refactor: Don't change folder on version bump
1 parent 9f28728 commit 3b55c81

File tree

8 files changed

+22
-16
lines changed

8 files changed

+22
-16
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ jobs:
4141
steps:
4242
- uses: actions/checkout@v4
4343
- run: git clone https://github.com/docker-library/official-images.git ~/official-images
44-
- run: docker build -t rust:$RUST_VERSION-${{ matrix.name }} $RUST_VERSION/${{ matrix.variant }}
44+
- run: docker build -t rust:$RUST_VERSION-${{ matrix.name }} stable/${{ matrix.variant }}
4545
- run: ~/official-images/test/run.sh rust:$RUST_VERSION-${{ matrix.name }}
4646
- run: docker images
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

x.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,16 @@
66
import subprocess
77
import sys
88

9-
stable_rust_version = "1.81.0"
10-
supported_rust_versions = [stable_rust_version, "nightly"]
119
rustup_version = "1.27.1"
1210

11+
Channel = namedtuple("Channel", ["name", "rust_version"])
12+
stable = Channel("stable", "1.81.0")
13+
nightly = Channel("nightly", "nightly")
14+
supported_channels = [
15+
stable,
16+
nightly
17+
]
18+
1319
DebianArch = namedtuple("DebianArch", ["bashbrew", "dpkg", "qemu", "rust"])
1420

1521
debian_arches = [
@@ -75,20 +81,20 @@ def update_debian():
7581
case = arch_case
7682
case += end
7783

78-
for rust_version in supported_rust_versions:
84+
for channel in supported_channels:
7985
rendered = template \
80-
.replace("%%RUST-VERSION%%", rust_version) \
86+
.replace("%%RUST-VERSION%%", channel.rust_version) \
8187
.replace("%%RUSTUP-VERSION%%", rustup_version) \
8288
.replace("%%DEBIAN-SUITE%%", variant) \
8389
.replace("%%ARCH-CASE%%", case)
84-
write_file(f"{rust_version}/{variant}/Dockerfile", rendered)
90+
write_file(f"{channel.name}/{variant}/Dockerfile", rendered)
8591

8692
rendered = slim_template \
87-
.replace("%%RUST-VERSION%%", rust_version) \
93+
.replace("%%RUST-VERSION%%", channel.rust_version) \
8894
.replace("%%RUSTUP-VERSION%%", rustup_version) \
8995
.replace("%%DEBIAN-SUITE%%", variant) \
9096
.replace("%%ARCH-CASE%%", case)
91-
write_file(f"{rust_version}/{variant}/slim/Dockerfile", rendered)
97+
write_file(f"{channel.name}/{variant}/slim/Dockerfile", rendered)
9298

9399
def update_alpine():
94100
arch_case = 'apkArch="$(apk --print-arch)"; \\\n'
@@ -102,21 +108,21 @@ def update_alpine():
102108
template = read_file("Dockerfile-alpine.template")
103109

104110
for version in alpine_versions:
105-
for rust_version in supported_rust_versions:
111+
for channel in supported_channels:
106112
rendered = template \
107-
.replace("%%RUST-VERSION%%", rust_version) \
113+
.replace("%%RUST-VERSION%%", channel.rust_version) \
108114
.replace("%%RUSTUP-VERSION%%", rustup_version) \
109115
.replace("%%TAG%%", version) \
110116
.replace("%%ARCH-CASE%%", arch_case)
111-
write_file(f"{rust_version}/alpine{version}/Dockerfile", rendered)
117+
write_file(f"{channel.name}/alpine{version}/Dockerfile", rendered)
112118

113119
def update_ci():
114120
file = ".github/workflows/ci.yml"
115121
config = read_file(file)
116122

117123
marker = "#RUST_VERSION\n"
118124
split = config.split(marker)
119-
rendered = split[0] + marker + f" RUST_VERSION: {stable_rust_version}\n" + marker + split[2]
125+
rendered = split[0] + marker + f" RUST_VERSION: {stable.rust_version}\n" + marker + split[2]
120126

121127
versions = ""
122128
for variant in debian_variants:
@@ -195,7 +201,7 @@ def file_commit(file):
195201
.strip()
196202

197203
def version_tags():
198-
parts = stable_rust_version.split(".")
204+
parts = stable.rust_version.split(".")
199205
tags = []
200206
for i in range(len(parts)):
201207
tags.append(".".join(parts[:i + 1]))
@@ -235,7 +241,7 @@ def generate_stackbrew_library():
235241
library += single_library(
236242
tags,
237243
map(lambda a: a.bashbrew, arches),
238-
os.path.join(stable_rust_version, variant))
244+
os.path.join(stable.name, variant))
239245

240246
tags = []
241247
for version_tag in version_tags():
@@ -249,7 +255,7 @@ def generate_stackbrew_library():
249255
library += single_library(
250256
tags,
251257
map(lambda a: a.bashbrew, arches),
252-
os.path.join(stable_rust_version, variant, "slim"))
258+
os.path.join(stable.name, variant, "slim"))
253259

254260
for version in alpine_versions:
255261
tags = []
@@ -264,7 +270,7 @@ def generate_stackbrew_library():
264270
library += single_library(
265271
tags,
266272
map(lambda a: a.bashbrew, alpine_arches),
267-
os.path.join(stable_rust_version, f"alpine{version}"))
273+
os.path.join(stable.name, f"alpine{version}"))
268274

269275
print(library)
270276

0 commit comments

Comments
 (0)