Skip to content

Commit 1fa5d29

Browse files
committed
refactor: replace GITHUB_TOKEN with GH_TOKEN in workflow and test files
also should refactor links if clone fails
1 parent 9fd8296 commit 1fa5d29

8 files changed

Lines changed: 9 additions & 12 deletions

packaging_automation/citus_package.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,15 @@ def build_package(
341341
):
342342
docker_image_name = "packaging" if not is_test else "packaging-test"
343343
postgres_extension = "all" if postgres_version == "all" else f"pg{postgres_version}"
344-
os.environ["GITHUB_TOKEN"] = github_token
344+
os.environ["GH_TOKEN"] = github_token
345345
os.environ["CONTAINER_BUILD_RUN_ENABLED"] = "true"
346346
if not os.path.exists(input_output_parameters.output_dir):
347347
os.makedirs(input_output_parameters.output_dir)
348348

349349
docker_command = (
350350
f"docker run --rm -v {input_output_parameters.output_dir}:/packages -v "
351351
f"{input_output_parameters.input_files_dir}:/buildfiles:ro "
352-
f"-e GITHUB_TOKEN -e PACKAGE_ENCRYPTION_KEY -e UNENCRYPTED_PACKAGE -e CONTAINER_BUILD_RUN_ENABLED "
352+
f"-e GH_TOKEN -e PACKAGE_ENCRYPTION_KEY -e UNENCRYPTED_PACKAGE -e CONTAINER_BUILD_RUN_ENABLED "
353353
f"-e MSRUSTUP_PAT -e CRATES_IO_MIRROR_FEED_TOKEN -e INSTALL_RUST -e CI "
354354
f"citus/{docker_image_name}:{docker_platform}-{postgres_extension} {build_type.name}"
355355
)

packaging_automation/common_tool_methods.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,6 @@ def remove_suffix(initial_str: str, suffix: str) -> str:
680680
def initialize_env(exec_path: str, project_name: str, checkout_dir: str):
681681
remove_cloned_code(f"{exec_path}/{checkout_dir}")
682682
if not os.path.exists(checkout_dir):
683-
GH_TOKEN = os.environ.get("GH_TOKEN", "")
684683
run(f"git clone https://github.com/citusdata/{project_name}.git {checkout_dir}")
685684

686685

packaging_automation/tests/test_common_tool_methods.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
str_array_to_str,
4747
)
4848

49-
GITHUB_TOKEN = os.getenv("GH_TOKEN")
49+
GH_TOKEN = os.getenv("GH_TOKEN")
5050
BASE_PATH = pathlib2.Path(__file__).parents[1]
5151
TEST_BASE_PATH = pathlib2.Path(__file__).parent.absolute()
5252
TEST_GPG_KEY_NAME = "Citus Data <packaging@citusdata.com>"
@@ -264,7 +264,7 @@ def test_prepend_line_in_file():
264264

265265
def test_getprs():
266266
# created at is not seen on Github. Should be checked on API result
267-
g = Github(GITHUB_TOKEN)
267+
g = Github(GH_TOKEN)
268268
repository = g.get_repo("citusdata/citus")
269269
prs = get_prs_for_patch_release(
270270
repository,
@@ -277,7 +277,7 @@ def test_getprs():
277277

278278

279279
def test_getprs_with_backlog_label():
280-
g = Github(GITHUB_TOKEN)
280+
g = Github(GH_TOKEN)
281281
repository = g.get_repo("citusdata/citus")
282282
prs = get_prs_for_patch_release(
283283
repository,

packaging_automation/tests/test_prepare_release.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def initialize_env() -> str:
4040
test_base_path_major = f"{BASE_PATH}/{uuid.uuid4()}"
4141
remove_cloned_code(test_base_path_major)
4242
if not os.path.exists(test_base_path_major):
43-
GH_TOKEN = os.getenv("GH_TOKEN", "")
4443
run(f"git clone https://github.com/citusdata/citus.git {test_base_path_major}")
4544
return test_base_path_major
4645

packaging_automation/tests/test_publish_docker.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929

3030
def initialize_env():
3131
if not os.path.exists("docker"):
32-
GH_TOKEN = os.getenv("GH_TOKEN", "")
33-
run(f"git clone https://github.com/citusdata/docker.git")
32+
run("git clone https://github.com/citusdata/docker.git")
3433

3534

3635
def test_decode_triggering_event_info():

packaging_automation/tests/test_update_docker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
def setup_module():
3636
if not os.path.exists("docker"):
37-
run(f"git clone https://github.com/citusdata/docker.git")
37+
run("git clone https://github.com/citusdata/docker.git")
3838

3939

4040
def teardown_module():

packaging_automation/tests/test_update_package_properties.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
TEST_BASE_PATH = pathlib2.Path(__file__).parent.absolute()
2727
BASE_PATH = os.getenv("BASE_PATH", default=pathlib2.Path(__file__).parents[1])
28-
GITHUB_TOKEN = os.getenv("GH_TOKEN")
28+
GH_TOKEN = os.getenv("GH_TOKEN")
2929
PROJECT_VERSION = os.getenv("PROJECT_VERSION", default="10.2.4")
3030
TAG_NAME = os.getenv("TAG_NAME", default="v10.2.4")
3131
PROJECT_NAME = os.getenv("PROJECT_NAME", default="citus")

packaging_automation/tests/test_update_pgxn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
def setup_module():
2020
if not os.path.exists("packaging_test"):
2121
run(
22-
f"git clone --branch pgxn-citus https://github.com/citusdata/packaging.git packaging_test"
22+
"git clone --branch pgxn-citus https://github.com/citusdata/packaging.git packaging_test"
2323
)
2424

2525

0 commit comments

Comments
 (0)