From 4bd9276cd6331f479376c26ceefdf64e179b074a Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Mon, 5 Oct 2020 13:22:55 -0700 Subject: [PATCH 1/3] properly build non-dev if triggered --- .../pipelines/templates/steps/daily-dev-build-variable.yml | 2 +- scripts/devops_tasks/build_packages.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/common/pipelines/templates/steps/daily-dev-build-variable.yml b/eng/common/pipelines/templates/steps/daily-dev-build-variable.yml index 2e10f695c998..ddd776d0e58a 100644 --- a/eng/common/pipelines/templates/steps/daily-dev-build-variable.yml +++ b/eng/common/pipelines/templates/steps/daily-dev-build-variable.yml @@ -5,7 +5,7 @@ steps: - pwsh: | $setDailyDevBuild = "false" if (('$(Build.Reason)' -eq 'Schedule') -and ('$(System.TeamProject)' -eq 'internal')) { - $setDailyDevBuild = "true" + $setDailyDevBuild = "True" } echo "##vso[task.setvariable variable=SetDevVersion]$setDailyDevBuild" displayName: "Setup Versioning Properties" diff --git a/scripts/devops_tasks/build_packages.py b/scripts/devops_tasks/build_packages.py index e8bec139ac05..c7463e4b7eed 100644 --- a/scripts/devops_tasks/build_packages.py +++ b/scripts/devops_tasks/build_packages.py @@ -105,4 +105,4 @@ def verify_update_package_requirement(pkg_root): target_dir = root_dir targeted_packages = process_glob_string(args.glob_string, target_dir, args.package_filter_string) - build_packages(targeted_packages, args.distribution_directory, bool(args.is_dev_build)) + build_packages(targeted_packages, args.distribution_directory, args.is_dev_build) From 04952463b5109ecd7fd4d654d6d591a2cdc82e2d Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Mon, 5 Oct 2020 13:29:06 -0700 Subject: [PATCH 2/3] appropriately handle the bool, undo change to common --- .../steps/daily-dev-build-variable.yml | 2 +- scripts/devops_tasks/build_packages.py | 21 +++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/eng/common/pipelines/templates/steps/daily-dev-build-variable.yml b/eng/common/pipelines/templates/steps/daily-dev-build-variable.yml index ddd776d0e58a..2e10f695c998 100644 --- a/eng/common/pipelines/templates/steps/daily-dev-build-variable.yml +++ b/eng/common/pipelines/templates/steps/daily-dev-build-variable.yml @@ -5,7 +5,7 @@ steps: - pwsh: | $setDailyDevBuild = "false" if (('$(Build.Reason)' -eq 'Schedule') -and ('$(System.TeamProject)' -eq 'internal')) { - $setDailyDevBuild = "True" + $setDailyDevBuild = "true" } echo "##vso[task.setvariable variable=SetDevVersion]$setDailyDevBuild" displayName: "Setup Versioning Properties" diff --git a/scripts/devops_tasks/build_packages.py b/scripts/devops_tasks/build_packages.py index c7463e4b7eed..02b438b97ddc 100644 --- a/scripts/devops_tasks/build_packages.py +++ b/scripts/devops_tasks/build_packages.py @@ -22,7 +22,17 @@ sys.path.append(tox_path) from sanitize_setup import process_requires -def build_packages(targeted_packages, distribution_directory, is_dev_build = False): + +def str_to_bool(input_string): + if isinstance(input_string, bool): + return input_string + if input_string.lower() in ("true", "t", "1"): + return True + elif input_string.lower() in ("false", "f", "0"): + return False + + +def build_packages(targeted_packages, distribution_directory, is_dev_build=False): # run the build and distribution for package_root in targeted_packages: print(package_root) @@ -93,7 +103,6 @@ def verify_update_package_requirement(pkg_root): ), ) - args = parser.parse_args() # We need to support both CI builds of everything and individual service @@ -104,5 +113,9 @@ def verify_update_package_requirement(pkg_root): else: target_dir = root_dir - targeted_packages = process_glob_string(args.glob_string, target_dir, args.package_filter_string) - build_packages(targeted_packages, args.distribution_directory, args.is_dev_build) + targeted_packages = process_glob_string( + args.glob_string, target_dir, args.package_filter_string + ) + build_packages( + targeted_packages, args.distribution_directory, str_to_bool(args.is_dev_build) + ) From 8f2131544370afd4ac8c642fd2b890f454299ba7 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Mon, 5 Oct 2020 14:13:55 -0700 Subject: [PATCH 3/3] handle the nit from praveen. good point --- scripts/devops_tasks/build_packages.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/devops_tasks/build_packages.py b/scripts/devops_tasks/build_packages.py index 02b438b97ddc..bc962c29e0a4 100644 --- a/scripts/devops_tasks/build_packages.py +++ b/scripts/devops_tasks/build_packages.py @@ -26,11 +26,12 @@ def str_to_bool(input_string): if isinstance(input_string, bool): return input_string - if input_string.lower() in ("true", "t", "1"): + elif input_string.lower() in ("true", "t", "1"): return True elif input_string.lower() in ("false", "f", "0"): return False - + else: + return False def build_packages(targeted_packages, distribution_directory, is_dev_build=False): # run the build and distribution