pulumi / pulumi-az-pipelines-task

Azure Pipelines task extension for running Pulumi apps.
https://marketplace.visualstudio.com/publishers/pulumi
Apache License 2.0
27 stars 19 forks source link

Stack outputs to variables #60

Open JasonWhall opened 3 years ago

JasonWhall commented 3 years ago

Currently there is not an easy way to get a stack output using the pulumi task and re-using the output value in other steps in the pipeline.

This feature would be beneficial to have as we could have infrastructure creation using the pulumi task and then use these outputs as variables in other subsequent tasks, like kubectl or azure-cli.

This would require running pulumi stack output with the `--json flag and then iterate the key, value pairs setting variables with the results.

An additional option may also need to be surfaced to include secrets.

RobbieMcKinstry commented 2 years ago

I'm curious to explore this. It's possible my effort might get redirected to another ticket, but this request sounds like something we would be interested in tackling.

sloncho commented 2 years ago

@RobbieMcKinstry any progress on this? We badly need it :)

RobbieMcKinstry commented 2 years ago

@sloncho this issue is somewhat related to https://github.com/pulumi/pulumi-az-pipelines-task/issues/87 in that both issues require us to add a "post-execution" step. @praneetloke has been working on #87 here and we're going to roll it out soon, effectively unblocking this issue.

I'm not sure if this issue itself has been slated or not. I'm checking with my manager to see if it's on the docket. I'll get back to you shortly.

sloncho commented 2 years ago

@RobbieMcKinstry thanks for the update. The way I see it - #87 can be secondary actually - as if this here is implemented, it will already has the json output. Then #87 can addressed to use this output. Of course, you guys know better your priorities. :)

Thinking more about it - parsing the outputs to a variables can be challenging - at least from naming stand point. But exporting the "stack outputs --json --include-secrets" as a single variable is more than enough for us to be able to parse it afterwords.

I'm willing to contribute. Is there a contrib guide?

RobbieMcKinstry commented 2 years ago

Hi @sloncho,

Thanks for offering to contribute. I'm afraid there's no contributor guide for this repo yet, apologies! Here's a link to the guide for the GitHub Actions repo (only the first section is relevant, you can ignore anything about the Release process!). and here's a link to the Pulumi Contributor guide for our largest repo, github.com/pulumi/pulumi and our Code of Conduct.

But exporting the "stack outputs --json --include-secrets" as a single variable is more than enough for us to be able to parse it afterwords.

Personally, I think that feature would make sense to add. Happy to accept a contributoion. Out of curiosity, could you explain your use case?

RobbieMcKinstry commented 2 years ago

I opened a PR for a contributor guide here. Most of the practical information for running the repo is in the README, however.