ITTONE Création des applications Web

java – Jenkinsfile: pass env from another script

Consider a folder with two jenkins files, JenkinsfileA and JenkinsfileB.

# JenkinsfileA

node {
    environment {
        APP_NAME = 'APPLICATION_A'
    }

    # Load the other jenkins file
    load `JenkinsfileB'
}

#JenkinsfileB

node{
   echo "Got parameter $APP_NAME"
}

In B, the $APP_NAME param is coming up null. What is the canonical way to pass APP_NAME parameter from A into B? Should I be using load here or something else? Are env vars. preferred or can we make use of parameters somehow?


Unreleated: is node still the correct directive to use to ensure builds run on any agent, or should I be using pipeline{ agent: any}? Got node from this article

Product of the Month September 2016

Source link

Leave a Comment

Your email address will not be published.

For Developers


Apply to remote US software jobs from the comfort of your home

Join a network of the world's best developers & get full-time, long-term remote software jobs with better compensation and career growth.

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

ITTone will use the information you provide on this form to be in touch with you and to provide updates and marketing.