Jenkins is an open source automation server written in Java. Jenkins helps to automate the non-human part of the software development process, with continuous integration and facilitating technical aspects of continuous delivery.
Initial release: 2 February 2011.
Repository: https://github.com/jenkinsci/jenkins
To download:
https://jenkins.io/download/
===
Setup proxy if any:
Jenkins - Manager Jenkins - Manage Plugins
http://localhost:8080/pluginManager/advanced
testurl: http://www.googe.com
===
Setting the mavan and jdk instalations:
Jenkins - Manager Jenkins - Global Tool Configurations
http://localhost:8080/configureTools/
Global Maven_OPTS
–Xmx512m
–XX:MaxPermSize=128m
===
Create new item: give your project name: test
and select freestyle project
http://localhost:8080/job/test/configure
Build -
select top-level maven targets
Maven version: maven(selected added plugin)
Golas: clean install -Dbuild.number=${BUILD.NUMBER} ex: add if any additional properties
Go to Advanced:
add pom file path: project path
save
===
Add the pom file below configurations:
<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> <spring-cloud.version>Edgware.RELEASE</spring-cloud.version> <build.manifest.section>Build Details</build.manifest.section> <build.number>UNKNOWN</build.number> <jenkins.build.number>${build.number}</jenkins.build.number> </properties> .... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifestEntries> <Build-Time>${maven.build.timestamp}</Build-Time> </manifestEntries> <manifestSections> <manifestSection> <name>${build.manifest.section}</name> <manifestEntries> <Implementation-Version>${project.version}</Implementation-Version> <Implementation-Build-Number>${build.number}</Implementation-Build-Number> </manifestEntries> </manifestSection> </manifestSections> </archive> </configuration> </plugin> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <includeSystemScope>true</includeSystemScope> </configuration> <executions> <execution> <goals> <goal>build-info</goal> </goals> <configuration> <additionalProperties> <name>${build.manifest.section}</name> <Implementation-Version>${project.version}</Implementation-Version> <Implementation-Build-Number>${jenkins.build.number}</Implementation-Build-Number> </additionalProperties> </configuration> </execution> </executions> </plugin> </plugins> </build>Jenkins properties:
http://localhost:8080/env-vars.html/
The following variables are available to shell scripts
BUILD_NUMBER
The current build number, such as "153"
BUILD_ID
The current build ID, identical to BUILD_NUMBER for builds created in 1.597+, but a YYYY-MM-DD_hh-mm-ss timestamp for older builds
BUILD_DISPLAY_NAME
The display name of the current build, which is something like "#153" by default.
JOB_NAME
Name of the project of this build, such as "foo" or "foo/bar".
JOB_BASE_NAME
Short Name of the project of this build stripping off folder paths, such as "foo" for "bar/foo".
BUILD_TAG
String of "jenkins-${JOB_NAME}-${BUILD_NUMBER}". All forward slashes ("/") in the JOB_NAME are replaced with dashes ("-"). Convenient to put into a resource file, a jar file, etc for easier identification.
EXECUTOR_NUMBER
The unique number that identifies the current executor (among executors of the same machine) that’s carrying out this build. This is the number you see in the "build executor status", except that the number starts from 0, not 1.
NODE_NAME
Name of the agent if the build is on an agent, or "master" if run on master
NODE_LABELS
Whitespace-separated list of labels that the node is assigned.
WORKSPACE
The absolute path of the directory assigned to the build as a workspace.
JENKINS_HOME
The absolute path of the directory assigned on the master node for Jenkins to store data.
JENKINS_URL
Full URL of Jenkins, like http://server:port/jenkins/ (note: only available if Jenkins URL set in system configuration)
BUILD_URL
Full URL of this build, like http://server:port/jenkins/job/foo/15/ (Jenkins URL must be set)
JOB_URL
Full URL of this job, like http://server:port/jenkins/job/foo/ (Jenkins URL must be set)
References:
http://www.tothenew.com/blog/how-to-setup-jenkins-for-a-maven-project/
https://en.wikipedia.org/wiki/Jenkins_(software)
https://tedvinke.wordpress.com/2013/04/20/using-jenkins-build-version-with-maven/
http://akeffalas.github.io/blog/2014/04/jenkins-build-info-maven-artifacts.html
https://www.baeldung.com/spring-boot-info-actuator-custom
https://www.vojtechruzicka.com/spring-boot-version/
No comments:
Post a Comment
I'm certainly not an expert, but I'll try my hardest to explain what I do know and research what I don't know.