Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter or variable of type object or list that can be set from a script #567

Open
anilsamuel opened this issue Jun 1, 2022 · 5 comments
Labels
Area: Yaml question Further information is requested

Comments

@anilsamuel
Copy link

anilsamuel commented Jun 1, 2022

Hooping to do something similar but looking for a way to set the list value of parameters.StackNames using command below prior to Delete ${{ stack }}

aws cloudformation describe-stacks --query "[].StackName)"

parameters:
- name: stackNames
  type: object

steps:
- ${{ each stack in parameters.stackNames }}:
  - task: AmazonWebServices.aws-vsts-tools.AWSShellScript.AWSShellScript@1
      displayName: Delete ${{ stack }}
      inputs:
        awsCredentials: ${{ parameters.awsCredentials }}
        regionName: $(region)
        scriptType: inline
        inlineScript: |
           aws cloudformation delete-stack --stack-name ${{ stack }}
           aws cloudformation wait stack-delete-complete --stack-name ${{ stack }}

@jadzdtc
Copy link

jadzdtc commented Jun 7, 2022

Dude, what you are asking for is not an Azure Devops issue, it is rather groundbreaking feature request.

AFAIK template expansion (notation ${{ }} ) works only with parameters and preassigned variables, i.e. you cannot achieve template expansion upon runtime values. You may of course start another pipeline, passing parameter obtained in runtime, but I suppose it is not what you ultimately wanted to achieve.

@anilsamuel
Copy link
Author

Dude, what you are asking for is not an Azure Devops issue, it is rather groundbreaking feature request.

AFAIK template expansion (notation ${{ }} ) works only with parameters and preassigned variables, i.e. you cannot achieve template expansion upon runtime values. You may of course start another pipeline, passing parameter obtained in runtime, but I suppose it is not what you ultimately wanted to achieve.

Could you please provide snippet that use another pipeline to achieve this ? as i do not understand how.

@KonstantinTyukalov KonstantinTyukalov added question Further information is requested and removed triage labels Jul 18, 2022
@cedrox
Copy link

cedrox commented Jan 4, 2023

You can have a pipeline that calculate something and trigger a new one from the parent with this pws command 👍 # Run the pipeline
$pipelineQueue = Invoke-Expression "az pipelines run --commit-id $($using:commitId) --id $($using:pipelineId) --branch $($using:branch) --parameters $($processedParams) | ConvertFrom-Json"
$buildID = $pipelineQueue.id

Also parameters can be problematic if you plan to use complex object.

@CurlyBytes
Copy link

Why is this not working, i got similar doing like this
suppose you have this steps
image

then you should supply it in the parameters as object too
image
so when calling or trigger the pipeline, you can still use the yaml by extending it

image

@CurlyBytes
Copy link

CurlyBytes commented Feb 16, 2023

@anilsamuel thats how i did it by calling the parameter object and set on the script
, here is also another from blog https://igeorgiev.eu/devops/azure-pipelines-use-each-loop/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Yaml question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants