jenkinsci / jenkinsci/workflow-basic-steps-plugin
[JENKINS-32982] cross-build state
- Dominant language
- Java
- Stars
- 73
- Forks
- 129
- PR merge metrics
- No merged PRs in 30d
Description
Sometimes it is desirable for a Pipeline script to save and retrieve some state (data) which is persisted across builds.
Possibly could be supported using a plugin which defined a Map-valued global variable made accessible to every Pipeline script which would serialize any values you set to it to a per-job location. (Could even have a variable which held per-master state, though you then need to be careful about access control policies.)
As a workaround, for non-sandboxed jobs, you could use java.io.File calls to read/write a file on the Jenkins master. For example
File f = new File(currentBuild.rawBuild.parent.rootDir, 'my-state')
---
Originally reported by
jglick, imported from: cross-build state
jglick
Raw content of original issue
Sometimes it is desirable for a Pipeline script to save and retrieve some state (data) which is persisted across builds.
Possibly could be supported using a plugin which defined a Map-valued global variable made accessible to every Pipeline script which would serialize any values you set to it to a per-job location. (Could even have a variable which held per-master state, though you then need to be careful about access control policies.)
As a workaround, for non-sandboxed jobs, you could use java.io.File calls to read/write a file on the Jenkins master. For example
File f = new File(currentBuild.rawBuild.parent.rootDir, 'my-state')
Contributor guide
Assessment
This issue has not been assessed yet.