Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

jenkinfile.sh

    pipeline {

      agent any
      stages{
        stage("Checkout") {
            steps {
                    dir('def exists = fileNotExists 'git'') {
                      bat label: '', script: 'sh "mkdir.sh'
                    }
                    dir ('cm') {
                        git branch: 'dev',
                        credentialsId: '<your credential id>',
                        url: '<yours git url>'
                    }
                }
            } //End of Checkout stage
        stage("TestShellScript") {
            steps {
                bat label: '', script: 'sh "PrintNumber.sh"'
            }
          }
        }//End of stages
    } // End of pipeline


Note: cat mkdir.sh
#!/bin/bash
#Create a directory
mkdir git
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
8+8 =