1622 Commits

Author SHA1 Message Date
Albin Vass
664b016fa5 Add upload-artifactory role
Adds a role to let users define a manifest of artifacts located
in zuul-output/artifacts that should be uploaded to pre defined
artifactory instances.

Change-Id: I00dc0302e85ce59b3808f6e62e2bcdadf2e41fde
2020-05-12 20:02:12 +02:00
Zuul
263fea0727 Merge "ensure-tox: use venv to install" 2020-05-07 01:28:22 +00:00
Monty Taylor
ce3136476a Tag the images pulled back into docker for changes
When building normally we tag the images in docker, this lets
upload push them. But in the buildx case, we tag them for the
buildset registry but they never end up with change-specific
tags on the docker host itself, so they can't be found by
the upload playbook.

Change-Id: I4f51df3ac67602fd2d48f66639bb0715e7b06cd3
2020-05-06 16:54:16 -05:00
Monty Taylor
b211a26d0b Split the arch building and pushing separately
When building multi-arch it's done in parallel which can result
in the same layer being pushed at the same time, which is bad
for the registries.

Instead, build everything in paralle, then push each arch independently,
then push all the arches again to cause the manifest to be written
and pushed properly.

Change-Id: I8036a9b4d4c515c20a05994741540b999e7cbcae
2020-05-06 10:42:47 -05:00
Monty Taylor
2c00634e73 Retry buildx builds
We seem to have flaky issues with buildx builds (because of course
we do). Try retrying the build to see if it's an eventually
consistent utility.

Change-Id: I6bd625ad7ffcf0c629c85017b1d5d3727e27b9d9
2020-05-06 07:22:10 -05:00
Zuul
3a43af0b78 Merge "Remove some temporary files" 2020-05-06 09:00:12 +00:00
Andreas Jaeger
fc11a533c0 Remove some temporary files
Remove temporary files and directories.

Change-Id: I63e7dc80dea5d3e5c7fa556852b595f7b993d95c
2020-05-06 07:54:30 +02:00
Ian Wienand
6d78fc4f90 ensure-tox: use venv to install
This currently installs with pip --user which cases problems if you
try to run this version of tox as another user.  This is done in
system-config, for example, where we run tox with "become: yes" to run
testinfra.

By installing tox into a venv, we can call it as another user and it
just works because it's all encapsulated in the venv.  We use the
virtualenv commands exported by ensure-pip to create this.

I think the original motivation for installing tox like this was to
ensure it is done without sudo permissions.  This also doesn't require
permissions, but ensures the resulting tox_executable is able to be
executed in more contexts.

Needed-By: https://review.opendev.org/712819
Change-Id: Iebee8cb72cce7944c537fdb91b6c98ed51878661
2020-05-06 13:01:03 +10:00
Ian Wienand
f578a38693 ensure-pip : fix Xenial exported virtualenv command
This is a fix for Id8347b6b09735659a7ed9bbe7f9d2798fbec9620 which did
not specify the full path in ensure_pip_virtualenv_command for Xenial.

This slipped by testing because there we check
ensure_pip_virtualenv_command runs under a shell:, but not when called
as the argument to the pip: module (which exec's it differently and
requires the full path).  Update testing to do that too.

Change-Id: I65ff5ce913917079ab2fc1d88c56d1c0a24ea83e
2020-05-06 11:15:00 +10:00
Zuul
47bce7db05 Merge "Add plain nodes to testing" 2020-05-05 23:26:06 +00:00
Zuul
4f008f15c7 Merge "ensure-pip: Install backported pip for Xenial" 2020-05-05 23:18:46 +00:00
Monty Taylor
f449ae20fb Set up siblings dirs for each build in the loop
The buildx patch unfortunately changed the logic associated with
siblings to set up siblings in a loop one time, rather than to
do a loop of "set up siblings, build, cleanup siblings". This causes
builds to fail when they're using siblings with an error about
siblings dir not having been cleaned up.

Change-Id: I3c45bfa77ec9f2609689e04044c18f066adc9741
2020-05-05 17:52:50 -05:00
Zuul
6f19965a6a Merge "use zj_log_file instead of item as loop_var" 2020-05-05 21:20:36 +00:00
Zuul
fd856093d7 Merge "use zj_image instead of image as loopvar" 2020-05-05 20:45:55 +00:00
Ian Wienand
8733cff8db Add plain nodes to testing
This adds more of the plain nodes (without pip-and-virtualenv) to our
testing environment to facilitate the eventual switch in opendev
infra.

Change-Id: I091ab667c5f071ba5844ea567464b1c29052638d
2020-05-06 06:41:56 +10:00
Ian Wienand
d9bd10de1a ensure-pip: Install backported pip for Xenial
It turns out the extant comment, removed here, is correct in
identifying the problem, but incorrect about the solution.

As noted the v8 pip included with Xenial doesn't fall back to PyPi
correctly when nodes are configured with mirrors.  However, the note
about virtualenv upgrading pip is incorrect.  This was not tested on
our "plain" nodes (this will be added by a follow-on
https://review.opendev.org/724776 when it can pass) so virtualenv was
picking up the pip installed by the pip-and-virtualenv element.

Installing pip from source doesn't really help; in fact it makes
things even more confusing because "python3 -m venv" still uses the
inbuilt pip from the python-pip-whl package [1].  e.g.

 root@ubuntu-xenial-plain:~# pip --version
 pip 20.1 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)
   ^ this is installed by get-pip.py
 root@ubuntu-xenial-plain:~# python3 -m venv test
 root@ubuntu-xenial-plain:~# ./test/bin/pip --version
 pip 8.1.1 from /root/test/lib/python3.5/site-packages (python 3.5)
   ^ it still deploys pip in the venv from the whl

and thus will *not* pick up the source pip install.  This is a problem
on our extant Xenial hosts, so clearly nobody is using it.  However,
as part of this work we want to standardise other tools we are
installing in zuul-jobs to use "python3 -m venv".  Thus we want all
our platforms need to support a working venv out of the box.

The solution proposed here is to install a backport of Bionic's pip 9
into Xenial when using this element.  This way, we are still shipping
packaged pip on the host and keeping our images as close to plain
vanilla upstream as possible, but with almost as small change as we
can manage to actually work in our environment.  Given the sunsetting
lifespan of Xenial, this should require not further maintenance until
we are no longer interested in the distro.

Because we skip the install phase on nodes with pre-installed pip, we
put in a work-around to set "ensure_pip_virtualenv_command" to
virtualenv on extant nodes that have been configured with
pip-and-virtualenv.  We can remove this when we have only "plain"
nodes (i.e. no pip-and-virtualenv element) and then we will
consistently be using venv's.

[1] https://packages.ubuntu.com/xenial/python-pip-whl

Change-Id: Id8347b6b09735659a7ed9bbe7f9d2798fbec9620
2020-05-06 06:41:50 +10:00
Zuul
c8bf4fc5e8 Merge "use-buildset-registry: do not update ca when not necessary" 2020-05-05 20:22:57 +00:00
Zuul
25206338a4 Merge "ansible-lint: use matchplay instead of matchtask" 2020-05-05 20:18:14 +00:00
Zuul
60815ac292 Merge "Add py38 testing" 2020-05-05 20:12:40 +00:00
Zuul
79bc6abaa5 Merge "ensure-pip: use python2-pip when running under Python 2" 2020-05-05 20:12:38 +00:00
Zuul
764b4bfe82 Merge "Write buildkitd.toml in use-buildset-registry" 2020-05-05 20:12:37 +00:00
Zuul
52339a02cc Merge "Include distro-specific vars" 2020-05-05 19:51:09 +00:00
Monty Taylor
70db82198c Write buildkitd.toml in use-buildset-registry
It's a generally useful file for people using buildkitd. It's also
more appropriate to write it in use-buildset-registry and then
just have build-docker-image copy it.

Do the same thing with writing the cert - we don't need to know
which path on the host use-buildset-registry wrote the file to,
we can just write the content from the dir into the container,
and then it's just a consistent command to apply it.

Change-Id: Iaa485c2e8628900dccbed1f4b0773b6d1b5f7983
2020-05-05 14:47:19 -05:00
Monty Taylor
9117b24139 Include distro-specific vars
We need ca_dir to copy the certs in, but when we run in multi-node
cases the use-buildset-registry invocation is in a separate place
so we dont' leak the var in.

This will get deleted in the next patch, but that patch is not
working and we need this to unbreak the multi-arch functionality
for nodepool.

Change-Id: I4f92f0415fb471f304fdd0a1e576812c8d67ab24
2020-05-05 14:21:03 -05:00
Zuul
974e145304 Merge "use-buildset-registry: fix modify_registries_conf library idempotency" 2020-05-05 19:15:40 +00:00
Zuul
27c8b4d9d5 Merge "Fix bare 'item' in build-container-image" 2020-05-05 19:02:47 +00:00
Zuul
25123c3b8f Merge "use-buildset-registry: add Fedora certifacts vars" 2020-05-05 19:02:45 +00:00
Albin Vass
dd8e831379 use zj_log_file instead of item as loop_var
Change-Id: Ife5560ad028e293f8bfa71756fe6825c1a3f43ce
2020-05-05 18:43:30 +00:00
Albin Vass
4feb02f87e use zj_image instead of image as loopvar
Change-Id: I2b34253e736252994681b7c69eb051c8a0659671
2020-05-05 18:43:25 +00:00
Albin Vass
bee0c6ae2f ansible-lint: use matchplay instead of matchtask
For some reason matchtask doesn't match includes, matchplay does so use
that instead.

Change-Id: I040f7f3394503e92d06c05e8ff671a43b14baebc
2020-05-05 20:42:38 +02:00
Albin Vass
a7b4e5e906 Fix bare 'item' in build-container-image
Move the setting of the containerfile into the loop (thus in build.yaml)
to follow the semantics from roles/build-container-image/common.rst for
container_filename and container_images.container_filename.

Co-Authored-By: Andreas Jaeger <aj@suse.com>
Change-Id: Id39f13cc666e9f99557447073cc0d362991f3506
2020-05-05 20:32:57 +02:00
Andreas Jaeger
069f4aef37 Add py38 testing
Python 3.8 is current version, replace py37 so that we test
3.5 and 3.8 as lowest/highest.

This follows I4b382bb89847d3ae2b20292d923c3c2211dfb254 for zuul.

Change-Id: I35a1492ff0e34c7951c8ecf216992044fdb3065f
2020-05-05 20:02:16 +02:00
Tristan Cacqueray
def8e9200e use-buildset-registry: fix modify_registries_conf library idempotency
This change ensures the modify_registries_conf doesn't update the
registry configuration when it is not necessary.

Change-Id: Iae824315ec5e0a0a362a81158777ebae7143ab57
2020-05-05 12:23:56 -05:00
Monty Taylor
8f52832e1f Use tempfile in buildx build
We make a few temp files. Let's use tempfile instead.

Change-Id: I5d59210d8d00e4bf7b5df7110a99b5de8755977f
2020-05-05 12:23:52 -05:00
Zuul
9396dba4d3 Merge "Don't pull and retag in buildx workflow" 2020-05-05 15:14:38 +00:00
Zuul
9d7551e4ea Merge "Revert "Revert "Do not set buildset_fact if it's not present in results.json""" 2020-05-05 14:35:24 +00:00
Zuul
618c78f191 Merge "Support multi-arch image builds with docker buildx" 2020-05-05 13:22:18 +00:00
Zuul
ff77dd22a1 Merge "Enable yamllint" 2020-05-05 08:46:58 +00:00
Zuul
a3e31688da Merge "Fix fetch-sphinx-tarball fails" 2020-05-05 06:05:18 +00:00
Ian Wienand
b4c195b419 ensure-pip: use python2-pip when running under Python 2
When Ansible runs under Python 2, such as on SuSE 15, we need
python2-pip for pip: to work.  Update the default to install Python 2
deps when Ansible is running under v2.

Additionally for SuSE, as described inline we can have pip but not
setuptools.  Put in a work-around to always pull in the setuptools
package.  Pull this out into a separate file; history has shown that
we may need more :/

Change-Id: I450171aad5e31d2925239ab3d0641cd23f6815a2
2020-05-05 09:27:24 +10:00
Albin Vass
66f3edc9a3 fetch-logs-openshift: fix miss when replacing item with loop_var: zj_
Change-Id: I7c9bd20ea026287724dcc0e48a614e9fa7736077
2020-05-04 23:08:29 +02:00
Monty Taylor
35219e9af3 Don't pull and retag in buildx workflow
We currently are pulling from br/repo/tag and then re-tagging to
just repo/tag. But we have buildset registry in the mirrors list
for docker, so we should just be able to pull directly from repo/tag
to prime the local image cache and have everything just work.

Change-Id: I4d73f10acfc84d94772b13e3be16790e661c7047
2020-05-04 14:38:48 -05:00
Zuul
f6806447b7 Merge "Add zuul labels to images and ability to user-define more" 2020-05-04 19:19:40 +00:00
Monty Taylor
63bd307e63 Support multi-arch image builds with docker buildx
Docker has experimental support for building multi-arch
container images with a buildx command. Currently it only
supports pushing to a registry after running and the images
don't end up in the local docker images list. To work around
that, push to the buildset registry then pull back. This
is the inverse of the normal case where we build, then
retag, then push. The end result should be the same.

Change-Id: I6a4c4f9e262add909d2d5c2efa33ec69b9d9364a
2020-05-04 14:02:13 -05:00
Monty Taylor
3a1e660e62 Add zuul labels to images and ability to user-define more
We can attach some metadata to images we build indicating where
the image was built from. We can also allow users to add additional
labels, should they choose, although honestly for users doing it in
the Dockerfile makes more sense.

Change-Id: I01de15279a69026a09633eb488dac62910b324f5
2020-05-04 11:53:21 -05:00
Sorin Sbarnea
33461bbecc Enable yamllint
Adds yamllint to the linters with a minimal configuration, some
rules are disabled to allow us to fix them in follow-ups, if
we agree on them.

Fixes invalid YAML file containing characters inside block.

Fixes few minor linting issues.

Change-Id: I936fe2c997597972d884c5fc62655d28e8aaf8c5
2020-05-04 17:47:11 +01:00
Zuul
95a9562b81 Merge "fetch-subunit-output: use failed_when: instead of ignore_errors:" 2020-05-04 16:20:02 +00:00
Zuul
4caa292b55 Merge "ara-report: use failed_when: false instead of ignore_errors: true" 2020-05-04 16:17:49 +00:00
Zuul
2b8a259cd4 Merge "go: Use 'block: ... always: ...' and failed_when instead of ignore_errors" 2020-05-04 16:15:01 +00:00
Andreas Jaeger
c2fba020e3 Fix fetch-sphinx-tarball fails
I added previously a check that makes docs job fail in post if there's no
html output. This now leads to a POST_FAILURE when the normal build fails.

So, a FAILURE turned into POST_FAILURE, see
https://zuul.opendev.org/t/zuul/build/afbc8c39929a46039aa4d987971cdb4f .

Update the check in the fetch-sphinx-tarball role that it only fails
if the playbooks passed.

Change-Id: Iebd0bffcc5caaa6df97d432a712d83b64db8e780
2020-05-04 10:09:47 +02:00