Commit Graph

26 Commits

Author SHA1 Message Date
Ian Wienand d1e74606bc
push-to-intermediate-registry: look for container_images variable
When used with the container-image roles, the variable is
container_images, not docker_images.

Change-Id: I074f9523aea7d71879f722b88ff7c3e7e45fb90f
2023-03-24 10:35:35 +11:00
James E. Blair e69d879cae buildset registry: run socat in new session
We spawn socat processes in the background in buildset registry
related roles.  Ansible 5 is much better at killing all processes
in its session when the task is complete.  Work around that by
starting socat within a new session with setsid.

Change-Id: Iaab17f5d4068be6b08e3d89d2abe80199f0cd654
2022-05-24 10:46:42 -07:00
Ian Wienand 72d4e506d5 intermediate-registry: handle socat warning out
Zuul switched to a new base image, and it seems the new socat puts out
a warning (something like

 ...  socat[489590] W ioctl(5, IOCTL_VM_SOCKETS_GET_LOCAL_CID, ...): Inappropriate ioctl for device

for reference).

Grep the output so we only get the line about what port it is
listening on.

Change-Id: I74fb86a9158b45e6601ee1fbc199ba80cd4991fe
2021-10-14 16:04:46 +11:00
Clark Boylan 4c40b92950 Prevent leaks of buildset registry credentials
Because buildset registries may be used by jobs that finish before other
jobs are finished using the buildset registry we must be careful not to
expose the registry credentials in the jobs that finish sooner.
Otherwise logs for the earlier job runs could potentially be used to
poison the registry for later jobs.

This is likely currently incomplete. Other Zuulians should look over it
carefully to ensure we're covering all the bases here.

The cases I've identified so far are:

* Setting facts that include passwords
* Reading and writing to files that include passwords (as content may be
  logged)
* Calling modules with passwords passed as arguments (the module
  invocation is logged)

I've also set no_log on zuul_return that passes up credentials because
while the logging for zuul_return is minimal today, I don't want to
count on it remaining that way.

We also use the yet to be merged secret_data attribute on zuul_return to
ensure that zuul_return itself does not expose anything unwanted.

Finally it would be great if others could check over the use of
buildset_registry variables to make sure there aren't any that got
missed. One thing I'm not sure of is whether or not when conditionals
get logged and if we need to be careful about their use too.

Temporarily remove some buildset-regitry jobs which are in a catch-22.

Change-Id: I2dea683e27f00b99a7766bf830981bf91b925265
2021-06-24 09:56:19 -07:00
Sorin Sbarnea 90d263941a More E208
Change-Id: I8c3d224682d7d6780d6ad7823e390c47114e702b
2020-11-05 08:33:28 +00:00
Albin Vass 4feb02f87e use zj_image instead of image as loopvar
Change-Id: I2b34253e736252994681b7c69eb051c8a0659671
2020-05-05 18:43:25 +00:00
James E. Blair 2f2d6ce3f7 Add a registry test job
This exercises the intermediate and buildset registry roles.

Change-Id: Ic0da2d6b48a7b9f9b616033c70db471ba98181b4
2019-06-03 09:03:35 -07:00
James E. Blair bd5542e5cc Don't log setting up creds for the intermediate registry
This could expose credential information.

Change-Id: I7c134289b627f90f7972e0d59ec21a7f35bd2c01
2019-04-22 15:54:31 -07:00
James E. Blair aae4df5024 Fix localhost cert location for push-to-intermediate-registry
We're using 127.0.0.1 everywhere rather than localhost; the cert
directory and auth information need to match.

Change-Id: Id72332625c234519ce4c819e88c184035eac8203
2019-04-22 14:43:29 -07:00
Clark Boylan 23826e05a6 Only alias docker registries on test nodes
Skopeo has problems with ipv6 address literals just like docker as they
use the same underlying checks for url validity. However, we think we
can fix that by using a port forward from the executor to the buildset
registry so that skopeo can connect via ipv4

Go back to aliases the registries on test nodes via /etc/hosts.

Change-Id: I5f9316ffe84de06cb2fb2b65a7e1c31d9f8b0e35
Co-Authored-By: James E. Blair <jeblair@redhat.com>
2019-04-22 10:37:33 -07:00
Clark Boylan ba4b2c68b9 Revert "Only alias registries on build nodes"
This reverts commit 05f20a5396.

Apparently skopeo is properly cloud native too and doesn't support ipv6
either. I think it is pulling the same docker
distribution/reference/regexp.go lib in and using docker's regex.

The error we get from skopeo:

 time="2019-04-10T15:15:48Z" level=fatal msg="Invalid source name docker://[2607:ff68:100:54:f816:3eff:fef2:fc69]:5000/zuul/nodepool:latest: invalid reference format"

Change-Id: I6f916574c9f46e8fdd2464465e2b36ecf8719b16
2019-04-10 08:22:04 -07:00
Clark Boylan 05f20a5396 Only alias registries on build nodes
We only need to alias registries on the build nodes when running docker.
We cannot alias them in /etc/hosts in roles that are expected to run on
localhost beacuse /etc/hosts is bindmounted read only on localhost. This
assumes that skopeo handles ipv6 properly (which has not been tested).

If skopeo does not handle ipv6 properly then we'll need additional
fixing.

Change-Id: I40e5b1bac5aeaf2d42aa05a72b9ced72b7d222c0
2019-04-09 14:45:19 -07:00
Clark Boylan 3a29935f32 Revert "Use /etc/hosts with docker registries to handle ipv6"
This reverts commit a307259776.

We need to additionally handle this on localhost (the zuul executor)
where we cannot edit /etc/hosts. At least I don't think we can. We also
need to handle the case where buildset_regsitry is not yet defined.

Change-Id: I4928f7fcf58e88cf360de253f01b16546220aace
2019-04-09 10:10:03 -07:00
Clark Boylan a307259776 Use /etc/hosts with docker registries to handle ipv6
Docker doesn't appear to understand properly escaped ipv6 addrs in its
"urls". Address this by adding /etc/hosts entries for any
buildset_registry that is specified by an ip address (v4 or v6). This
allows us to use a named alias instead of the ipv6 address.

An example failure for posterity:

  "[2607:ff68:100:54:f816:3eff:fe7c:e98a]:5000/zuul/nodepool:latest" is not a valid repository/tag: invalid reference format

Change-Id: Id865dc7d3382174b61f9eaa76e29b637a85f5142
2019-04-08 13:40:58 -07:00
James E. Blair 325b666b6d Use ipwrap filter in registry roles
We need to escape some ipv6 addresses in URLs.

Change-Id: Ica5fe73dd65e138cdc4817de3903cdd271402941
2019-04-05 16:15:02 -07:00
James E. Blair 05d6187825 buildset registry: fix proxy_port error in push/pull roles
This was copy/pasta from the use_buildset_registry role; the
intermediate registry has no proxy_port, and the push/pull operations
don't need to use the proxy buildset registry, so remove both
entries from the docker config.

Change-Id: I7c2d57d027e457f4f093497938574624cd5a444c
2019-03-18 10:15:02 -07:00
James E. Blair f4db0f0979 buildset registry: don't put skopeo creds on command line
Use the docker user config file rather than the skopeo command line
when performing skopeo push/pull operations.  This should allow
us to log the command.

Change-Id: If6b1f3ab34461d77e619b188f48c5d209df7afce
2019-03-18 09:13:38 -07:00
James E. Blair cbff0cc355 push-to-registry: handle undefined docker_images
So that this role may be used unconditionally in jobs which may
or may not actually build images, skip the tasks if the
docker_images variable is undefined.

Change-Id: I6ef0c80230de628f86f523878020c82ce81a1e60
2019-02-19 17:49:21 -08:00
James E. Blair 7edb42008f Use list form of zuul artifact return
This relies on the list merge behavior in https://review.openstack.org/638005
however, this will work with the current code in Zuul as long as only
one artifact is returned, so a Depends-On is not necessary.

Change-Id: Ie5d3a61c8cc1038f3775a3aa81e94b9b909f265a
2019-02-19 12:58:54 -08:00
James E. Blair 71b7cb0ae5 Update docker image roles
* In the build-image role, push to the buildset registry if it is defined.
* In the intermediate registry push and pull roles, ensure that the
  buildset registry TLS cert is in place.  This is a self-signed cert,
  and so needs to be written for each run.  This happens inside
  bubblewrap where we have permission to write to /etc, which is an
  ephemeral volume.

Change-Id: I47781d8a7adb93817dfe9266e2f4ad5fd829385c
2019-02-16 10:02:48 -08:00
James E. Blair ee1b1ea2e4 Intermediate registry: correct arg order
The --insecure-policy argument must appear before copy.

Change-Id: If182405b57c026ced237bf152d323bdea6ff54b2
2019-02-15 17:46:42 -08:00
James E. Blair c7818fe499 Intermediate registry: use --insecure-policy
There is no policy file available, and we aren't concerned with
verifying image signatures at this point.  Add this option to
tell skopeo to proceed regardless.

Change-Id: I15a4978ec0fb338bc05c974b0ec6a21f680c853e
2019-02-15 16:13:42 -08:00
James E. Blair e6b1d2aa06 Correct host variable in push-to-intermediate-registry
Change-Id: I4472fde0c7b35bf9b7d54e29e02c6a49280cd714
2019-02-15 13:43:23 -08:00
James E. Blair 2a3d69c8be Fix undefined attrs in registry push/pull roles
The attribute zuul.artifacts is only present if there are artifacts.
Use the empty list as default.

The default for image.tags should be 'latest' to match the rest
of the docker roles.

Change-Id: Iff6863043e3a0311cb1c8c2ef4cd3d37ff79cce5
2019-02-14 15:03:11 -08:00
James E. Blair 582e95db53 Enable logging on registry/push/pull jobs
This may expose credentials, but these don't work right now.

Change-Id: I8b55734d17329ecc6ac9d9a9ad4189482b6c07ee
2019-02-14 12:59:29 -08:00
James E. Blair 8efc1cf1af Add intermediate registry push/pull roles
Change-Id: Ie2554005f924d2736d1f1fd1c51cfd5ca9e09199
Depends-On: https://review.openstack.org/634825
2019-02-11 17:41:30 -08:00