- Feature_X is current feature
- Devel is integration
- Release is preproduction
- Master is production
- Master:tag X is release X
- Create new branch Feature_X from Devel
git checkout -b <current_feature>
- Work on the feature
- Run tests locally
- Commit often
git add <files>
git commit -m <message>
-
Merge often with Devel
- Fix conflicts, add files and commit.
- At least once each day
- Mandatory regression tests
- Mandatory integration test
- Optional image creation
- Optional end-to-end tests with containers
-
Merge with Release when the sprint finishes
- Mandatory image creation
- Mandatory integration tests
- Optional end-to-end tests with containers
-
Replace Master with Release
- Tag release branch with release number
- Merge with master
- Tag alias docker image with latest
git clone https://github.com/ciberado/picalculator
- surefire: unit testing, surefire:test
- failsafe: the rest, failsafe:integration-test
- maven-plugin: https://github.com/spotify/docker-maven-plugin
- With docker:
docker build --tag capside/picalculator:0.0.3 .
- With maven:
mvn clean package docker:build
- Jenkins in a container is GOOD
- A container using Docker is BAD
- A container working with external Docker [is FINE]
FROM jenkins:1.651.1
USER root
RUN wget -qO- https://get.docker.com/ | sh
RUN apt-get update \
&& apt-get install -y sudo \
&& rm -rf /var/lib/apt/lists/*
RUN echo "jenkins ALL=NOPASSWD: ALL" >> /etc/sudoers
USER jenkins
COPY plugins.txt /usr/share/jenkins/plugins.txt
RUN /usr/local/bin/plugins.sh /usr/share/jenkins/plugins.txt
docker run -it -rm -v /var/run/docker.sock:/var/run/docker.sock custom-jenkins /bin/bash
$> sudo docker ps
$> exit
docker run -d --name jenkins \
-v /var/run/docker.sock:/var/run/docker.sock \
-p 8080:8080 -p 50000:50000 \
custom-jenkins
- Jenkins admin -> System configuration
- Install java
- Instal Maven (Beware! 3.5 is NOT compatible)
- Jenkins admin -> Install plugins
- Git plugin
- Credentials (maybe already installed)
- Credentials Binding
- Plain Credentials
- Reboot
- Credentials -> Global -> Add credentials
- Kind=Secret text, Scope=Global, Secret=, Id=dockerpassword
- Credentials -> Global -> Add credentials
- Kind=Secret text, Scope=Global, Secret=, Id=dockerusername
- Type: maven
- Git: https://github.com/ciberado/picalculator
- Check use secret text
- Binding añadir secret text: variable=dockerpassword, credentials=dockerpassword
- Binding añadir secret text: variable=dockerusername, credentials=dockerusername
- Goals: clean package
- Post build (only if successful build):
sudo docker login -u $dockerusername -p $dockerpassword
sudo docker build -t $dockerusername/pi:$POM_VERSION .
sudo docker push $dockerusername/pi:$POM_VERSION
- Save & Build now
- Test with
docker run -it -p 8081:8080 capside/pi:0.0.3-SNAPSHOT