Skip to content

Commit 2d52501

Browse files
Update S3 artifact metadata suffix , gardenlinux_epoch and `build_timestamp (#314)
* Ensure S3 artifact metadata `suffix` is not missing content * Ensure S3 aritfact metadata `gardenlinux_epoch` remains a int * Bump version to `0.10.13` Signed-off-by: Tobias Wolf <wolf@b1-systems.de> On-behalf-of: SAP <tobias.wolf@sap.com>
1 parent 1294c05 commit 2d52501

File tree

5 files changed

+12
-17
lines changed

5 files changed

+12
-17
lines changed

.github/actions/setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Installs the given GardenLinux Python library
44
inputs:
55
version:
66
description: GardenLinux Python library version
7-
default: "0.10.12"
7+
default: "0.10.13"
88
python_version:
99
description: Python version to setup
1010
default: "3.13"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "gardenlinux"
3-
version = "0.10.12"
3+
version = "0.10.13"
44
description = "Contains tools to work with the features directory of gardenlinux, for example deducting dependencies from feature sets or validating cnames"
55
authors = ["Garden Linux Maintainers <contact@gardenlinux.io>"]
66
license = "Apache-2.0"

src/gardenlinux/s3/s3_artifacts.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,18 +169,12 @@ def upload_from_directory(
169169
if commit_id_or_hash is None:
170170
commit_id_or_hash = cname_object.commit_id
171171

172-
version_epoch = str(cname_object.version_epoch)
173-
174-
if version_epoch is None:
175-
version_epoch = ""
176-
177172
metadata = {
178173
"platform": cname_object.feature_set_platform,
179174
"architecture": arch,
180175
"base_image": None,
181176
"build_committish": commit_id_or_hash,
182-
"build_timestamp": datetime.fromtimestamp(release_timestamp).isoformat(),
183-
"gardenlinux_epoch": version_epoch,
177+
"build_timestamp": datetime.fromtimestamp(release_timestamp),
184178
"logs": None,
185179
"modifiers": feature_set_list,
186180
"require_uefi": require_uefi,
@@ -193,6 +187,9 @@ def upload_from_directory(
193187
"paths": [],
194188
}
195189

190+
if cname_object.version_epoch is not None:
191+
metadata["gardenlinux_epoch"] = cname_object.version_epoch
192+
196193
platform_variant = cname_object.platform_variant
197194

198195
if platform_variant is not None:
@@ -210,13 +207,11 @@ def upload_from_directory(
210207
md5sum = file_digest(fp, "md5").hexdigest()
211208
sha256sum = file_digest(fp, "sha256").hexdigest()
212209

213-
suffixes = "".join(artifact.name)[1 + base_name_length :]
214-
215210
artifact_metadata = {
216211
"name": artifact.name,
217212
"s3_bucket_name": self._bucket.name,
218213
"s3_key": s3_key,
219-
"suffix": re_object.sub("+", suffixes),
214+
"suffix": re_object.sub("+", artifact.name[base_name_length:]),
220215
"md5sum": md5sum,
221216
"sha256sum": sha256sum,
222217
}

tests/s3/constants.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
architecture: amd64
1717
base_image: null
1818
build_committish: abc123lo
19-
build_timestamp: '{build_timestamp}'
20-
gardenlinux_epoch: '1234'
19+
build_timestamp: {build_timestamp}
2120
logs: null
2221
modifiers:
2322
- _usi
@@ -33,7 +32,8 @@
3332
- name: container-amd64-1234.1-abc123lo.release
3433
s3_bucket_name: test-bucket
3534
s3_key: objects/container-amd64-1234.1-abc123lo/container-amd64-1234.1-abc123lo.release
36-
suffix: release
35+
suffix: .release
3736
md5sum: {md5sum}
3837
sha256sum: {sha256sum}
38+
gardenlinux_epoch: 1234
3939
""".strip()

tests/s3/test_main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ def test_main_with_expected_result(
9696
result = capsys.readouterr().out.strip()
9797

9898
result = re.sub(
99-
"^(.*)build_timestamp\\: '.+'$",
100-
"\\1build_timestamp: '{build_timestamp}'",
99+
"^(.*)build_timestamp\\: .+$",
100+
"\\1build_timestamp: {build_timestamp}",
101101
result,
102102
flags=re.M,
103103
)

0 commit comments

Comments
 (0)