164 Commits

Author SHA1 Message Date
Sorin Sbarnea
0eaa5cf59a Upgrade ansible-lint to 5.0
- bumps ansible-lint to 5.0
- updates our custom rules to make them compatible with 5.0
- replace custom module mocking with native ansible-lint ones
- remove custom call of ansible-playbook --syntax-check as now this
  is done by ansible-lint
- assured molecule vars are hosted under a vars/ folder in order to
  avoid confusing linter detection.
- replaced custom rule for loop var names in role as now this this an
  optional core feature of the linter (see config)
- replaced custom rule no-same-owner with opt-in one (see config)

Change-Id: I233fae8c9036d295968a97ee80e07fde8846c633
2021-03-17 15:44:43 +00:00
Tristan Cacqueray
68409bc81f ensure-zookeeper: add use_tls role var
This change adds a new attribute to setup zookeeper TLS.

It also adds support for Debian-derived distros.

Change-Id: Ifb5fc51f3b66be0b2dd1b8003507e21d8afe16fc
2021-02-17 16:06:36 -08:00
Sorin Sbarnea
762ce6e96e update-json-file: avoid failure when destination does not exists
It is perfectly valid to want to add a value to a file that
does not exist yet, even the path may be missing.

This fixes last night regression when installing docker no longer
creates the /etc/docker folder, causing our MTU update to fail.

Change-Id: I0f037d1d6664de3c3b777aaf6da9cd7c3e8bb15f
Reference: https://review.rdoproject.org/zuul/builds?job_name=tox-py36-ci-config&project=rdo-infra/ci-config
2021-02-12 13:26:49 +00:00
Albin Vass
49b06e31de Enable installing nimble siblings
Change-Id: I58f7b3038bd8239d5f04f66a18aad56ec77dad7d
2020-12-07 15:23:27 +01:00
Paul Belanger
b3ca356c76 Refresh intermediate TLS certs for testing
Lets use 10 years for testing.

Change-Id: Iba2fdb50df8c405fc42d9f7b2433480db70bb0d3
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2020-11-24 11:39:17 -05:00
Paul Belanger
777230be59 Create upload-container-image role
This new role will be used to replace our upload-docker-image role in
the future.

Change-Id: I0e2b0cca6575255520aa6d4d48a12128ab5f46cc
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2020-11-13 15:04:27 -05:00
Albin Vass
b209381be0 Add nimble roles and job
Installs nim toolchains using choosenim (similar to rustup),
installs dependencies and builds nim projects using
the package manager nimble.

See:
https://nim-lang.org/
https://github.com/nim-lang/nimble
https://github.com/dom96/choosenim

Change-Id: I95e7e02eb975200aed7680880b945261888de5ca
2020-11-08 09:36:05 +01:00
Ian Wienand
6f43acde41 fetch-sphinx-tarball: don't run merge-output-to-logs
The merge-output-to-logs role is not doing anything in this test.  As
described inline, this merges files in
zuul.executor.work_root/<docs,artifacts> into the
zuul.executor.log_root directory so they are available in change
results.

Since this job doesn't publish anything there, this role is unused.

merge-output-to-logs currently can't run because it tries to run shell
scripts on the executor.  Thus we can remove this unused role and
restore the job.

Change-Id: I1afc905aa8d9c420bed316e99760ad7ad1d838ce
2020-10-15 14:44:03 +11:00
Ian Wienand
be12793c20 fetch-sphinx-tarball: explain what is happening
This documents the steps in the fetch-sphinx-tarball test to explain
what is happening.

Change-Id: I91d03beeb15395cf4f243988434112ae250b1742
2020-10-15 13:34:49 +11:00
Ian Wienand
664d068ef7 ensure-docker: < 1500 MTU workaround
As described inline, we should lower the MTU in the docker
configuration when we see the interface has a MTU lower than 1500 so
things "just work".  This particularly affects the Linaro ARM64 cloud
in OpenDev, but it is a generic issue.

Change-Id: I338616c41a65b007d56648fdab6da2a6a6b909f4
Story: https://storyboard.openstack.org/#!/story/2008230
2020-10-06 11:26:15 +00:00
Sorin Sbarnea
a1742afb60 ensure-docker: validate network connectivity
Verifies that installed docker can download and run containers
that need network access. This should prevent bugs where
service was installed but in a broken state.

Fixes bug which failed to run tests when tests were modified.

Change-Id: I309168719fd3cb7488bc2d0f4fec7785e1eb5d53
Story: https://storyboard.openstack.org/#!/story/2008215
2020-10-06 15:42:28 +11:00
Zuul
e59b68d909 Merge "update-json-file: add role to combine values into a .json" 2020-10-05 06:43:23 +00:00
Ian Wienand
0b9fad9583 update-json-file: add role to combine values into a .json
Ansible doens't really have a great built-in way to modify a json file
(unlike ini files).  The extant docker role does what seems to be the
usual standard, which is slurp in the file, parse it and then write it
back out.

In a follow-on change (I338616c41a65b007d56648fdab6da2a6a6b909f4) we
need to set some more values in the docker configuration .json file,
which made me think it's generic enough that we can have a role to
basically run read the file, |combine and write it back out.

This adds such a role with various options, and converts the existing
json configuration update in ensure-docker to use it.

Change-Id: I155a409945e0175249cf2dc630b839c7a97fb452
2020-10-05 15:18:58 +11:00
Andrii Ostapenko
ef47a743b6
Add ability to use *-docker-image roles in periodic jobs
Use '{{ zuul.pipeline }}' tag prefix in *-docker-image instead of
'change_{{ zuul.change }}' one when zuul.change is not provided, that is
the case with periodic jobs. This allows to build, upload and promote images
using periodic jobs e.g:

- project:
    periodic:
      - project-buildset-registry

      - project-build-image1:
          dependencies:
            - name: project-buildset-registry
      - project-build-image2:
          dependencies:
            - name: project-buildset-registry

      # pulls from buildset registry and tests both images
      - project-test:
          dependencies:
            - name: project-build-image1
            - name: project-build-image2

      # pre-pulls images from buildset registry for fast build
      - project-upload-image1:
          dependencies:
            - name: project-test
      - project-upload-image2:
          dependencies:
            - name: project-test

      - project-promote:
          dependencies:
            - name: project-upload-image1
            - name: project-upload-image2

This fuctionality will allow to keep latest images up to date for the
case when image incorporates continuously updating code from multiple
repositories.

Using true ternary for tag evaluation because ternary filter requires
all passed to it variables be defined or defaulted [0].

[0] https://github.com/ansible/ansible/issues/51276

Change-Id: I8eb7d2baa24905e7aac51fce0b2f9b1f24f037f9
Signed-off-by: Andrii Ostapenko <andrii.ostapenko@att.com>
2020-09-25 14:22:17 -05:00
Tristan Cacqueray
a086fb4333 ensure-zookeeper: add role to setup zookeeper
This role is lifted from https://src.fedoraproject.org/rpms/zuul/blob/master/f/tests/setup_zookeeper.yml

Co-Authored-By: Fabien Boucher <fboucher@redhat.com>
Change-Id: Iec21d12baddf3de580d1941adade107c7e24fdd9
2020-09-24 23:29:59 +00:00
Ian Wienand
4d2c441f40 ensure-kubernetes: workaround slow account creation
Per the referenced link, account creation can be slow and that's just
the way it is.  This should help tests that fail with

  Error from server (Forbidden): error when creating "test-pod.yaml":
  pods "test" is forbidden: error looking up service account
  default/default: serviceaccount "default" not found

Change-Id: I405aa7e58737c7061a471da2e2807c77756c76b8
2020-09-17 13:04:54 +10:00
Ian Wienand
048aff6c98 Add ensure-rust role
Add a role to install Rust via the rustup tool.  It defaults to
installing globally, which avoids having to worry too much about
setting paths for follow-on jobs.

Packaged Rust and the upstream rustup install tool can live together,
and there's various documentation about it.  Thus I've made this such
that we can expand it with packaged Rust support if there is a need,
but I have not implemented that yet.

Change-Id: I32f9b285904a7036f9a80ada8a49fa9cf31b5163
2020-08-25 09:04:43 +10:00
Ian Wienand
620c95e4a3 Add focal testing
Add focal testing for automatically generated jobs.

Seems only one minor quoting change for ovs is required.

Change-Id: I5de5d5bd420092729de251d6bfcfe80b8af79f1a
2020-08-18 15:35:02 +10:00
Clark Boylan
44d2187e7f Disable base role testing that runs code on localhost
The workspace setup role requires local code execution on the executor.
This is not allowed from an untrusted context so we disable it.

The previous assertions about the zuul-cloner setup depend on the
workspace setup running successfully. Disable those extra assertions.

subunit fetching role assertions grepped the html file for validity on
localhost. Disable this as well.

Change-Id: I7449749f50b6e4a34c4615b00836a7148e01c768
2020-07-22 15:32:18 -07:00
Albin Vass
838b0c8877 Add upload-logs-s3
Change-Id: I6ce64734ed5f20a212e6cb953d09ea2769238bea
2020-07-19 21:22:36 +02:00
Albin Vass
c388e61160 Remove default tox_envlist: venv
Setting tox_envlist to venv by default is unintuitive for
many users. Remove this behaviour and let default tox
behaviour be the same as running tox on the commandline.

Change-Id: I1b6d59ee4ebb7f6b3adcf4bd35d7148e83389008
2020-07-16 21:59:57 +02:00
Zuul
3b8470b4a7 Merge "Allow deleting workspace after running terraform destroy" 2020-07-07 16:29:38 +00:00
Albin Vass
06e35b2125 Test multiarch release builds and use temp registry with buildx
When using docker buildx to build a container image, use a temporary
registry to receive the built image instead of requiring a buildset
registry.

A multi-arch test is also added with a publication registry
using the same task list to reduce duplication.

Change-Id: Ib20d1c97f6cb63e0ff9d8888ea792d1941cd8690
Co-Authored-By: James E. Blair <jeblair@redhat.com>
2020-07-01 10:29:31 -07:00
Albin Vass
7ef4d9f3f5 Allow deleting workspace after running terraform destroy
Also fixes a bug where the workspace was created from the wrong directory.

Change-Id: I28b54b9aa57a3f449254574956701ee663618e8b
2020-07-01 13:25:39 +02:00
Zuul
05303ec7b2 Merge "Add tests for upload-docker-image" 2020-06-22 15:55:31 +00:00
Albin Vass
0f55195335 Add tests for upload-docker-image
This also adds support for using a self hosted registry
with the docker roles.

Change-Id: I43caf46cfcc5d335ce14d72ad2abbef732b24645
2020-06-22 06:55:11 -07:00
Zuul
9eaa98cd24 Merge "Add linting rule to enforce no-same-owner policy" 2020-06-18 21:37:06 +00:00
Zuul
1a8d5ca838 Merge "Partial revert "Ensure wheel exists for build-release-python"; move to ensure-pip" 2020-06-18 14:12:08 +00:00
Ian Wienand
67f223b53a Partial revert "Ensure wheel exists for build-release-python"; move to ensure-pip
This partially reverts commit
3f961ce202d7d24e2944de09636b35cec9c13bf6.

This alternative installs wheel with the ensure-pip role instead of in
a separate role.  wheel is very closely linked with pip install
operations so this isn't a large overreach of the role.

I suggest this for several reasons; firstly the python-wheel role
doesn't try to install packages, so we end up with mixed system pip
and upstream versions of wheel most of the time.  This is the type of
thing that has proven problematic in the past.  It also installs via
pip --user; something we've already had problems with tox when for
various reasons roles want to run this as non-zuul user.  Using
ensure-pip we keep the packaged versions together.

[1] did try to install wheel with root, but during runtime which
didn't work due to sudo being revoked.  This should work for the
existing build-python-release job, because it already includes
ensure-pip in pre-run via playbooks/python/pre.yaml

I believe our conclusion on the ensure-* roles was that requiring
root/become: for installation is OK, but we should have a no-op path
if the tools are found.  This is consistent with that approach
(i.e. if you want wheel and can't do sudo, you should pre-install it
on your image using whatever you build that with).

This adds a check to the existing "is pip installed" check to also
check if wheel packages are available.  If not we trigger the install
path.

This revealed some issues with RedHat.yaml -- we can always install
Python 3 (packages available for CentOS 7) so remove that check, and
if Ansible is running under Python 2; ensure we install the
dependencies too (not only if it is forced).

Update the documentation to describe that it will enable support for
bdist_wheel, and add a basic sanity test that wheels are produced by
pip.  The existing build-python-release job is kept; although it is
modified to use the playbooks/python/pre.yaml playbook as the build
job does.

Change-Id: I2ab11bb45b6b2a49d54db39195228ab40141185c
[1] https://review.opendev.org/#/c/736001/5/roles/build-python-release/tasks/main.yaml
2020-06-18 12:51:56 +00:00
Albin Vass
3d4f3a3a28 Add linting rule to enforce no-same-owner policy
Change-Id: I92c66a21be95935d11fc8e9887d9d91c645d28d4
2020-06-18 11:06:45 +02:00
Zuul
8fe78addbf Merge "Fix ansible-lint rules tests" 2020-06-18 06:11:45 +00:00
Albin Vass
aeca4e34e3 Fix ansible-lint rules tests
ansible-lint does not work when given an empty (/dev/null) config file.

Traceback (most recent call last):
  File "/tmp/ansible.td6htcac/bin/ansible-lint", line 8, in <module>
    sys.exit(main())
  File "/tmp/ansible.td6htcac/lib/python3.6/site-packages/ansiblelint/__main__.py", line 42, in main
    options = cli.get_config(sys.argv[1:])
  File "/tmp/ansible.td6htcac/lib/python3.6/site-packages/ansiblelint/cli.py", line 208, in get_config
    config = load_config(options.config_file)
  File "/tmp/ansible.td6htcac/lib/python3.6/site-packages/ansiblelint/cli.py", line 77, in load_config
    expand_to_normalized_paths(config, config_dir)
  File "/tmp/ansible.td6htcac/lib/python3.6/site-packages/ansiblelint/cli.py", line 40, in expand_to_normalized_paths
    if paths_var not in config:
TypeError: argument of type 'NoneType' is not iterable

Change-Id: Id2a883676c9fbb3a2c704c8cbd8f3cbc28cdc5fb
2020-06-18 00:12:55 +02:00
Monty Taylor
06ad3eef8a Add option to install tox into a path location
We can't do this all the time, because of rootless environments.
But sometimes people have root and want to be able to use something
from scripts from normal path.

Change-Id: I3f57a6108f8f53ebfdd12f04ecb3d8c68c5b4a60
2020-06-17 16:31:07 -05:00
Zuul
08420e0827 Merge "Terraform roles and jobs." 2020-06-16 09:48:11 +00:00
James E. Blair
c713ed7a55 Add test-build-container-image-release job
Add a job that tests the build-container-image role as it would be
used in a tag-based release pipeline (as opposed to check or
gate+promote).

Also, correct an issue in the role where we assumed zuul.change
existed.

Change-Id: If2566764a52726ce45fff9b5e96ce9a42d513d8d
2020-06-12 08:41:48 -07:00
Albin Vass
5bcf93c37d Terraform roles and jobs.
Adds terraform roles to install and execute terraform.

Supports adding an override.tf file to override configuration in CI
which is useful to let zuul handle module reposity authentication
instead of setting up credentials on the remote during the job.

Also returns the execution plan back as a comment for 'terraform plan'
to make it easy for reviewers.

Change-Id: I3b4f2bac7f055a0c0f9cb7888b4146ac9c007d25
2020-06-11 17:26:50 +02:00
Zuul
8748c9add2 Merge "test-playbooks: avoid warnings with shell/command" 2020-06-09 17:20:03 +00:00
Ian Wienand
f946763d0a Revert "download-artifact : support recursive download"
This reverts commit 7101fe7d1c13250415f5c6f6392c2a22720bbe43.

This unfortunately has a number of problems.

Firstly, the "Fail if no wget" fails when download_artifact_recurse
isn't set, because we didn't check for wget.

Also, the download doesn't work with some providers.  wget asks for
gzip downloads with it's accept headers (which can't be turned off)
but the recursive download doesn't understand the gzipped index.html
file and thus doesn't find anything to walk.  The "--compression=auto"
flag is available to overcome this, but is not widely supported (and
not supported on the executor).  https://review.opendev.org/733728
attempted to work-around this but the problems with this approach seem
too much for now.

Change-Id: I9bc55d771ec1828d374684d0ffe5ec1d1494773e
2020-06-05 13:34:23 +10:00
Zuul
eed60ad916 Merge "download-artifact : support recursive download" 2020-06-04 23:59:32 +00:00
Ian Wienand
7101fe7d1c download-artifact : support recursive download
This adds a flag to download-artifact to download the artifact
directory recursively.

Change-Id: I9e07f2567d64518a7a159bc3f67e904636c9b610
2020-06-05 08:35:20 +10:00
Sorin Sbarnea
5c263fb437 test-playbooks: avoid warnings with shell/command
Avoids runtime warnings from use of Ansible shell/command module when
executed commands also have ansible modules.

Change-Id: I4e415cbd34f0f4cb15857051bf95458e0316de86
2020-06-04 18:54:37 +01:00
Sorin Sbarnea
b5408ca3fc test-playbooks: improved syntax
- added space around jinja variables
- use "name" argument on include_role, instead of undocumented role

Change-Id: I0984ca391667ace24705b20dd60eddd90e3a281e
2020-06-03 19:47:41 +01:00
Zuul
429049da4a Merge "upload-artifactory: fix variable misspelling" 2020-05-29 14:15:39 +00:00
Zuul
7a5c335cc6 Merge "Rename test install role to ensure-" 2020-05-28 17:47:41 +00:00
Sorin Sbarnea
5e9f91764e Bump ansible-lint to 4.3.0
- Bumps linter and make use of its auto-detection
- Temporary skips linting test-playbooks/ to match previous behavior
- Documents skips in a way that makes it easy to maintain the rules
- Keeps linter config in standard location, so it can be loaded
  regardless how is called.

Change-Id: Ic379c91fa9385473f6ec2af91e61953dc10c1f54
2020-05-28 16:48:14 +01:00
Albin Vass
2477bb6d4d upload-artifactory: fix variable misspelling
Also adds a check that makes sure the instance the artifact
is to be uploaded to is actually defined.

Change-Id: Ie80fa9869e49566dc39e815c10146d45724f5744
2020-05-28 16:26:40 +02:00
Tristan Cacqueray
b8e57ffc60 shake-build: add shake build system job
This change adds a new job to run the shake build system.

Change-Id: Iffaf4e0675d91033b1b5d66c52d501f6bdc8acaf
2020-05-28 12:48:16 +00:00
Zuul
f486706c24 Merge "Fix deprecation warning from multinode tests" 2020-05-26 13:56:07 +00:00
Zuul
d21f8cca47 Merge "Add container and pod log in the test for ensure-kubernetes role" 2020-05-26 12:55:44 +00:00
Zuul
4bc16a5afb Merge "Do not interpolate values from tox --showconfig" 2020-05-26 12:51:40 +00:00