A Job in Jenkins can be scheduled for periodical builds in a declarative pipeline i.e. Jenkinsfile using a string in a cron-style syntax (with minor differences) defined in the triggers directive, for example triggers{cron(‘0 */3 * * *’)}. This note shows the examples of how to build Jenkins jobs and multi-branch pipelines periodically and how […]
jenkins
Jenkins: Reset Admin Password
If you have forgotten the Jenkins admin password and can’t log in to a Jenkins user interface (UI) as administrator, you can connect to a Jenkins server via SSH and reset the Jenkins admin password. The simplest solution is to completely disable security in /var/lib/jenkins/config.xml file, access the Jenkins UI omitting authentication and rest the […]
Jenkins: Default Password & Username
The first time you start Jenkins, the configuration is created along with the initial default administrator account. If for some reason you have skipped the user-creation step in the setup wizard, you can use the default admin username and password to access the Jenkins UI. The Jenkins default password is stored in the $JENKINS_HOME/secrets/initialAdminPassword file […]
Jenkins: Scan Multibranch Pipeline Without Build
If you click on the “Scan Multibranch Pipeline Now” link in the Jenkins dashboard to discover the new branches, by default, this will automatically trigger builds for all newly discovered branches. In this short note i am showing how to disable automatic job triggering during SCM scanning for the new branches.
Jenkins: Credentials Plugin – Decrypt Password
Jenkins credentials plugin hides secrets like passwords and SSH or API keys by encrypting them. Nevertheless these credentials can be decrypted and printed in a plain text. In this note i will show 2 ways of how to decrypt secrets masked by Jenkins credentials plugin.
Jenkins Pipeline: How to Define a Variable – Jenkins Variables
Variables in a Jenkinsfile can be defined by using the def keyword. Such variables should be defined before the pipeline block starts. When variable is defined, it can be called from the Jenkins declarative pipeline using ${…} syntax.
Jenkins Pipeline: Conditionally Define Variables – Groovy Script
The Groovy scripting language supports conditional structures, that can be used in Jenkins pipelines. Assume that you have a parametrized Jenkins job and in a Jenkinsfile you have a variable that should be defined depending on provided parameters. Here is an example of how to conditionally define variables in a Jenkins pipeline using the Groovy […]
Install Jenkins – Ubuntu, CentOS
What is Jenkins? Jenkins is a well-known open source CI/CD (Continuous Integration and Continuous Delivery) automation server written in Java. In this tutorial i will show how to install Jenkins on Ubuntu-18.04, 16.04 and Centos-7, 6 and how to perform initial Jenkins configuration. Jenkins requires Java, so firstly it needs to install OpenJDK-8 JRE/JDK (Java […]