Commit Graph

27 Commits

Author SHA1 Message Date
Ian Wienand 6d23d20f2f linters: add names to blocks
This is preparation for a later version of ansbile-lint, which finds
missing names on blocks.  This seems a reasonable rule, and the
Ansible manual says [1]

  Names for blocks have been available since Ansible 2.3. We recommend
  using names in all tasks, within blocks or elsewhere, for better
  visibility into the tasks being executed when you run the playbook.

This simply adds a name tag for blocks that are missing it.  This
should have no operational change, but allows us to update the linter
in a follow-on change.

[1] https://docs.ansible.com/ansible/latest/user_guide/playbooks_blocks.html

Change-Id: I92ed4616775650aced352bc9088a07e919f1a25f
2022-07-27 17:13:39 +10:00
Ian Wienand f76cfbab11 linters: fix spaces between filters
This fixes a number of places where we do not have spaces between
filters.  I think that this is a reasonable rule for readability (I
also think it probably was enforced, but maybe later versions got
better at detecting it?).

These are detected by a later version of Ansible lint; this change
should have no operational change to any roles but prepares us to
update in a follow-on change.

Change-Id: I07e1a109b87adce86f483d14d7e02fcecb8313d5
2022-07-27 17:13:39 +10:00
Ian Wienand f9e38131a7 emit-job-header: noqa on error ignore
This marks this particular ignore_errors as safe.  Generally I think
the rule is good, in that tasks get marked as failed when using
ignore_errors which is confusing and hard to debug.  But in this case
it's because of missing hostnames
(I8d67d8aa284b6ce9ae012608e8f1b12784ce836b) and not something we can
catch easily.

Change-Id: I9b5d6a85254f689e97bca91951632b4dea60cfde
2022-07-27 17:06:59 +10:00
Vitaliy Lotorev 28796a9a90 emit-job-header: Print username in node information
Knowing username for node is required for jobs running on static nodes.
as static node can have multiple connections with different users
(see [1] and [2]).

[1] https://zuul-ci.org/docs/nodepool/configuration.html#attr-providers.[static].pools.nodes.username
[2] https://review.opendev.org/#/c/659209/

Change-Id: I3c726c40ee024de18e65b7888b73f505232422c2
2020-10-31 22:06:55 +03:00
Ian Wienand 1842495fcb emit-job-header: add inventory hostname
When you're running a multi-node job, it would be nice to see the
inventory hostname in this list, so if you want to say, monitor one of
the nodes, you don't have to guess which is which.

Change-Id: Ibf822d51711c74d963a7287eaeaa9a40ff074e79
2020-07-02 15:59:15 +10:00
Albin Vass d0e2016592 Add loop var policy to ansible-lint
This adds a custom ansible-lint rule at .rules/ZuulJobsNamespaceLoopVar.py
that enforces the loop var policy described at:
https://zuul-ci.org/docs/zuul-jobs/policy.html#ansible-loops-in-roles

It also updates existing roles to follow the policy.

Change-Id: I92b2ff56a1c2702542fc07b316f1809087a4c92f
2020-04-29 17:20:59 +02:00
Sorin Sbarnea 8a5bc42bb9 Improve job and node information banner
Adds information that is can be key regarding the outcome of the job:
* distribution name
* distribution version

Change-Id: I8362ef2f0a89de4c318f13c874b6f083a4f1699f
2020-03-30 10:47:24 +01:00
Zuul cf898b26a1 Merge "Add event id to emit-job-header" 2020-02-07 13:17:33 +00:00
Simon Westphahl dd0fa76cff Add event id to emit-job-header
This can aid in debugging a still running job.

Depends-On: https://review.opendev.org/#/c/706222/
Change-Id: Id6d52185b02447484bfc044b20f14088fbe26634
2020-02-06 13:43:06 +01:00
Clark Boylan b62efba8a4 Add option for object store friendly log paths
For logs stored in object storage services we want to be able to shard
into different containers. This improves scalability of the object
stores. To do this consistently we prefix all log paths with the first 3
characters of the build uuid. This way we get container names like
log_123, log_abc, and so on for a total of 4096 containers.

This behavior is off by default because users of filesystems stores
without a zuul dashboard may still want periodic/ to be filed into a top
level dir for browseability.

Change-Id: I8e72a6e587edcbdf89b793cad2d7c96c535601e7
2019-09-04 09:52:38 -07:00
Paul Belanger ddc33c5dc4 Add trailing slash for log url
Both on logs.o.o and vexxhost swift object-storage, without a trailing
slash, a request will get 301 to new location with trailing slash. By
adding a trailing slash here, and since this is usually a directory, we
can avoid a 301 redirect for browsers.

Note, zuul_return for zuul upload-logs and upload-logs-swift does
include trailing slash.

Change-Id: Ie58f3922680806a5c1865a44bb379ef66e2992fd
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2019-03-30 16:14:49 -04:00
Tristan Cacqueray 7766406431 emit-job-header: fix print node information
This task may be failing when ansible_hostname is not available:
The task includes an option with an undefined variable.
The error was: 'dict object' has no attribute 'ansible_hostname'

Change-Id: I8d67d8aa284b6ce9ae012608e8f1b12784ce836b
2018-09-13 11:33:17 +00:00
Paul Belanger 7cd6fd60c3
Promote test-emit-job-header change
We can remove test-emit-job-header and move our output node info into
emit-job-header now that it has been tested with 2 zuuls.

  http://logs.openstack.org/53/591453/2/check/tox-py35/f9b4f5f/job-output.txt.gz#_2018-08-13_16_27_00_560529
  https://logs.rdoproject.org/15/15415/4/check/tox-docs/2ce861f/job-output.txt.gz#_2018-08-10_15_59_21_231353

Change-Id: Ic7685f2fa9b8dd34a4a46c23ba46e21bc6ab155f
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2018-08-13 12:39:41 -04:00
Paul Belanger 7e69f2f8ea
Fix lint issue with emit-job-header role
This is breaking project-config, and some reason we didn't catch it in
testing.  We should look into why that is.

Change-Id: I994484cdb28297fdff8c52ccf7455733584cd8ae
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2018-03-07 10:20:00 -05:00
Andreas Jaeger 71bc02db76 Fix emit-job-header
This currently fails with "Error 'nodepool' is undefined".

REmove nodepool line completely for now.

Change-Id: I134079a6118c8825fa91920c0f12c2d2789361a5
2018-03-07 11:53:31 +01:00
Monty Taylor 72fe550764 Add Ansible version to job header
As we look towards updating the version of Ansible zuul is running with,
letting people know what version it is would be friendly.

Change-Id: I09cd990af5365a8da3c339eede128166a76b35dd
2018-03-04 23:11:35 +00:00
David Moreau-Simard ce176a5b6f Revert "Revert "Add zuul.{pipeline,nodepool.provider,executor.hostname} to job header""
The nodepool provider variable is not always available, for example
when running only on localhost, so default it to "N/A".

Additionally, we don't want these tasks to run multiple times if we
are running a multi-node job so use "run_once: yes" to prevent
printing the header more than once.

This reverts commit 27755ba83f.

Depends-On: Ia79a793200fcb89161783ff641b85106936084b5
Change-Id: Id9117935d9c53268ea893796154af03db21ee3a7
2018-03-04 23:11:19 +00:00
Andreas Jaeger 0506323c2b Ansible linting fixes
Fix a few problems noticed when using this in project-config:
* Ignore apt-get warning in configure-mirrors
* All tasks should be named in upload-logs, emit-job-header
* use git_config in mirror-workspace-git-repos
* Ignore git warnings in mirror-workspace-git-repos

Change-Id: Ibcdc8d5a42fb081b5faa0cc89460e4cf88d369ba
2017-10-27 19:18:15 +02:00
Mohammed Naser 27755ba83f Revert "Add zuul.{pipeline,nodepool.provider,executor.hostname} to job header"
This reverts commit cb8c554f6e.

Change-Id: I8ef6c6778201b75e198c9a120242690573c320c6
2017-10-23 23:18:32 +00:00
David Moreau-Simard cb8c554f6e Add zuul.{pipeline,nodepool.provider,executor.hostname} to job header
These are helpful to understand the context of a running job before
logs are collected and made available.

Change-Id: I33f3f425a8008534c617422a7f77255a34f86198
Depends-On: I8d014464b3ed580d4a0fc6dbdc9a42601ff107e5
2017-10-20 20:47:59 +00:00
James E. Blair dcd89b2686 Revert "Fix linting issues found via project-config"
This has syntax errors.

This reverts commit d3128dab95.

Change-Id: Ida6569d384f50095cc228625c7d6e73e154270ae
2017-09-14 13:10:22 -06:00
Jesse Keating d3128dab95 Fix linting issues found via project-config
There are no playbooks that use the roles in this repo in a way that
would lint them, however running linters in project-config found
numerous issues in these roles. Correct the roles.

Change-Id: I017532c8aed8fd90474052423c7ba2510cf84631
Signed-off-by: Jesse Keating <omgjlk@us.ibm.com>
2017-09-13 14:56:59 -06:00
Monty Taylor 0128c488e5
Remove extra quotation mark
Change-Id: I3d496cc4990cdacaca8e28c23bc126b9c9779edd
2017-09-10 12:27:23 -06:00
Monty Taylor ed7a359f67
Fix typo - the word is "available"
Change-Id: Ic8327c9949c2a98dc0e96c3b3d177bb9aa8dc209
2017-09-10 08:37:37 -06:00
Monty Taylor 00e673c36b
Rename log_path and generate-log-url
Make log_path zuul_log_path because log_path is rather generic.

Rename generate-log-url to set-zuul-log-path-fact to make it
clearer what it does.

Change-Id: I91ae1e396b3ef04939edebaeea8e5b16cc50315a
2017-09-09 16:49:51 -06:00
Monty Taylor 4a21194da7
Add zuul_log_url to emit-job-header
Just the log path without the url ... not so useful.

Change-Id: Ifdfa44e4e7742470631e31a8fd8fb93852d24c47
2017-09-09 16:36:58 -06:00
Monty Taylor 0d26a2544c
Add a role to emit an informative header for logs
It contains the URL of the change being tested as well as the location
the logs are going to be found in.

Change-Id: I28bcd1c004bc399d3404e3c6a1f44fdfe98cf97d
2017-09-07 15:34:25 -05:00