@@ -162,40 +162,53 @@ def _filter_files(path: str) -> bool:
162162 ]
163163
164164
165+ # Each entry maps {reports_folder}/{package_prefix}*.deb to a
166+ # static_quality_gate_{gate_prefix}_deb_{arch} gate (see test/static/static_quality_gates.yml).
167+ _PRODUCTS = [
168+ {'package_prefix' : 'datadog-agent' , 'gate_prefix' : 'agent' },
169+ # armhf isn't cross-compiled by Bazel yet, so it's skipped below.
170+ {'package_prefix' : 'datadog-iot-agent' , 'gate_prefix' : 'iot_agent' },
171+ ]
172+
173+
165174@task
166175def check (ctx , branch_name , reports_folder ):
167176 parent_sha = get_ancestor (ctx , branch_name )
168177 pr_comment = f"File checks results against ancestor [{ parent_sha [:8 ]} ](https://github.com/DataDog/datadog-agent/commit/{ parent_sha } ):\n \n "
169178
170- for artifact in glob .glob (f'{ reports_folder } /datadog-agent*.deb' ):
171- # deb pattern is $packagename_$version
172- if '-dbg-' in artifact or '-dbg_' in artifact :
173- continue
174- pr_comment += f'### Results for { os .path .basename (artifact )} :\n '
175- arch = "amd64"
176- if 'aarch64' in artifact or 'arm64' in artifact :
177- arch = "arm64"
178- gate_short_name = f'agent_deb_{ arch } '
179- report_filename = f'{ gate_short_name } _{ arch } _size_report_{ os .environ ["CI_COMMIT_SHORT_SHA" ]} .yml'
180- _measure_package_local (
181- ctx = ctx ,
182- package_path = artifact ,
183- gate_name = f'static_quality_gate_{ gate_short_name } ' ,
184- output_path = report_filename ,
185- build_job_name = os .environ ['CI_JOB_NAME' ],
186- debug = True ,
187- filter = _filter_files ,
188- )
189- # Upload the report to S3
190- bucket_base_path = "s3://dd-ci-artefacts-build-stable/datadog-agent/static_quality_gates/GATE_REPORTS/"
191- ctx .run (
192- f'aws s3 cp --only-show-errors --region us-east-1 --sse AES256 { report_filename } { bucket_base_path } /{ report_filename } '
193- )
179+ for product in _PRODUCTS :
180+ for artifact in glob .glob (f'{ reports_folder } /{ product ["package_prefix" ]} *.deb' ):
181+ # deb pattern is $packagename_$version
182+ if '-dbg-' in artifact or '-dbg_' in artifact :
183+ continue
184+ # armhf cross-compilation isn't wired up for these checks yet.
185+ if 'armhf' in artifact :
186+ continue
187+ pr_comment += f'### Results for { os .path .basename (artifact )} :\n '
188+ arch = "amd64"
189+ if 'aarch64' in artifact or 'arm64' in artifact :
190+ arch = "arm64"
191+ gate_short_name = f'{ product ["gate_prefix" ]} _deb_{ arch } '
192+ report_filename = f'{ gate_short_name } _{ arch } _size_report_{ os .environ ["CI_COMMIT_SHORT_SHA" ]} .yml'
193+ _measure_package_local (
194+ ctx = ctx ,
195+ package_path = artifact ,
196+ gate_name = f'static_quality_gate_{ gate_short_name } ' ,
197+ output_path = report_filename ,
198+ build_job_name = os .environ ['CI_JOB_NAME' ],
199+ debug = True ,
200+ filter = _filter_files ,
201+ )
202+ # Upload the report to S3
203+ bucket_base_path = "s3://dd-ci-artefacts-build-stable/datadog-agent/static_quality_gates/GATE_REPORTS/"
204+ ctx .run (
205+ f'aws s3 cp --only-show-errors --region us-east-1 --sse AES256 { report_filename } { bucket_base_path } /{ report_filename } '
206+ )
194207
195- parent_report_file = tempfile .NamedTemporaryFile ()
196- _get_parent_report (ctx , parent_sha , gate_short_name , parent_report_file .file .name )
197- body = compare_inventories (ctx , parent_report_file .file .name , report_filename )
198- pr_comment += body
208+ parent_report_file = tempfile .NamedTemporaryFile ()
209+ _get_parent_report (ctx , parent_sha , gate_short_name , parent_report_file .file .name )
210+ body = compare_inventories (ctx , parent_report_file .file .name , report_filename )
211+ pr_comment += body
199212
200213 github = GithubAPI ()
201214 prs = list (github .get_pr_for_branch (branch_name ))
0 commit comments