Skip to content

Commit

Permalink
nightly_version_assignment reference error when nightlypg param is mi…
Browse files Browse the repository at this point in the history
…ssing in pkgvars (#157)
  • Loading branch information
gurkanindibay authored Aug 23, 2021
1 parent 3db48fc commit 92ae18b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
36 changes: 12 additions & 24 deletions packaging_automation/citus_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
from enum import Enum
from typing import List
from typing import Tuple
import gnupg
import docker

import docker
import gnupg
from dotenv import dotenv_values
from parameters_validation import non_blank, non_empty, validate_parameters

from .common_tool_methods import (run_with_output, PackageType, transform_key_into_base64_str,
Expand Down Expand Up @@ -160,32 +161,19 @@ def sign_packages(base_output_path: str, sub_folder: str, secret_key: str, passp


def get_postgres_versions(os_name: str, input_files_dir: str) -> Tuple[List[str], List[str]]:
release_versions = []
nightly_versions = []
if platform_postgres_version_source[os_name] == PostgresVersionDockerImageType.single:
release_versions = ["all"]
nightly_versions = ["all"]
else:
with open(f"{input_files_dir}/pkgvars", "r") as reader:
content = reader.read()
lines = content.splitlines()
for line in lines:
if line.startswith("releasepg"):
release_version_assignment = line
if line.startswith("nightlypg"):
nightly_version_assignment = line
if release_version_assignment is None or "=" not in release_version_assignment or len(
release_version_assignment.split("=")) != 2:
raise ValueError(
f"Release version in pkglatest is not well formatted. Expected format: releasepg=12,13 "
f"Actual Format:{release_version_assignment}")
if nightly_version_assignment is None or "=" not in nightly_version_assignment or len(
nightly_version_assignment.split("=")) != 2:
raise ValueError(
f"Nightly version in pkglatest is not well formatted. Expected format: nightlypg=12,13 "
f"Actual Format:{nightly_version_assignment}")
release_versions = release_version_assignment.split("=")[1].split(",")
nightly_versions = nightly_version_assignment.split("=")[1].split(",")
pkgvars_config = dotenv_values(f"{input_files_dir}/{PKGVARS_FILE}")
release_versions_str = pkgvars_config['releasepg']
if "nightlypg" in pkgvars_config:
nightly_versions_str = pkgvars_config['nightlypg']
else:
nightly_versions_str = release_versions_str

release_versions = release_versions_str.split(",")
nightly_versions = nightly_versions_str.split(",")
return release_versions, nightly_versions


Expand Down
2 changes: 1 addition & 1 deletion packaging_automation/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ requests
SQLAlchemy
urllib3
wheel

python-dotenv
4 changes: 3 additions & 1 deletion packaging_automation/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with python 3.8
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile
Expand Down Expand Up @@ -56,6 +56,8 @@ pyparsing==2.4.7
# via packaging
pytest==6.2.4
# via -r requirements.in
python-dotenv==0.19.0
# via -r requirements.in
python-gnupg==0.4.7
# via -r requirements.in
python-string-utils==1.0.0
Expand Down

0 comments on commit 92ae18b

Please sign in to comment.