GarbageYard

Jenkins Shared Library error

Mar 13th, 2020
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. Jenkinsfile:
  2.  
  3. @Library('shared-library@dev')_
  4.  
  5. deployPipeline {
  6. jenkins_job_name = "${env.JOB_BASE_NAME}"
  7. workspace = "${env.WORKSPACE}"
  8. stream = "${env.DEPLOY_CONFIG}"
  9. environment = "${env.ENVIRONMENT}"
  10. }
  11.  
  12.  
  13. $ cat vars/deployPipeline.groovy
  14. def call(body) {
  15. def pipelineParams= [:]
  16. body.resolveStrategy = Closure.DELEGATE_FIRST
  17. body.delegate = pipelineParams
  18. body()
  19.  
  20. pipeline {
  21. stages {
  22. stage ('Info') {
  23. steps {
  24. echo "Job Name: ${pipelineParams.jenkins-job-name}"
  25. echo "Workspace: ${pipelineParams.workspace}"
  26. echo "Stream: ${pipelineParams.stream}"
  27. echo "Environment: ${pipelineParams.environment}"
  28. }
  29. }
  30. }
  31. }
  32. }
  33.  
  34.  
  35. Error:
  36. java.lang.NullPointerException: Cannot get property 'JOB_BASE_NAME' on null object
Add Comment
Please, Sign In to add comment