java – Jenkinsfile: pass env from another script

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

# JenkinsfileA

node {
    environment {

    # Load the other jenkins file
    load `JenkinsfileB'


   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. Required fields are marked *