Skip to content

Commit

Permalink
Resolve faulty package filter when building for release (Azure#7297)
Browse files Browse the repository at this point in the history
* originally removed this method due to a 'brilliant simplification' only to realize that kinda missed an essential filter during a build for a release
  • Loading branch information
scbedd authored and yijxie committed Oct 9, 2019
1 parent 3af12ec commit f9ae170
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion eng/pipelines/templates/steps/build-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ steps:
displayName: 'Generate Python2 Applicable Namespace Packages'
inputs:
scriptPath: 'scripts/devops_tasks/build_packages.py'
arguments: '-d "$(Build.ArtifactStagingDirectory)" "*-nspkg" --service=${{parameters.ServiceDirectory}}'
arguments: '-d "$(Build.ArtifactStagingDirectory)" "${{ parameters.BuildTargetingString }}" --pkgfilter="nspkg" --service=${{parameters.ServiceDirectory}}'

- task: UsePythonVersion@0
displayName: 'Use Python $(PythonVersion)'
Expand Down
11 changes: 10 additions & 1 deletion scripts/devops_tasks/build_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ def build_packages(targeted_packages, distribution_directory):
),
)

parser.add_argument(
"--pkgfilter",
default="",
dest="package_filter_string",
help=(
"An additional string used to filter the set of artifacts by a simple CONTAINS clause. This filters packages AFTER the set is built with compatibility and omission lists accounted."
),
)

args = parser.parse_args()

# We need to support both CI builds of everything and individual service
Expand All @@ -74,5 +83,5 @@ def build_packages(targeted_packages, distribution_directory):
else:
target_dir = root_dir

targeted_packages = process_glob_string(args.glob_string, target_dir)
targeted_packages = process_glob_string(args.glob_string, target_dir, args.package_filter_string)
build_packages(targeted_packages, args.distribution_directory)
4 changes: 2 additions & 2 deletions scripts/devops_tasks/common_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def filter_for_compatibility(package_set):
# this function is where a glob string gets translated to a list of packages
# It is called by both BUILD (package) and TEST. In the future, this function will be the central location
# for handling targeting of release packages
def process_glob_string(glob_string, target_root_dir):
def process_glob_string(glob_string, target_root_dir, additional_contains_filter=""):
if glob_string:
individual_globs = glob_string.split(",")
else:
Expand All @@ -145,7 +145,7 @@ def process_glob_string(glob_string, target_root_dir):
collected_top_level_directories.extend([os.path.dirname(p) for p in globbed])

# dedup, in case we have double coverage from the glob strings. Example: "azure-mgmt-keyvault,azure-mgmt-*"
collected_directories = list(set(collected_top_level_directories))
collected_directories = list(set([p for p in collected_top_level_directories if additional_contains_filter in p]))

# if we have individually queued this specific package, it's obvious that we want to build it specifically
# in this case, do not honor the omission list
Expand Down

0 comments on commit f9ae170

Please sign in to comment.