Skip to content

Commit 8679135

Browse files
committed
files-inventory: check the iot-agent deb package too
Generalize the check task over a small product list and add the iot-agent deb (amd64/arm64), reusing the existing agent_deb_{arch}-style gate naming (iot_agent_deb_{arch}, matching test/static/static_quality_gates.yml). Skip armhf explicitly: Bazel doesn't cross-compile for it yet, and the existing arch-detection would have silently mis-tagged an armhf artifact as amd64. Add iot-agent-x64 to files_inventory_check's needs so its deb is actually present in OMNIBUS_PACKAGE_DIR when the check runs.
1 parent 45a4ab9 commit 8679135

2 files changed

Lines changed: 42 additions & 28 deletions

File tree

.gitlab/test/functional_test/files_inventory_check.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ files_inventory_check:
1313
GIT_STRATEGY: clone
1414
needs:
1515
- agent_deb-x64-a7
16+
- iot_agent_deb-x64
1617
before_script:
1718
- !reference [.setup_github_token_comment_pr]
1819
script:

tasks/files_inventory.py

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -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
166175
def 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

Comments
 (0)