zuul-jobs/test-playbooks/base-roles/emit-job-header.yaml
Tristan Cacqueray 2f7ffba18d Update the set-zuul-log-path-fact scheme to prevent huge url
This change simplifies the path creation logic to avoid processing
user defined variables such as job name and pipeline name, which
might cause the log url to exceed the database storage presently
fixed at 255 char.

Add warning in the job's header when the url is over 255 characters,
explaining that Zuul won't report the job properly in its database;
but the job can still run.

Change-Id: I34fb5662a2f958c55f60458ce107bad2a73b9c96
2025-03-19 18:34:58 +00:00

22 lines
980 B
YAML

# Note that the order of these two plays is important. We want the second one
# to run to be the one the creates the correct log path for the currently
# running system.
- name: Test the emit-job-header role
hosts: all
roles:
- role: emit-job-header
zuul_log_url: "http://logs.openstack.org"
post_tasks:
# All emit-job-header does is a debug statement so the worst that would
# happen would be that the debug task would fail outright and we'd prevent
# something breaking that debug statement from merging just by running it.
# However, the emit-job-header role includes the set-zuul-log-path-fact
# role. We can only test for zuul_log_path against changes, though.
- name: Assert zuul_log_path by set-zuul-log-path-fact for a change
assert:
that:
- zuul_log_path is defined
- zuul.tenant in zuul_log_path
- zuul.build == zuul_log_path[-32:]
- zuul.build[:3] + '/' == zuul_log_path[:4]