griddynamics / mpl

[IT-36925] Jenkins Shared Modular Pipeline Library
https://blog.griddynamics.com/developing-a-modular-pipeline-library-to-improve-devops-collaboration/
Apache License 2.0
156 stars 97 forks source link

[Q] Passing variables between stages #69

Closed sparshev closed 4 years ago

sparshev commented 4 years ago

Hi, I started using the libraries, But If I want some variables from one stage to another stage How can it be done?

Originally posted by @yamsivakumarreddy in https://github.com/griddynamics/mpl/issues/58#issuecomment-617623927

sparshev commented 4 years ago

@yamsivakumarreddy, please don't post the offtopic questions. Answer on your question is simple - MPLModule supports OUT interface, please check README doc here and this question: #66

yamsivakumarreddy commented 4 years ago

Hi @sparshev I am getting the below error when I use OUT in checkout.groovy

groovy.lang.MissingPropertyException: No such property: OUT for class: groovy.lang.Binding

-->checkout.groovy def version = MPLModule('Default Checkout').'artifact.version' echo "${version}" OUT.'artifact_info.artifact.version' = version --> defaultcheckout.groovy gitInfo = checkout scm OUT.'artifact.version' = 1 --> pipeline stage( 'Checkout' ) { when { expression { MPLModuleEnabled() } } steps { echo "in checkout step" MPLPipelineConfigMerge(MPLModule('Checkout').artifact_info) } }

sparshev commented 4 years ago

What the version of MPL you're using? OUT was added to master branch in the PR #46

sparshev commented 4 years ago

Hopefully the question was answered.

yamsivakumarreddy commented 4 years ago

@sparshev thanks for your patience, it worked very well :) I upgraded from jenkins shared libraries to MPL.