Jenkins main control repo for R10k and our Puppet Enterprise managed infrastructure
This repository hosts the Puppet code for the Jenkins project’s own infrastructure.
See the Jenkins infrastructure project for overview of the project’s infrastructure and the services being managed by this repository.
A non exhaustive list of services is available here.
All containerized services are stored in separate repositories (Plugin Site, IRC Bot, etc.).
They have their own release cycles and maintainers.
This repo just manages and configures the deployments.
*:image_tag
variables.All the secrets are encrypted within the repository using eyaml. in order to view or edit them:
bundle exec eyaml edit <filename>
such as bundle exec eyaml edit ./hieradata/common.yaml
bundle
installed and present in your PATH
.sh
has never been tested, neither Windows Cygwin Shell (but WSL is ok).yq
in version 4.x is neededYou can always check the Docker image that ci.jenkins.io uses to run the test harness for this project at https://github.com/jenkins-infra/docker-inbound-agents/blob/main/ruby/Dockerfile (Jenkins agent labelled with ruby
).
Run the script ./scripts/setupgems.sh
to ensure that all the local dependencies are ready for local development, including:
bundler
(through Gemfile
and Gemfile.lock
) to ensure development tools are available through bundle exec <tool>
commands./Puppetfile
and installed to ./modules
./Puppetfile
into .fixtures.yml
but also other locations in ./spec/
TL;DR: As for today, there are no automated acceptance tests. Contributions are welcome.
A long time ago, this repository used serverspec for on-machine acceptance testing.
Combined with Vagrant, it allowed to execute acceptance tests per-role.
But this serverspec with Vagrant uses deprecated (and not maintained anymore) components.
Proposal for the future:
dgoss
wrapper and provides automatic adding testsvagrant ssh
(but requires updating ruby dependencies + find a way to run serverspec within the VM instead of outside)docker
must be present in your PATH
.--privileged
../scripts/vagrant-bootstrap.sh
script to prepare your local environment.To launch a test instance, vagrant up ROLE
where ROLE
is one of the defined roles in “dist/role/manifests/“.
Ex: vagrant up jenkins::controller
All machines should have the same base Ubuntu version, however we can have edge cases. As such, you can specify the Ubuntu version through the environment variable UBUNTU_VERSION
.
Ex: UBUNTU_VERSION=18.04 vagrant up pkg
NOTE: there are a LOT of corner cases and a generic code (Dockerfile and Vagrantfile) would only mean writing tons of hashmaps to cover all cases. Work on using another tool such as molecule instead if you want to spend time fixing this.
Note: for this role, there may be the following error message because plugins installation needs a running Jenkins instance while it’s not quite ready when it happens:
Error: /Stage[main]/Profile::Jenkinscontroller/Exec[perform-jcasc-reload]: Failed to call refresh: ‘/usr/bin/curl -XPOST —silent —show-error http://127.0.0.1:8080/reload-configuration-as-code/?casc-reload-token=SuperSecretThatShouldBeEncryptedInProduction‘ returned 7 instead of one of [0]
You can safely ignore it.
You can re-run puppet and execute tests with vagrant provision ROLE
repeatedly while the VM is up and running.
When it’s all done, remove the instance the instance via vagrant destroy ROLE
.
The default branch of this repository is production
which is where pull requests should be applied to by default.
+----------------+
| pull-request-1 |
+-----------x----+
\
\ (review and merge, runs tests)
production \
|---------------o--x--x--x---------------->
When a infra project team member is happy with the code in your pull request, they can merge it to production, which will be automatically deployed to production hosts.
For installing agents refer to the installing
agents section of
the PuppetLabs documentation.
“Dynamic environments” are in a bit of flux for the current version (3.7) of
Puppet Enterprise that we’re using. An unfortunate side-effect of this is that
creating a branch in this repository is not sufficient to create a dynamic
environment that can be used via the Puppet master.
The enable an environment, add a file on the Puppet master:/etc/puppetlabs/puppet/environments/my-environment-here/environment.conf
with
the following:
modulepath = ./dist:./modules:/opt/puppet/share/puppet/modules
manifest = ./manifests/site.pp
See this page for the overview and links.
And this local page for tips.
Channels:
#jenkins-infra
on the Libera Chat IRC network - see https://www.jenkins.io/chat