60 Commits

Author SHA1 Message Date
Ian Wienand
afd907c16d letsencrypt support
This change contains the roles and testing for deploying certificates
on hosts using letsencrypt with domain authentication.

From a top level, the process is implemented in the roles as follows:

1) letsencrypt-acme-sh-install

   This role installs the acme.sh tool on hosts in the letsencrypt
   group, along with a small custom driver script to help parse output
   that is used by later roles.

2) letsencrypt-request-certs

   This role runs on each host, and reads a host variable describing
   the certificates required.  It uses the acme.sh tool (via the
   driver) to request the certificates from letsencrypt.  It populates
   a global Ansible variable with the authentication TXT records
   required.

   If the certificate exists on the host and is not within the renewal
   period, it should do nothing.

3) letsencrypt-install-txt-record

   This role runs on the adns server.  It installs the TXT records
   generated in step 2 to the acme.opendev.org domain and then
   refreshes the server.  Hosts wanting certificates will have
   pre-provisioned CNAME records for _acme-challenge.host.opendev.org
   pointing to acme.opendev.org.

4) letsencrypt-create-certs

   This role runs on each host, reading the same variable as in step
   2.  However this time the acme.sh tool is run to authenticate and
   create the certificates, which should now work correctly via the
   TXT records from step 3.  After this, the host will have the
   full certificate material.

Testing is added via testinfra.  For testing purposes requests are
made to the staging letsencrypt servers and a self-signed certificate
is provisioned in step 4 (as the authentication is not available
during CI).  We test that the DNS TXT records are created locally on
the CI adns server, however.

Related-Spec: https://review.openstack.org/587283

Change-Id: I1f66da614751a29cc565b37cdc9ff34d70fdfd3f
2019-04-02 15:31:41 +11:00
Ian Wienand
66ceb321a6 master-nameserver: Add unmanaged domains; add acme.opendev.org
This adds the concept of an unmanaged domain; for unmanaged domains we
will write out the zone file only if it doesn't already exist.

acme.opendev.org is added as an unmanaged domain.  It will be managed
by other ansible roles which add TXT records for ACME authentication.
The initial template comes from the dependent change, and this ensures
the bind configuration is always valid.

For flexibility and testing purposes, we allow passing an extra
refspec and version to the git checkout.  This is one way to pull in
changes for speculative CI runs (I looked into having the hosts under
test checkout from Zuul; but by the time we're 3-ansible call's deep
on the DNS hosts-under-test it's a real pain.  For the amount of times
we update this, it's easier to just allow a speculative change that
can take a gerrit URL; for an example see [1])

[1] https://review.openstack.org/#/c/641155/10/playbooks/group_vars/dns.yaml

Testing is enhanced to check for zone files and correct configuration
stanzas.

Depends-On: https://review.openstack.org/641154
Depends-On: https://review.openstack.org/641168
Change-Id: I9ef5cfc850c3458c63aff46cfaa0d49a5d194e87
2019-03-27 14:22:59 +11:00
Monty Taylor
9adc5ce8fe Split python-base into its own Dockerfile
There's no real need to tie these together into a multi-stage
Dockerfile as they don't really share anything. Split them.

Change-Id: Ifd7ccadcd8048eeb57797d60356aec2f9f0d2c80
Depends-On: https://review.openstack.org/641805
2019-03-08 15:49:49 -08:00
James E. Blair
a5f3c1cffe Add a soft dependency between gitea build and run
When we run the run-gitea job, make sure that it runs *after*
the gitea image build job, if the build job ran at all.  If
it didn't, we don't need to worry about it.

This has to happen in the project pipeline config because the
job dependency is different in check and gate.

Change-Id: I7cb069a6cd40a4ae8d5cbcdf23e7686b301493a1
2019-03-08 15:47:50 -08:00
James E. Blair
7a94bd060e Use the opendev docker build jobs
These now only run a registry if there isn't already one running
in the buildset, so we can use them here in that configuration.
They also take care of the provides/requires for us, so we can
remove those.

Change-Id: I3b6d825df8d658adcae51ed20a5335c612b7d9f2
Depends-On: https://review.openstack.org/642151
2019-03-08 15:47:49 -08:00
Monty Taylor
683b73b4fb Send readme parameter when creating projects
The web page from which this call is taken has a readme selector
and a default value of "Default" that we're not sending in this
request. Send it to avoid gitea not being able to find the empty
readme.

Also, add gitea-git-repos to the files section of system-config-run-gitea
so that we actually test it.

Change-Id: Ieec94aadb63fa097f10a3f325dd105b30e610dd9
2019-03-07 22:17:53 +00:00
Zuul
c5611561ea Merge "Test gitea project creation playbook" 2019-03-06 21:17:35 +00:00
James E. Blair
9ff29b108d Test gitea project creation playbook
Add an option to run a playbook (in the fake bridge context) after
running the base playbook.  Use this to run a new playbook which
exercises gitea project creation after bootstrapping the gitea
service.

Disable ansible-lint 304 because it erroneously thinks shell and
command are the same thing.

Change-Id: I0394b614771bc62b9fe23d811defd7767b3d10db
2019-03-06 18:42:39 +00:00
James E. Blair
d242dabdc6 Use a buildset registry in the container jobs
Now that nodepool and zuul support provider affinity for paused
jobs, we should be able to have a buildset registry run for
every change and configure the docker image based jobs to use it.

Change-Id: Iddf12475c8dfce2db2d79538ace58a49211eab97
2019-03-05 16:33:48 -08:00
James E. Blair
287eecd9d2 Run zuul-preview
Change-Id: Ib72e2bd29d1061822e0c16c201445115a5e5c58f
2019-02-25 13:14:51 -08:00
James E. Blair
4b031f9f24 Run an haproxy load balancer for gitea
This runs an haproxy which is strikingly similar to the one we
currently run for git.openstack.org, but it is run in a docker
container.

Change-Id: I647ae8c02eb2cd4f3db2b203d61a181f7eb632d2
2019-02-22 12:54:04 -08:00
James E. Blair
67cda2c7df Deploy gitea with docker-compose
This deploys a shared-nothing gitea server using docker-compose.
It includes a mariadb server.

Change-Id: I58aff016c7108c69dfc5f2ebd46667c4117ba5da
2019-02-18 08:46:40 -08:00
James E. Blair
175a337e01 Handle registry role running under py3
Also, correct the host_vars filename.  Again.
Also, make sure we run the test on changes to the host_vars filename.

Change-Id: I95fb61531bae677f5c68f4e56ed718da6c507eb9
2019-02-08 09:13:06 -08:00
James E. Blair
12709a1c8b Run a docker registry for CI
Change-Id: If9669bb3286e25bb16ab09373e823b914b645f26
2019-02-01 10:12:51 -08:00
James E. Blair
8062f4c1ec Grab container logs at the end of run-base
So that we automatically get container logs for future jobs
which use containers.

Change-Id: I329c67eefb8c6a2ff9a8ce8ef69cc844cef6012a
2019-02-01 10:12:39 -08:00
James E. Blair
22ad414a86 Use stage-output role in system-config-run
This simplifies log collection.

Change-Id: I754637115f8c7469efbc1856e88bbcb6fb83b4ce
Depends-On: https://review.openstack.org/634293
2019-01-31 11:03:25 -08:00
James E. Blair
d145e86f71 Switch to zuul-jobs docker build jobs
There are upstream jobs in zuul-jobs with the docker build playbooks,
so use them.  The system-config jobs are kept so that we don't have
to duplicate the secret stanza.

Change-Id: Iceee55a3d0e8b243549fa988f134b1ea9bb6dac5
2019-01-23 13:44:04 -08:00
Zuul
545921ba7b Merge "Add python-builder docker image" 2019-01-22 18:19:04 +00:00
James E. Blair
208c9dbde7 Update dockerhub credential
We've made separate dockerhub users so we don't have to share
credentials across trust boundaries, nor do we need to define the
jobs which use them centrally.

There is a new opendevzuul user which has access to opendevorg,
use that.

Change-Id: Ia22188255f6e5b0f2ba0cefe20694bdec38c1444
2019-01-21 14:55:32 -08:00
Monty Taylor
0e1cd6ee85
Add python-builder docker image
This is a builder image intended to make it easy to build
images for projects that use pbr and bindep.

Also, build a python-base image for use with python-builder

pbrx installed dumb-init in a base image and used it as an
entrypoint for the image. This is a good pattern that we should
continue. Make a python-base image that can be used in the FROM
line of consuming final images.

Change-Id: I8da39e680e9c5ca0d8f603a2645e83fc3be87a8b
2019-01-21 20:06:42 +00:00
James E. Blair
624e454c5a Rename docker role vars
The upstream role var names have changed.  For the better.
Depends-On: https://review.openstack.org/631602

Change-Id: I0a338da98dcfb48cd4207f182f88a043b1370ab6
2019-01-17 11:30:08 -08:00
James E. Blair
a81503921d Set allowed-projects on system-config image jobs
Without this, other projects could run this job (or its descendents)
and pass in an images dictionary instructing it to upload something
to one of our repositories.

Change-Id: I2c68d6673217bbc274c1134ee221cd6484abcf16
2019-01-16 16:29:53 -08:00
James E. Blair
c8571eef3c Add gerrit image jobs
Add jobs to build, upload, and promote a gerrit image to
Docker Hub.  This uses alternative tags, build path, and
build args.

Change-Id: Iea7109f9ee0ec18431f298a2ecc611678a868d6d
Co-Authored-By: Monty Taylor <mordred@inaugust.com>
2019-01-16 11:28:18 -08:00
James E. Blair
bfbf0e347b Add gitea image jobs
Add jobs to build, upload, and promote a gitea image to Docker Hub.
This produces two images (gitea and openssh) from a single Dockerfile
via a multi-stage build.

Change-Id: I8e6136787f75cd69b881b7ac715418c86d356872
2019-01-16 11:28:17 -08:00
James E. Blair
de9e62975a Add gitea-init image jobs
Add jobs to build, upload, and promote a gitea-init image to
Docker Hub.

Change-Id: I7f3ed47ec4c58c118dd3b234a4e20ced3a998999
2019-01-16 11:28:16 -08:00
James E. Blair
31de26ff39 Add jinja-init image jobs
Add jobs to build, upload, and promote a jinja-init image to
Docker Hub.

Change-Id: I493846b672f2a77e63eb78e1fb51c8fefb710990
2019-01-16 11:28:15 -08:00
James E. Blair
7a6ae3aadb Add docker image building jobs
This adds the infrastructure for building docker images: the
credential used to upload to Docker Hub as well as the parent jobs
and playbooks to perform the builds.

Change-Id: I7cbbcdd184c4934f1b0ce5905d9760c732b06aa9
Depends-On: https://review.openstack.org/631078
2019-01-16 11:28:14 -08:00
James E. Blair
9e6a4d327e Remove all docker image building jobs
These will be re-added in followup changes based on the new
zuul-jobs roles.

Change-Id: I0c0691afb180903c573cc1a9eb39590fa58e7ca6
2019-01-16 11:28:07 -08:00
Monty Taylor
b1c4a6d36a Build a gerrit image
The gerrit source dir needs three plugins cloned into
the plugins dir and also a few files updated.

Depends-On: https://review.openstack.org/631007
Change-Id: I56037137d43ee1cea0a4c17e48d09102e1599ddc
2019-01-16 11:27:20 -08:00
Monty Taylor
d1a2dfa6f5 Add support for per-image build-arg settings
Change-Id: Ia14397389be0c7178c1879844cd675a3d291a3d0
2019-01-15 09:27:16 -08:00
Monty Taylor
700f195706
Add support for passing path to docker build
If we clone gerrit to ~/src/gerrit.googlesource.com/gerrit but
want to keep the Dockerfile in system-config, then we need to be
able to run:

  docker build ~/src/gerrit.googlesource.com/gerrit -f Dockerfile

Most of the time the dir will just be '.', so put in a sensible
default.

Change-Id: I235080c05e679d2ac270cd5401b85c655fab3112
2019-01-12 21:34:40 +00:00
James E. Blair
2cf0364d40 Build a gitea-init image
Change-Id: Ib5dc09b1ff83ee81ed377773790046af25b25e89
2019-01-11 14:41:22 -08:00
James E. Blair
b4471fb2b6 Fix docker image builds
The credentials secret needs to be associated with the playbook
that uses it.

Also, add build-image-jinja-init to check, this was accidentally
omitted earlier.

Change-Id: I527a26781a716f9307539e4a486d6b79b32f25fd
2019-01-11 12:06:36 -08:00
James E. Blair
899a2023d2 Use promote pipeline for system-config images
Upload an image to dockerhub with a change-specific tag in every
gate job, and then, if the change lands, re-tag the image in
dockerhub.

Change-Id: Ie57fc342cbe29d261d33845829b77a0c1bae5ff4
2019-01-11 08:22:19 -08:00
James E. Blair
83237bc01e Add jinja-init Dockerfile
This creates a jinja-init image based on
https://github.com/ObjectifLibre/jinja-init

We can use this image as an "init container" in k8s to template out
config files using configmaps and secrets.

It also adds a gitea-init Dockerfile, which will require the
jinja-init image to be published first.

Change-Id: I88e14c4f0d868f99aa0a0316e6b9e24c2a8fea68
2019-01-10 10:53:48 -08:00
James E. Blair
3ce494abab Add gitea dockerfile
Change-Id: Iae2c4cbd174212e97445dd3080e2b85be730c5c4
Story: 2004627
2019-01-10 10:53:48 -08:00
Ian Wienand
f07bf2a507 Import install-docker role
This is a role for installing docker on our control-plane servers.

It is based on install-docker from zuul-jobs.

Basic testinfra tests are added; because docker fiddles the iptables
rules in magic ways, the firewall testing is moved out of the base
tests and modified to partially match our base firewall configuration.

Change-Id: Ia4de5032789ff0f2b07d4f93c0c52cf94aa9c25c
2018-12-14 11:30:47 -08:00
Ian Wienand
3bed6e0fd3
Enable ARA reports for system-config bridge CI jobs
This change takes the ARA report from the "inner" run of the base
playbooks on our bridge.o.o node and publishes it into the final log
output.  This is then displayed by the middleware.

Create a new log hierarchy with a "bridge.o.o" to make it clear the
logs here are related to the test running on that node.  Move the
ansible config under there too.

Change-Id: I74122db09f0f712836a0ee820c6fac87c3c9c734
2018-12-04 17:46:47 -05:00
Jens Harbott
7833dcd12d Make system-config-run-base-ansible-devel non-voting
Due to an issue with the current ansible branch, this check is failing
currently, make it non-voting to unblock other changes.

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

Change-Id: I2fcf3abd69103a3e0b8eb56528650481a865a1cc
2018-12-03 13:48:34 +00:00
Ian Wienand
06da49c6e2 bridge.o.o: Use latest openstacksdk
Similar to the pinning introduced in
Ic465efb637c0a1eb475f04b0b0e356d8797ecdeb, use the "latest"
openstacksdk package and allow for passing of pinned versions if
required.

Update the devel test to also use the master of opensatcksdk

Change-Id: I4b437ca9024c87903bdd3569c8309cde725ce28e
2018-11-08 09:50:58 +11:00
Ian Wienand
24c81fb0c3 Pin bridge.o.o to ansible 2.7.0, add devel testing job
This adds arguments to "install-ansible" to allow us to specify the
package name and version.

This is used to pin bridge.o.o to 2.7.0 (see
I9cf4baf1b15893f0c677567f5afede0d0234f0b2).

A new job is added to test against the ansible-devel branch. Added as
voting for now, until it proves to be a concern.

Change-Id: Ic465efb637c0a1eb475f04b0b0e356d8797ecdeb
2018-11-08 09:50:53 +11:00
James E. Blair
dae1a0351c Configure opendev nameservers using ansible
Change-Id: Ie6430053159bf5a09b2c002ad6a4f84334a5bca3
2018-11-02 13:49:38 -07:00
James E. Blair
90e6088881 Configure adns1.opendev.org server via ansible
Change-Id: Ib4d3cd7501a276bff62e3bc0998d93c41f3ab185
2018-11-02 13:49:38 -07:00
James E. Blair
14b9027da2 Use the empty nodeset for bride playbook runs
We need no nodes for this.

Change-Id: I3af7de061b0052a584c783371d9ebb94680b8106
2018-09-14 10:30:59 -06:00
James E. Blair
0f69aa3321 Add infra-run-zuul_reconfigure
Add a job to reconfigure zuul, and rename its parent job to use
a shorter name.

Change-Id: Id049086e138f6c98bb0c223284d5df9b73c4d4bf
2018-09-12 13:57:37 -06:00
Clark Boylan
0e9d830a64 Add job to run playbook on bridge.o.o
This new job is a parent job allowing us to CD from Zuul via
bridge.openstack.org. Using Zuul project ssh keys we add_host bridge.o.o
to our running inventory on the executor then run ansible on bridge.o.o
to run an ansible playbook in
bridge.openstack.org:/opt/system-config/playbooks.

Change-Id: I5cd2dcc53ac480459a22d9e19ef38af78a9e90f7
2018-09-12 11:26:55 -06:00
James E. Blair
8847ced8bf Move project config in repo
It's very convenient to be able to temporarily stop running all
these heavyweight jobs when developing new jobs.  Also, the config
is currently split in a strange way.  Move it all in-repo for
convenience.

Change-Id: I4da96050f1a20438ca29454de33cd871f5b282c8
2018-09-06 09:14:48 -07:00
James E. Blair
c34860d166 Add a run-nodepool job
Change-Id: I9d0721a7db7f355683895fca5a2a5f152d147034
2018-09-05 15:52:36 -07:00
James E. Blair
6dab882147 Refactor run-base jobs
Create a parent run job and inherit from it.  This reduces duplicate
'run' parameters, and corrects the omission of run-post from the
eavesdrop job.

Change-Id: Ib2a21b7190bf3611972097d6db545989cd54b3d4
2018-08-30 10:48:58 -07:00
James E. Blair
09b1ff4bc3 Add system-config-run-eavesdrop
Add a job which runs testinfra for the eavesdrop server.  When we
have a per-hostgroup playbook, we will add it to this job too.

The puppet group is removed from the run-base job because the
groups.yaml file is now used to construct groups (as it does
in production) and will construct the group correctly.

The testinfra iptables module may throw an error if it's run
multiple times simultaneously on the same host.  To avoid this,
stop using parallel execution.

Change-Id: I1a7bab5c14b0da22393ab568000d0921c28675aa
2018-08-30 10:25:23 -07:00