Skip to content

Commit f8f7c35

Browse files
committed
fix: Update '_' and '/' with '-' in filename creation
1 parent a2ba96f commit f8f7c35

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

ci-scripts/queue_build.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
from __future__ import absolute_import
1414

1515
import os
16+
import re
1617
import time
18+
1719
import boto3
1820

1921
account = boto3.client(
@@ -23,9 +25,13 @@
2325

2426

2527
def queue_build():
26-
build_id = os.environ.get("CODEBUILD_BUILD_ID", "CODEBUILD-BUILD-ID")
27-
source_version = os.environ.get("CODEBUILD_SOURCE_VERSION", "CODEBUILD-SOURCE-VERSION").replace(
28-
"/", "-"
28+
build_id = re.sub(
29+
"[_/]", "-", os.environ.get("CODEBUILD_BUILD_ID", "CODEBUILD-BUILD-ID")
30+
)
31+
source_version = re.sub(
32+
"[_/]",
33+
"-",
34+
os.environ.get("CODEBUILD_SOURCE_VERSION", "CODEBUILD-SOURCE-VERSION"),
2935
)
3036
ticket_number = int(1000 * time.time())
3137
filename = "%s_%s_%s" % (ticket_number, build_id, source_version)
@@ -54,7 +60,8 @@ def _wait_for_other_builds(files, ticket_number):
5460
for order, file in enumerate(sorted_files):
5561
file_ticket_number, build_id, source_version = _build_info_from_file(file)
5662
print(
57-
"%s -> %s %s, ticket number: %s" % (order, build_id, source_version, file_ticket_number)
63+
"%s -> %s %s, ticket number: %s"
64+
% (order, build_id, source_version, file_ticket_number)
5865
)
5966

6067
for file in sorted_files:
@@ -71,7 +78,8 @@ def _wait_for_other_builds(files, ticket_number):
7178

7279
if build_status == "IN_PROGRESS":
7380
print(
74-
"waiting on build %s %s %s" % (build_id, source_version, file_ticket_number)
81+
"waiting on build %s %s %s"
82+
% (build_id, source_version, file_ticket_number)
7583
)
7684
time.sleep(30)
7785
else:

0 commit comments

Comments
 (0)