Skip to content

Commit 9af6c50

Browse files
Encode certain special characters of AWS S3 tags as + (#238)
Signed-off-by: Tobias Wolf <[email protected]>
1 parent 4165839 commit 9af6c50

File tree

7 files changed

+15
-8
lines changed

7 files changed

+15
-8
lines changed

.github/actions/features_parse/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ outputs:
1111
runs:
1212
using: composite
1313
steps:
14-
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/[email protected].3
14+
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/[email protected].4
1515
- id: result
1616
shell: bash
1717
run: |

.github/actions/flavors_parse/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ outputs:
1313
runs:
1414
using: composite
1515
steps:
16-
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/[email protected].3
16+
- uses: gardenlinux/python-gardenlinux-lib/.github/actions/[email protected].4
1717
- id: matrix
1818
shell: bash
1919
run: |

.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.3"
7+
default: "0.10.4"
88
python_version:
99
description: Python version to setup
1010
default: "3.14"

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.3"
3+
version = "0.10.4"
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 <[email protected]>"]
66
license = "Apache-2.0"

src/gardenlinux/s3/s3_artifacts.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""
66

77
import logging
8+
import re
89
from configparser import UNNAMED_SECTION, ConfigParser
910
from datetime import datetime
1011
from hashlib import file_digest
@@ -189,6 +190,8 @@ def upload_from_directory(
189190
"paths": [],
190191
}
191192

193+
re_object = re.compile("[^a-zA-Z0-9\\s+\\-=.\\_:/@]")
194+
192195
for artifact in artifacts_dir.iterdir():
193196
if not artifact.match(f"{cname}*"):
194197
continue
@@ -216,9 +219,9 @@ def upload_from_directory(
216219
}
217220

218221
s3_tags = {
219-
"architecture": cname_object.arch,
220-
"platform": cname_object.platform,
221-
"version": cname_object.version,
222+
"architecture": re_object.sub("+", cname_object.arch),
223+
"platform": re_object.sub("+", cname_object.platform),
224+
"version": re_object.sub("+", cname_object.version),
222225
"committish": commit_hash,
223226
"md5sum": md5sum,
224227
"sha256sum": sha256sum,

tests/s3/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class S3Env:
2222

2323

2424
def make_cname(
25-
flavor: str = "container",
25+
flavor: str = "kvm-container",
2626
arch: str = "amd64",
2727
version: str = "1234.1",
2828
commit: str = "abc123",

tests/s3/test_s3_artifacts.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ def test_upload_from_directory_success(s3_setup):
120120
assert metadata["require_uefi"] is True
121121
assert metadata["secureboot"] is True
122122

123+
raw_tags_response = env.s3.meta.client.get_object_tagging(Bucket=env.bucket_name, Key=f"objects/{env.cname}/{env.cname}-file1")
124+
tags = { tag['Key']: tag['Value'] for tag in raw_tags_response["TagSet"] }
125+
assert tags["platform"] == "container+kvm"
126+
123127

124128
def test_upload_from_directory_with_delete(s3_setup):
125129
"""

0 commit comments

Comments
 (0)