I have a use case where one step of drone pipeline prints the certain strings in the drone console logs, i want to capture that string from logs and consume that in later pipeline steps.
What is the possible way to pass on information(this is dynamic information) from one pipeline step to other?
March 1, 2018, 2:46pm
You could write to a file in the
/drone directory and read it in the next step, is a shared space between steps.
March 2, 2018, 9:44am
@jhernandez suggested, the workplace is shared between builds.
But - what is the process that outputs the string you need?
Maybe the better idea is to generate it on the same stage that requires it?
If you share what you are trying to do maybe others can suggest better solutions.
@jhernandez for the udpate, you mean to say this /drone directory which will be available to pipeline steps like workspace? and this apart from the workspace correct or same?
@omerxx for the update.
Actually, we are using one drone plugin not managed by us, does some particular task, and while executing it prints certain strings onto drone web pipeline/build console. so we want to capture all of those required strings and use them in the later pipeline steps.
March 3, 2018, 6:16pm
I understood that from you first message, but - what are these strings?
perhaps there’s a better way of extracting them. or maybe you can clone the plugin souce code and add your desired behaviour.
Strings would be key value pairs name=value or name:value, tell me one more thing can we set env variables from one pipeline step to be used by later steps?
This could be th approach to share dynamic data between steps.
can we set env variables from one pipeline step to be used by later steps?
This is not possible. If you want to maintain state between steps you need to write to disk. If you are using a plugin, you will need to either:
ask the plugin authors to optionally read variables from disk OR
fork the plugin and publish your own version that can read variables from disk
March 3, 2018, 9:21pm
@sandeepsharma Another option - publish the key-value pairs to an external more secure resource e.g Vault / Database / or even Drone secrets