Skip to content

Commit 9c9c2a8

Browse files
authored
Merge pull request #213 from Muscraft/dont-change-folder-each-release
refactor: Don't change folder on version bump
2 parents edd6fb8 + 63f877a commit 9c9c2a8

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_lts_arches = [
@@ -78,20 +84,20 @@ def update_debian():
7884
arch_case += f" {arch.dpkg}) rustArch='{arch.rust}'; rustupSha256='{hash}' ;; \\\n"
7985
arch_case += end
8086

81-
for rust_version in supported_rust_versions:
87+
for channel in supported_channels:
8288
rendered = template \
83-
.replace("%%RUST-VERSION%%", rust_version) \
89+
.replace("%%RUST-VERSION%%", channel.rust_version) \
8490
.replace("%%RUSTUP-VERSION%%", rustup_version) \
8591
.replace("%%DEBIAN-SUITE%%", variant.name) \
8692
.replace("%%ARCH-CASE%%", arch_case)
87-
write_file(f"{rust_version}/{variant.name}/Dockerfile", rendered)
93+
write_file(f"{channel.name}/{variant.name}/Dockerfile", rendered)
8894

8995
rendered = slim_template \
90-
.replace("%%RUST-VERSION%%", rust_version) \
96+
.replace("%%RUST-VERSION%%", channel.rust_version) \
9197
.replace("%%RUSTUP-VERSION%%", rustup_version) \
9298
.replace("%%DEBIAN-SUITE%%", variant.name) \
9399
.replace("%%ARCH-CASE%%", arch_case)
94-
write_file(f"{rust_version}/{variant.name}/slim/Dockerfile", rendered)
100+
write_file(f"{channel.name}/{variant.name}/slim/Dockerfile", rendered)
95101

96102
def update_alpine():
97103
arch_case = 'apkArch="$(apk --print-arch)"; \\\n'
@@ -105,21 +111,21 @@ def update_alpine():
105111
template = read_file("Dockerfile-alpine.template")
106112

107113
for version in alpine_versions:
108-
for rust_version in supported_rust_versions:
114+
for channel in supported_channels:
109115
rendered = template \
110-
.replace("%%RUST-VERSION%%", rust_version) \
116+
.replace("%%RUST-VERSION%%", channel.rust_version) \
111117
.replace("%%RUSTUP-VERSION%%", rustup_version) \
112118
.replace("%%TAG%%", version) \
113119
.replace("%%ARCH-CASE%%", arch_case)
114-
write_file(f"{rust_version}/alpine{version}/Dockerfile", rendered)
120+
write_file(f"{channel.name}/alpine{version}/Dockerfile", rendered)
115121

116122
def update_ci():
117123
file = ".github/workflows/ci.yml"
118124
config = read_file(file)
119125

120126
marker = "#RUST_VERSION\n"
121127
split = config.split(marker)
122-
rendered = split[0] + marker + f" RUST_VERSION: {stable_rust_version}\n" + marker + split[2]
128+
rendered = split[0] + marker + f" RUST_VERSION: {stable.rust_version}\n" + marker + split[2]
123129

124130
versions = ""
125131
for variant in debian_variants:
@@ -198,7 +204,7 @@ def file_commit(file):
198204
.strip()
199205

200206
def version_tags():
201-
parts = stable_rust_version.split(".")
207+
parts = stable.rust_version.split(".")
202208
tags = []
203209
for i in range(len(parts)):
204210
tags.append(".".join(parts[:i + 1]))
@@ -238,7 +244,7 @@ def generate_stackbrew_library():
238244
library += single_library(
239245
tags,
240246
map(lambda a: a.bashbrew, arches),
241-
os.path.join(stable_rust_version, variant.name))
247+
os.path.join(stable.name, variant.name))
242248

243249
tags = []
244250
for version_tag in version_tags():
@@ -252,7 +258,7 @@ def generate_stackbrew_library():
252258
library += single_library(
253259
tags,
254260
map(lambda a: a.bashbrew, arches),
255-
os.path.join(stable_rust_version, variant.name, "slim"))
261+
os.path.join(stable.name, variant.name, "slim"))
256262

257263
for version in alpine_versions:
258264
tags = []
@@ -267,7 +273,7 @@ def generate_stackbrew_library():
267273
library += single_library(
268274
tags,
269275
map(lambda a: a.bashbrew, alpine_arches),
270-
os.path.join(stable_rust_version, f"alpine{version}"))
276+
os.path.join(stable.name, f"alpine{version}"))
271277

272278
print(library)
273279

0 commit comments

Comments
 (0)