Closed DaRosenberg closed 4 years ago
@DaRosenberg
My preferred solution would be for the stack parameter to remain required, and we add a stack init command to the task, that uses this parameter for the stack init, but does not try to do the select first. Such a stack init command could then also “swallow” the error that occurs if the stack already exists. Something we would otherwise need to do in the pipeline.
Yes, this is what I was originally thinking too. However, I think explicitly asking the user to select a checkbox that indicates to the task that they would like the stack to be created if it does not exist might be a better way. I am only saying that because, if the user makes a mistake and didn't run the Pulumi task in the correct working directory, the stack select
error would be misinterpreted and a new stack would be created unnecessarily. Having the checkbox could alleviate this, so that the user knows what they are doing and explicitly desire having the stack created. I am curious to hear your thoughts on that.
@praneetloke your suggestion is even better. It would certainly solve our scenario, and it does sound much cleaner. 👍
facing same issue. any change to get this fixed soon?
@DaRosenberg @swoop-alex I just opened #36 to address, could you please take a look at the screenshot in that PR and let me know what you think?
LGTM
@praneetloke Looks good! Personally I would have put the checkbox in connection with the stack name text box (even if it's not used by most) but I can understand your reasoning for tucking it away.
@swoop-alex @DaRosenberg this is now available with the v1.0.6 of the task extension. It typically takes a few minutes for the Az Pipelines build agents to pick-up the new version, after the release is available in the marketplace.
We need a way to create a new stack as part of a DevOps pipeline. The stack name could for example be input using a user-configurable pipeline variable, or it could be the name of the branch that triggered the build.
I.e. use this task to initialize a new stack if it does not already exist.
The obvious thing to try is to set
command: stack
andoptions: init $(StackName)
in the YAML.However, the
Pulumi@1
task has a mandatory stack parameter, and the task always tries to select that stack the first thing it does, before it proceeds to execute the actual command, which of course results in an error because the stack does not yet exist.I can see two solutions:
My preferred solution would be for the
stack
parameter to remain required, and we add astack init
command to the task, that uses this parameter for the stack init, but does not try to do the select first. Such astack init
command could then also “swallow” the error that occurs if the stack already exists. Something we would otherwise need to do in the pipeline.Alternatively, the
stack
parameter could be made optional to allow for astack init
to be executed through the existingstack
command.