wanderors
wanderors

Reputation: 2292

Is it possible to have multiple jenkinsfile and custom name for jenkinsfile

My whole scripts are in one branch of repo and I have multiple jenkins pipeline job.

1. smoke
2. Regression
3. Epic wise Execution

each have a different pipeline script. So is it possible to have multiple jenkins file with custom name ?

pipeline {
    node('Slave-Machine-1') {
        env.NODE_HOME="${tool '8.9.4'}"
        env.PATH="${env.NODE_HOME}/bin:${env.PATH}"
        def AUTO = ''

        stage("Install Dependency") {
            sshagent(['agent-id']) {
                sh 'npm install'
                sh 'npm run webdriver-install'
            }
        }

        stage("smoke") {
            sh 'npm run smoke-test'
        }
    }
}

This is my sample pipeline script. similarly i have multiple pipeline scripts

Upvotes: 1

Views: 1488

Answers (1)

Dibakar Aditya
Dibakar Aditya

Reputation: 4203

You can name your pipeline scripts random_joe or anything you like as long as:

  • You do not use multibranch or organization pipeline projects, which specifically look for the filename Jenkinsfile to automatically create new jobs
  • You do not mind your text editor not syntax highlighting the pipeline scripts until you add the extension .groovy to them

It is advisable to follow conventions wherever not impracticable though.

Upvotes: 3

Related Questions