Praqma / JenkinsAsCodeReference

This repository is intended for the reference Jenkins configuration as code as well as JobDSL library
BSD 3-Clause "New" or "Revised" License
142 stars 110 forks source link

Build Status

maintainer: ewelinawilkosz

Jenkins as Code template

Description

The intention of this project is to create the easily configurable template, summarize the current best thinking and create unification for the stateless Jenkins deployments.

Getting started

Recommended setup

Preparations

git clone https://github.com/Praqma/JenkinsAsCodeReference.git
export http_proxy=<empty or proxy address>
export https_proxy=<empty or proxy address>
export no_proxy=<empty or proxy address>
export JAVA_PROXY=<empty or -Dhttps.proxyHost=<proxy address> -Dhttps.proxyPort=<proxy port> -Dhttp.nonProxyHosts=\"localhost,127.0.0.1|*.whatever.com\" -Dhttp.proxyHost=<proxy address> -Dhttp.proxyPort=<proxy port>

or

cat > ~/.bashrc <<- EOM
export http_proxy=<empty or proxy address>
export https_proxy=<empty or proxy address>
export no_proxy=<empty or proxy address>
export JAVA_PROXY=<empty or -Dhttps.proxyHost=<proxy address> -Dhttps.proxyPort=<proxy port> -Dhttp.nonProxyHosts=\"localhost,127.0.0.1|*.whatever.com\" -Dhttp.proxyHost=<proxy address> -Dhttp.proxyPort=<proxy port>
EOM
source ~/.bashrc

Important! We are using Alpine Linux and apk (package manager) requires proxy address to include schema, i.e. http_proxy=http://my.proxy.com not just http_proxy=my.proxy.com. This only affects http_proxy, https_proxy variables. More details here

mkdir -p $HOME/jenkins-backup/jobs
mkdir -p $HOME/jenkins-backup/userContent
mkdir -p $HOME/jenkins-backup/slave/gradle
mkdir -p $HOME/jenkins-backup/registry
mkdir -p $HOME/jenkins-backup/workspace
# We are running Jenkins as user id 1000 so let him own backup directory to avoid conflicts
chown -R 1000:1000 $HOME/jenkins-backup

First start

Step into the dockerizeit directory and run docker compose. Important! If you run docker compose from the different directory then make sure to use -p dockerizeit option for the docker compose. There are scripts that rely on services to be called dockerizeit_jmaster_1 and etc.

cd dockerizeit
docker-compose up -d --build

Restart/Start

Download docker-compose.yml attached to the latest deployment pipeline execution and run it using docker-compose

wget <docker compose file url>
docker-compose -p dockerizeit up -d

or pick it from the backup directory

docker-compose -f $HOME/jenkins-backup/jobs/jenkins_as_a_code-pipeline/builds/lastSuccessfulBuild/archive/docker-compose.yml \
-p dockerizeit \
up -d

Configuration

Find detailed description of configuration scripts and configuration file here

Roadmap and contributions

Workflow

Issues labeling follows Pragmatic workflow described here Describe your idea as ticket, make sure to put Action - needs grooming label and let's discuss it together

Contributions verification

We do have Travis CI job running for all branches so make sure it goes green for all your contributions. You can also use review job created on the startup. This job relies on principals described in this article

Project progress

You can see project status on its Waffle board. At some point of time, we will kick off maintainers meetings. Stay tuned