Skip to main content

CI-CD_003 - Jenkins_Parameterized_Builds

Parameterized Builds

Sometimes, it is useful/necessary to have your builds take several "parameters." Consider the following use case:
  • You set up a test job on Jenkins, and it accepts a distribution bundle as a parameter and perform tests against it. You want to have developers do local builds and let them submit builds for test execution on Jenkins. In such a case, your parameter is a zip file that contains a distribution.
  • Your test suite takes so much time to run that in normal execution you can't afford to run the entire test cycle. So you want to control the portion of the test to be executed. In such a case, your parameter is perhaps a string token that indicates that test suite to be run.
These parameters are available as environment parameters. For example like we use the variables in a Shell script. Here we will have two parameters to be specified which are
1. Name
2. Default Value
If we are using any Shell script for our build and we have some variables need to be specified as arguments for the script then we need to keep the calling name of the variable as "Name" for the build and if we need to use default values for that we can specify those in the "Default Value" column. Or else we need to provide the value while running a build. Those values will be directly assigned to the variable parameters which will be used in the script.
For having our project to use parameters we need to do the following.
After the Project name and Description we'll have a check box "This build is parameterized". We need to check that box enabled to run parameterized builds. Now we need to provide the name and default value to be used within the project.

Comments

Popular posts from this blog

Tomcat - Basic Clustering

Tomcat - Basic Clustering Till now we have 1 tomcat instance running and now we'll learn how to loadbalance multiple tomcat instances. For this let us have another tomcat instance configured first. Go to the  /opt  directory and copy  tomcat8  to  tomcat8-n2 # cp -prv tomcat8 tomcat8-n2 Now we know that we are using some ports for tomcat say 8080, 8005, 8009 For our additional tomcat instance we need to change the ports. If we don't then we might need to experience port conflict I am going to edit  server.xml  config file in the new node and increment the port numbers by 1 # cd /opt/tomcat8-n2/conf/ # vi server.xml 8005 -> 8006 8080 -> 8081 8443 -> 8444 8009 -> 8010 Now you need to add your new Catalina home, base and temp directories First you need to change the  catalina.sh  script and redirect the above 3 variables to the new variables Edit the  catalina.sh  script and add the following lines # vi...

CI-CD_004 - Git with Jenkins

Integrating Git with Jenkins If we are dealing with some specific code based builds where the code doesn't need any modification can be directly used for a build. But in some cases the code need to be changed several times depending on the need. In such case the periodic builds need to have those modifications. We use SCM (Source Code Management) to overcome this situation. And instead of manually copying the code to the build we can integrate the repositories from the SCM tools with our Jenkins builds. Configuration Global Settings In the Configure System page, the Git Plugin provides the following options: Global Config user.name Value: if provided git config user.name is called before builds. This can be overridden by individual projects. Global Config user.email Value: if provided git config user.email is called before builds. This can be overridden by individual projects. Create new accounts base on author/committer's email: if checked, upon parsing of git c...

Tomcat 8 Environment Setup

Tomcat 8 Environment Setup We need to add the Environment setups to the universal profile file. Let us edit  /etc/profile  and add the below lines CATALINA_BASE=/opt/tomcat8 CATALINA_HOME=/opt/tomcat8 CATALINA_TMPDIR=/opt/tomcat8/temp JAVA_HOME=/opt/jdk8 JRE_HOME=/opt/jdk8