Passing data between build steps in Jenkins

后端 未结 8 1796
臣服心动
臣服心动 2020-12-31 00:09

I\'d like to do something along the lines of:

This is overly simple and just demonstrates what I\'d like to do. Basically, I want to be able to store and access vari

8条回答
  •  一生所求
    2020-12-31 00:34

    One thing remains between shells: the workspace.
    Simple and stupid solution: use file(s)!

    Huge additional advantage: it works when you split your job in several jobs and use the Clone Workspace plugin

    Build Step #1 - Execute shell

    START=timestamp
    ...
    echo $START > env_start.txt
    

    ...

    Build Step #3 - Execute Shell

    START=`cat env_start.txt`
    END=timestamp
    TIME_LAPSED=$END-$START
    

提交回复
热议问题