Posts

Showing posts from May, 2020

Jenkins Declarative Pipeline

Image
Sample Jenkins Declarative Pipeline def A = false def B = true pipeline { agent any tools { maven 'MVN' jdk 'JDK' } stages { stage('Build Stage') { steps { git "https://github.com/nishantautomationlabs/nal-junitmockito.git" sh "mvn -U clean compile install -DskipTests" echo 'Build Stage executed' } } stage('Unit Test Stage') { steps { sh "mvn -Dtest=MockitoExampleTest test" echo 'Unit Test Stage executed' } } stage('Master Stage'){ when{ branch 'master' } steps { echo 'run this stage only if its running on the master branch' } } stage('Conditional Stage') { when { ...

Jenkins Scripted Pipeline

Image
Sample Jenkins Scripted Pipeline node { stage "Git Pull" git "https://github.com/nishantautomationlabs/nal-junitmockito.git" echo "code pulled" stage "Run Declarative Pipeline" build "Declarative Pipeline" echo "Declarative Pipeline triggered" stage "print" for(int i = 0; i < 10; i++) { if(i % 2 == 0) { echo "Number " + i } } } Jenkins Configuration: Build History:

Hot to fix apt-get “The following signatures were invalid: KEYEXPIRED”

Image
Hot to fix apt-get “The following signatures were invalid:  KEYEXPIRED ” If you are trying to run  apt-get update on your ubuntu machine and seeing the error "The following signatures were invalid: KEYEXPIRED" you have come to the right place. The key expired error occurs when one or more existing key on your ubuntu machine has expired which is hindering the update. To fix this issue, you need to renew these keys. Here are the steps to renew an expired key Find the expired Key:  Run the below command which will list all the expired keys on your ubuntu machine. Make a note of all the keys.  sudo apt-key list | grep -A 1 expired Renew the expired Key:  Take the keys from the previous command output and replace the <KEY_ID> in te below command with that. Execute this command to renew the expired key. sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys <KEY_ID> Run apt-get update:  Now that you have renewed all the...