Self-contained solution for CI within MTA Infrastructure for automated builds
- Install UCP and join at least one (1) linux worker node.
We'll be installing CI services on a dedicated node in UCP
- Set environment variables and secrets
#VERSION of images
export VERSION=0.5.1
#HOSTNAME within swarm on which you want to pin the services. a single swarm work is recommended (HINT: get your desired hostname using `docker node ls`)
export HOSTNAME=<node_hostname>
#JENKINS_USERNAME
export JENKIN_USERNAME=admin
#Jenkins default username
echo $JENKIN_USERNAME | docker secret create jenkins-user -
#Jenkins password
read -s password && echo $password | docker secret create jenkins-pass -
#MySQL root password
read -s password && echo $password | docker secret create mysql-root-pass -
- Download compose file and deploy stack
wget https://raw.githubusercontent.com/BrandonRoyal/mta_ci/master/docker-compose.yml
docker stack deploy -c docker-compose.yml mtaci
- Browse to gogs app at
http://<hostname>:3000
, clickRegister
and register with your own username, email and password then login (NOTE: you will become the admin user by default)
- Create organization named
mta
-
Create new
Migration
using the following configurations:- Clone Address:
https://github.com/brandonroyal/mta_projecttemplate-linux
- Owner:
mta
- Repository Name:
app1
- Clone Address:
- Add Jenkins webhook by navigating to
app1 >> Settings >> Webhooks
and clickingAdd Webhook >> Gogs
-
Include the following information in your webhook.
Save
when complete.- Payload URL:
http://automation:8080/gogs-webhook/?job=mta
- Content Type:
application/json
- Payload URL:
- Clone
app1
repo to your working machine and change toapp1
directory
git clone http://<hostname>:3000/mta/app1.git
cd app1
- Build images
sh build.sh
- Set environment variables
export JENKINS_USERNAME=admin
export JENKINS_PASSWORD=password
- Deploy stack
sh deploy.sh
project
│
└───bootstrap
│ │ ...
│
└───configs
│ │ ...
│ └───automation
│ │ ...
│ └───git
│ │ ...
│
└───services
│ │ ...
│ └───automation
│ │ ...
│ └───git
│ │ ...
│ └───git_db
│ │ ...
Location for templated MTA PoC project structure. Include a working Jenkinsfile for automating builds
Configuration files for services used to preset the git (Gogs) and automation (Jenkins) services
Services for self contained MTA CI
Jenkins setup automation - Viktor Farcic (Docker Captain)