Skip to content

Commit e461f03

Browse files
authored
Resolve faulty package filter when building for release (Azure#7297)
* originally removed this method due to a 'brilliant simplification' only to realize that kinda missed an essential filter during a build for a release
1 parent 5038f0b commit e461f03

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

eng/pipelines/templates/steps/build-artifacts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ steps:
2222
displayName: 'Generate Python2 Applicable Namespace Packages'
2323
inputs:
2424
scriptPath: 'scripts/devops_tasks/build_packages.py'
25-
arguments: '-d "$(Build.ArtifactStagingDirectory)" "*-nspkg" --service=${{parameters.ServiceDirectory}}'
25+
arguments: '-d "$(Build.ArtifactStagingDirectory)" "${{ parameters.BuildTargetingString }}" --pkgfilter="nspkg" --service=${{parameters.ServiceDirectory}}'
2626

2727
- task: UsePythonVersion@0
2828
displayName: 'Use Python $(PythonVersion)'

scripts/devops_tasks/build_packages.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ def build_packages(targeted_packages, distribution_directory):
6464
),
6565
)
6666

67+
parser.add_argument(
68+
"--pkgfilter",
69+
default="",
70+
dest="package_filter_string",
71+
help=(
72+
"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."
73+
),
74+
)
75+
6776
args = parser.parse_args()
6877

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

77-
targeted_packages = process_glob_string(args.glob_string, target_dir)
86+
targeted_packages = process_glob_string(args.glob_string, target_dir, args.package_filter_string)
7887
build_packages(targeted_packages, args.distribution_directory)

scripts/devops_tasks/common_tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def filter_for_compatibility(package_set):
131131
# this function is where a glob string gets translated to a list of packages
132132
# It is called by both BUILD (package) and TEST. In the future, this function will be the central location
133133
# for handling targeting of release packages
134-
def process_glob_string(glob_string, target_root_dir):
134+
def process_glob_string(glob_string, target_root_dir, additional_contains_filter=""):
135135
if glob_string:
136136
individual_globs = glob_string.split(",")
137137
else:
@@ -145,7 +145,7 @@ def process_glob_string(glob_string, target_root_dir):
145145
collected_top_level_directories.extend([os.path.dirname(p) for p in globbed])
146146

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

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

0 commit comments

Comments
 (0)