How to pass params between job steps?
I need to get current project version from pom.xml on build stage, and pass it to dockePush stage
in docs was found this:
Sometimes it is enough to pass a string from one Automation step to another, for example, an access token, command-line arguments, and so on. In this case, you can use sharing of parameters .
but have no page where it should be described
help me plz
was try like this:
var projectGroupId = "__projectGroupId"
var projectArtefactId = "__projectArtefactId"
var projectVersion = "__projectVersion"
host {
kotlinScript {
val pom = File("pom.xml")
val mapper = XmlMapper()
val pomObject = mapper.readTree(pom)
projectGroupId = pomObject["groupId"].asText()
projectArtefactId = pomObject["artifactId"].asText()
projectVersion = pomObject["version"].asText()
println("$projectGroupId.$projectArtefactId-$projectVersion") // HERE IS VALUES FROM POM.XML
}
}
container(displayName = "Deploy maven package", image = "maven:3-openjdk-11-slim") {
shellScript {
// BUT HERE IS DEFAULT VALUES
content = """
echo $projectGroupId
echo $projectArtefactId
echo $projectVersion
""".trimIndent()
}
}
Please sign in to leave a comment.
Hello,
Right now, there is no elegant way to do that, but the approach of using a file share should do the trick. Here is the related documentation with an example https://www.jetbrains.com/help/space/sharing-execution-context.html#accessing-file-share-directly
Another option is to enable the related feature flag for your Space organization since we have a new and much more simple mechanism under internal testing. Although it is pretty stable, anyway, it is always some risk in the early stages. So please let me know if you would like to try this new feature (in this case, I will need to know the name of your Space organization). It will allow you to write your code in the following way:
Looking forward to hearing from you soon!
That's really what i need! Plz turn on it's for me. How i can provide my Space org sensitively?
And its will be super cool, if u add this "last lambda parameter API" with ```api.parameters``` feature (and all other API features), after extension lambda of builder - everywhere. Such as it realized in ```kotlinScript```.
I mean something like this:
In general, i need a possibility to have common context, for all pipeline, and pass params form/to shellScript and other strings