I can't move to that version yet and so I set it up to load the script by hand:
def notify
stage "Load-Scripts"
node() {
git branch: 'master', changelog: false, credentialsId: 'ID', poll: false, url: 'https://github.company.com/my-organization/my-repository.git'
notify = load 'src/com/aa/jenkins/pipeline/notify.groovy'
notify.notifySlack("START")
}
The above code goes in the Jenkinsfile at the top, before any other stages. You will, of course have to put in your own credentials and branch and so forth, the Pipeline Snippets tool might be handy in doing that line.
Some things ...
The variable into which we store the class created by loading the one groovy file has to be defined with the 'def' and without a type. This makes it into a global variable that can be used outside the scope in which we do the load.
The path to the groovy file is in the context of the root of the git workspace.
You may need a node name inside the parentheses.
No comments:
Post a Comment