Monday, 23 October 2017
Learn Deutsche - German verbs : Set 1
Folks, from today onwards, am also starting a new series of posts specifically dedicated to the German vocabulary. The objective would be to make it easier to memorize German words with their equivalent English meanings, thereby enriching your German vocab. Each time, we will take only small batches of 10 random words and/or verbs to enhance and ease the memorization process.
In today's beginner level list let us check 10 random verbs which would be useful in our day-to-day conversation.
fragen : to ask
finden : to find
sehen : to see
arbeiten : to work
studieren : to study
spielen : to play
gehen : to go
wissen : to know
kommen : to come
sagen : to say
In next post, we will look into another fresh batch of word list with 10 new verbs and/or words. Until then, happy learning! Tschüss!
In today's beginner level list let us check 10 random verbs which would be useful in our day-to-day conversation.
fragen : to ask
finden : to find
sehen : to see
arbeiten : to work
studieren : to study
spielen : to play
gehen : to go
wissen : to know
kommen : to come
sagen : to say
In next post, we will look into another fresh batch of word list with 10 new verbs and/or words. Until then, happy learning! Tschüss!
How to chain jobs in Jenkins using Parameterized trigger plugin
In Jenkins, sometimes we may need to trigger multiple jobs in a particular sequence, each performing some unique task. For instance let us consider a scenario, where we have one parent job to perform a maven build of a Java based project. We also have 2 separate child jobs for packaging - let's say one creates a Windows installer and the 2nd one which creates a Linux installer. Now, we want to automatically trigger the packaging jobs immediately after the build is finished. The Parameterized Trigger plugin helps us exactly to achieve the same. Using this, we can chain multiple jobs and pass parameters across them.
Let us consider the above scenario in some more detail.
Firstly, make sure the Parameterized Trigger plugin is installed in Jenkins.
Now, as said above I have one parent job which essentially performs a maven build of a Java based project. Once the build is finished, I want to trigger 2 child jobs - one which creates a Windows package and the other which creates a Linux package. In our case, we have the version 2.31 installed. Latest versions are available periodically.
Now, lets configure the chaining of packaging child job within the parent job i.e Maven build job. While doing so, I want to a bunch of pre-defined parameters across the build. For eg: I want to pass the build version and the location of Clearcase build view. The parameters could be either a constant variable or an environment variable.
Make sure to tick the option "This build is parameterized" and add a few parameters as desired.
Now add a new build step "Trigger/call builds on other projects" from the list.
Now all you have to do is mention the child build that you want to fire and the list of specific pre-defined parameters that you want to pass to it. Check the screenshot below for illustration.
Here we are passing 2 parameters - version and path_loc. Kindly note the syntax. Note that these 2 parameters need to be defined in both the parent and child jobs. In case you do not want to pass all the current build parameters instead of specific ones, simple choose the "Current build parameters" from the "Add Parameter dropdown list."
Alternatively, you could also pass the parameters from a specific properties file as well by specifying its location.
Ciao guys. Drop in your comments for any suggestions, questions or queries please. Grazie!
Let us consider the above scenario in some more detail.
Firstly, make sure the Parameterized Trigger plugin is installed in Jenkins.
Now, lets configure the chaining of packaging child job within the parent job i.e Maven build job. While doing so, I want to a bunch of pre-defined parameters across the build. For eg: I want to pass the build version and the location of Clearcase build view. The parameters could be either a constant variable or an environment variable.
Make sure to tick the option "This build is parameterized" and add a few parameters as desired.
Now add a new build step "Trigger/call builds on other projects" from the list.
Now all you have to do is mention the child build that you want to fire and the list of specific pre-defined parameters that you want to pass to it. Check the screenshot below for illustration.
Ciao guys. Drop in your comments for any suggestions, questions or queries please. Grazie!
Wednesday, 18 October 2017
How to open specific port in firewall in CentOS Linux
Guys, if your organization is behind a firewall, the networking team usually takes care that most unused ports are blocked, unless absolutely necessary. In some cases, you may want to add an exception to the firewall rules though, to open up a specific port to allow incoming and outgoing network traffic.
In today's example, we may want to open up a port 8080 to allow TCP connections for instance. Note that these commands are specifically for the CentOS flavor of Linux. Other flavors of Linux may have different command syntax. Please check accordingly.
Firstly view the existing firewall rules using the following command
firewall-cmd --list-all
Output (Old rules):
public (default, active)
interfaces: en0
sources:
services: dhcpv6-client ssh
ports: 9005/tcp
masquerade: no
forward-ports:
icmp-blocks:
rich rules:
As you see from the existing rules, it seems that port 9005 is open. Now let us add the port 8080 to the firewall rules using the below command. If the command is executed fine, it will display "success". Make sure to reload firewall configuration to bring the new rules into effect.
firewall-cmd --zone=public --add-port=8080/tcp --permanent
success
firewall-cmd --reload
success
In order to view the double check the firewall rules, again use the --list-all command.
firewall-cmd --list-all
Output ( Updated rules):
public (default, active)
interfaces: en0
sources:
services: dhcpv6-client ssh
ports: 8080/tcp 9005/tcp
masquerade: no
forward-ports:
icmp-blocks:
rich rules:
In today's example, we may want to open up a port 8080 to allow TCP connections for instance. Note that these commands are specifically for the CentOS flavor of Linux. Other flavors of Linux may have different command syntax. Please check accordingly.
Firstly view the existing firewall rules using the following command
firewall-cmd --list-all
Output (Old rules):
public (default, active)
interfaces: en0
sources:
services: dhcpv6-client ssh
ports: 9005/tcp
masquerade: no
forward-ports:
icmp-blocks:
rich rules:
As you see from the existing rules, it seems that port 9005 is open. Now let us add the port 8080 to the firewall rules using the below command. If the command is executed fine, it will display "success". Make sure to reload firewall configuration to bring the new rules into effect.
firewall-cmd --zone=public --add-port=8080/tcp --permanent
success
firewall-cmd --reload
success
In order to view the double check the firewall rules, again use the --list-all command.
firewall-cmd --list-all
Output ( Updated rules):
public (default, active)
interfaces: en0
sources:
services: dhcpv6-client ssh
ports: 8080/tcp 9005/tcp
masquerade: no
forward-ports:
icmp-blocks:
rich rules:
As you see the port 8080 has been added to the list i.e it has been opened up.
Tuesday, 10 October 2017
How to automate Jenkins config backup
In today's post on Jenkins, let us learn how to take regular backups of our Jenkins environment configuration. There are a bunch of plugins out there which can help take thin and/or thick backups. But in our post we learn to take backups using a custom batch script.
We write a simple batch file which recursively takes backup of all Jenkins jobs and saves them in the destination directory. Later we set up a Windows scheduler job to execute this batch file daily.
rem IroncladZone
echo OFF
set today=%DATE:~7,2%%DATE:~4,2%%DATE:~10,4%
set url=http://17.16.18.14:8080/jenkins/
set dest_dir=C:\Jenkins_Jobs_backup\
cd /d "C:\Program Files (x86)\Jenkins\jobs"
FOR /D %%i IN (*) DO (
echo "Backing up %%i.xml"
"C:\Program Files\Java\jdk1.8.0_45\bin\java" -jar jenkins-cli.jar -s %url% get-job "%%i" > "%dest_dir%/%%i_%today%.xml"
echo "Successfully backup %%i.xml"
)
Note for taking backups, we use Jenkins' command line utility i.e jenkins-cli.jar. With this we save the Jenkins job configuration .xml file at the destination folder. Note that we append this .xml file name with today's date time-stamp so that we could easily identify it later.
Now all we have to do is set a Windows task scheduler job which runs this batch file to take backups at say 12:00 noon daily.
Hope it helps folks. Ciao!
We write a simple batch file which recursively takes backup of all Jenkins jobs and saves them in the destination directory. Later we set up a Windows scheduler job to execute this batch file daily.
rem IroncladZone
echo OFF
set today=%DATE:~7,2%%DATE:~4,2%%DATE:~10,4%
set url=http://17.16.18.14:8080/jenkins/
set dest_dir=C:\Jenkins_Jobs_backup\
cd /d "C:\Program Files (x86)\Jenkins\jobs"
FOR /D %%i IN (*) DO (
echo "Backing up %%i.xml"
"C:\Program Files\Java\jdk1.8.0_45\bin\java" -jar jenkins-cli.jar -s %url% get-job "%%i" > "%dest_dir%/%%i_%today%.xml"
echo "Successfully backup %%i.xml"
)
Note for taking backups, we use Jenkins' command line utility i.e jenkins-cli.jar. With this we save the Jenkins job configuration .xml file at the destination folder. Note that we append this .xml file name with today's date time-stamp so that we could easily identify it later.
Now all we have to do is set a Windows task scheduler job which runs this batch file to take backups at say 12:00 noon daily.
Hope it helps folks. Ciao!
LDAP authentication for SonarQube 5.6
Guys, if your project uses SonarQube for analyzing and improving the code quality, this is the post you should be interested in. In this post, we look into how to configure the organization-specific LDAP settings for SonarQube version 5.6
First of all, before we proceed, in order to enable LDAP authentication in SonarQube, you will have to install the LDAP plugin from the update center. In this illustration, we have the LDAP plugin version 1.4 installed. Newer versions of the plugin will be available periodically.
Now, navigate through your SonarQube installation directory => conf folder to find the sonar.properties file.
In this file, you'll able to configure LDAP details to enable LDAP user authentication. In case you're not aware of the specific credentials, kindly check the same from an authorized administrator.
A sample illustration below will give you the look and feel of how the LDAP settings should look like.
#-------------------------------------------------------------------------------------------------
# LDAP related settings
sonar.security.realm=LDAP
sonar.security.updateUserAttributes=false
ldap.url=ldap://17.16.10.14:389
ldap.bindDn=CN=BUILDER,OU=USERS,OU=AdminPRivilege,DC=company,DC=com
ldap.bindPassword=ldap-password-here
ldap.user.baseDn=dc=company,dc=com
ldap.user.request=(&(sAMAccountName={login}))
Note that the above values are just an example and will vary for each organization. For more information, kindly check the LDAP plugin page here.
First of all, before we proceed, in order to enable LDAP authentication in SonarQube, you will have to install the LDAP plugin from the update center. In this illustration, we have the LDAP plugin version 1.4 installed. Newer versions of the plugin will be available periodically.
Now, navigate through your SonarQube installation directory => conf folder to find the sonar.properties file.
In this file, you'll able to configure LDAP details to enable LDAP user authentication. In case you're not aware of the specific credentials, kindly check the same from an authorized administrator.
A sample illustration below will give you the look and feel of how the LDAP settings should look like.
#-------------------------------------------------------------------------------------------------
# LDAP related settings
sonar.security.realm=LDAP
sonar.security.updateUserAttributes=false
ldap.url=ldap://17.16.10.14:389
ldap.bindDn=CN=BUILDER,OU=USERS,OU=AdminPRivilege,DC=company,DC=com
ldap.bindPassword=ldap-password-here
ldap.user.baseDn=dc=company,dc=com
ldap.user.request=(&(sAMAccountName={login}))
Note that the above values are just an example and will vary for each organization. For more information, kindly check the LDAP plugin page here.
Wednesday, 4 October 2017
How to generate report to list unused dependencies in Maven
In this post, we will see how to generate a report to list the unused dependencies of a Java project built using Maven.
We will use the dependency plugin to do so. Let's use the dependency:analyze-report goal as below
mvn dependency:analyze-report -DignoreNonCompile=true
This will basically generate an HTML report containing the list of dependencies with the following classification :
Ideally, it's always a good idea to cleanup the pom's by removing and/or commenting the unused but declared dependencies.
We will use the dependency plugin to do so. Let's use the dependency:analyze-report goal as below
mvn dependency:analyze-report -DignoreNonCompile=true
This will basically generate an HTML report containing the list of dependencies with the following classification :
- used and declared.
- used and undeclared.
- unused and declared.
Ideally, it's always a good idea to cleanup the pom's by removing and/or commenting the unused but declared dependencies.
Subscribe to:
Posts (Atom)