Skip to content
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

Resolve faulty package filter when building for release #7297

Merged
merged 2 commits into from
Sep 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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