Azure devops azdo管道步骤-如何在后续任务中使用CreateStack云形成模板输出

Azure devops azdo管道步骤-如何在后续任务中使用CreateStack云形成模板输出,azure-devops,amazon-cloudformation,azure-pipelines,Azure Devops,Amazon Cloudformation,Azure Pipelines,我使用Cloudformation模板通过AzDo管道在SecretsManager中创建一个秘密,CFT非常简单,如下所示- AWSTemplateFormatVersion: '2010-09-09' Description: "How to create secrets in Secrets Manager using an AWS CloudFormation template" Parameters: SecretName: Description: The name o

我使用Cloudformation模板通过AzDo管道在SecretsManager中创建一个秘密,CFT非常简单,如下所示-

AWSTemplateFormatVersion: '2010-09-09'
Description: "How to create secrets in Secrets Manager using an AWS CloudFormation template"
Parameters:
  SecretName: 
    Description: The name of the secret to be created
    Type: String
Resources:
  CreateCredentialsInSecretsManager:
    Type: 'AWS::SecretsManager::Secret'
    Properties:
      Name: !Ref SecretName
      Description: "This secret will be used in further steps."
      GenerateSecretString:
        SecretStringTemplate: '{"dbuname": "datastoredb1"}'
        GenerateStringKey: "dbpwd"
        PasswordLength: 30
        ExcludeCharacters: '!"@/\:;'
Outputs:
  SecretNameVar:
    Value: !Ref SecretName
现在我想在接下来的任务中使用“Outputs”部分中的“SecretNameVar”-

在SM任务上定义的属性- 如何在shell脚本中使用输出变量,或者如何在其他任务中使用输出变量

多谢各位

我如何在shell脚本中使用输出变量或用于此目的 还有其他任务吗

对于此问题,您可以使用
$(.)
格式引用下游步骤中的输出变量。referenceName是您在输出变量部分中设置的名称。有关详细信息,请参阅此

此外,我们需要为输出变量设置
参数isOutput=true
。例如,使用powershell脚本设置输出变量:

##vso[task.setvariable variable=varibaleName;isOutput=true;]value

哈哈,我昨天晚上就想出来了,但我没有像你说的那样使用参考资料。对于任务“选项”部分中的“堆栈输出”,如果选择“将堆栈输出保存到任务变量中”,将创建堆栈输出作为环境变量,并可通过下游步骤访问。我假设如果在同一个作业中访问堆栈输出,则不需要该引用,因为$()对我来说工作得很好。但是,如果您有多个作业,并且希望使用“job2或job3.task”中“job1.task”的输出,您的符号可能会有所帮助。