-
Notifications
You must be signed in to change notification settings - Fork 14
Adds support for onebranch changes #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9cf8170
6bc4b76
a37166b
014bd55
b61e9f4
a8ff3b8
acf5f4b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -232,13 +232,14 @@ def build_package(github_token: non_empty(non_blank(str)), | |
| docker_image_name = "packaging" if not is_test else "packaging-test" | ||
| postgres_extension = "all" if postgres_version == "all" else f"pg{postgres_version}" | ||
| os.environ["GITHUB_TOKEN"] = github_token | ||
| os.environ["CONTAINER_BUILD_RUN_ENABLED"] = "true" | ||
| if not os.path.exists(input_output_parameters.output_dir): | ||
| os.makedirs(input_output_parameters.output_dir) | ||
|
|
||
| output = run_with_output( | ||
| f'docker run --rm -v {input_output_parameters.output_dir}:/packages -v ' | ||
| f'{input_output_parameters.input_files_dir}:/buildfiles:ro -e ' | ||
| f'GITHUB_TOKEN -e PACKAGE_ENCRYPTION_KEY -e UNENCRYPTED_PACKAGE ' | ||
| f'GITHUB_TOKEN -e PACKAGE_ENCRYPTION_KEY -e UNENCRYPTED_PACKAGE -e CONTAINER_BUILD_RUN_ENABLED ' | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Parameter is added and set true to be able to execute build logic in fetch_and_build_deb/rpm scripts |
||
| f'citus/{docker_image_name}:{docker_platform}-{postgres_extension} {build_type.name}', text=True) | ||
|
|
||
| if output.stdout: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ GitPython | |
| Jinja2 | ||
| parameters_validation | ||
| pathlib2 | ||
| psycopg2 | ||
| psycopg2-binary | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since out github actions main VM image is ubuntu focal, just majing this script work in ubuntu was enough |
||
| pycurl | ||
| PyGithub | ||
| pytest | ||
|
|
@@ -16,3 +16,4 @@ urllib3 | |
| wheel | ||
| python-dotenv | ||
| prospector[with_everything] | ||
| setuptools==58 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| # | ||
| # This file is autogenerated by pip-compile | ||
| # This file is autogenerated by pip-compile with python 3.8 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit, Consider introducing a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| # To update, run: | ||
| # | ||
| # pip-compile | ||
|
|
@@ -81,7 +81,7 @@ pluggy==0.13.1 | |
| # via pytest | ||
| prospector[with_everything]==1.5.0.1 | ||
| # via -r requirements.in | ||
| psycopg2==2.9.1 | ||
| psycopg2-binary==2.9.3 | ||
| # via -r requirements.in | ||
| py==1.10.0 | ||
| # via pytest | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,7 +53,7 @@ def get_filtered_package_count(session) -> int: | |
| # Since package count for our test repo is lower than 100, we get the total package details by getting all the | ||
| # packages in one call | ||
| result = stat_get_request( | ||
| package_list_with_pagination_request_address(PACKAGE_CLOUD_PARAMETERS, 1, 100), | ||
| package_list_with_pagination_request_address(PACKAGE_CLOUD_PARAMETERS, 1, 200), | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Recently, I added new files into azure repository in packagecloud so this broke my tests. I increased the number for records in page to be able to get correct result
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did we need to update this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Recently I put new packages into azure repo which exceeds 100 package . I'm using azure repo as my test repo to test the package counts. After exceed, my tests failed since some packages was outside the pagination limit. |
||
| RequestType.package_cloud_list_package, session) | ||
| package_info_list = json.loads(result.content) | ||
| package_list = list(filter( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import argparse | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In Github Actions, we validate package counts in citus_package.py without dependency for images. Since we can not execute citus_package, we needed to externalize validation logic for OneBranch build process. We call this function explicitly after fetch_and_build_deb/rpm script |
||
|
|
||
| from .packaging_warning_handler import (validate_output) | ||
| from .common_tool_methods import (PackageType) | ||
| from pathlib import Path | ||
|
|
||
| if __name__ == "__main__": | ||
| parser = argparse.ArgumentParser() | ||
| parser.add_argument('--output_file', required=True) | ||
| parser.add_argument('--ignore_file', required=True) | ||
| parser.add_argument('--package_type', choices=[p.name for p in PackageType], required=True) | ||
|
|
||
| args = parser.parse_args() | ||
| build_output = Path(args.output_file).read_text() | ||
| validate_output(build_output, args.ignore_file, PackageType[args.package_type]) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import argparse | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created because the same reason with validate_buildo_output. We execute this script just before fetch_and_build_deb/rpm to be able to get supported postgres versions |
||
|
|
||
| from .citus_package import (write_postgres_versions_into_file) | ||
|
|
||
| if __name__ == "__main__": | ||
| parser = argparse.ArgumentParser() | ||
| parser.add_argument('--project_version', required=True) | ||
| parser.add_argument('--input_files_dir', required=True) | ||
|
|
||
| args = parser.parse_args() | ||
| write_postgres_versions_into_file(args.input_files_dir,args.project_version) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parameter is required to execute the packaging image in OneBranch.
Currently packaging images directly execute fetch_build_deb script and exits. However, OneBranch first needs to download and initialize then execute the pipeline scripts inside the container
This parameter is a switch to use the packaging images both in github actions and OneBranch pipelines
If this parameter is not set, so in OneBranch container initialisation phase, image does not exit just waits
If this is set, then the script executes as regular.