【问题标题】:YAML azure-pipelines.yml syntax to add azureSubscription for all stepsYAML azure-pipelines.yml 语法为所有步骤添加 azureSubscription
【发布时间】:2020-04-07 11:58:52
【问题描述】:

我需要为所有步骤添加azureSubscription: 'AWSMavenReadOnly'“全局”。我试图避免使用完整的 task 语法。我如何将其添加为所有这些脚本的输入?

# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- master
pool:
  vmImage: 'ubuntu-latest'
steps:
- script: sbt clean
  displayName: 'Running $ sbt clean'
- script: sbt update
  displayName: 'Running $ sbt update'
- script: sbt compile
  displayName: 'Running $ sbt compile'
- script: sbt test
  displayName: 'Running $ sbt test'

【问题讨论】:

    标签: scala azure-devops sbt


    【解决方案1】:

    我有点得到这个工作:

    # Starter pipeline
    # Start with a minimal pipeline that you can customize to build and deploy your code.
    # Add steps that build, run tests, deploy, and more:
    # https://aka.ms/yaml
    trigger:
    - master
    pool:
      vmImage: 'ubuntu-latest'
    steps:
    - task: AWSShellScript@1
      inputs:
        awsCredentials: 'AWSMavenReadOnly'
        regionName: 'eu-central-1'
        scriptType: 'inline'
        inlineScript: 'sbt clean update compile'
      displayName: 'Running $ sbt clean update compile'
    - task: AWSShellScript@1
      inputs:
        awsCredentials: 'AWSMavenReadOnly'
        regionName: 'eu-central-1'
        scriptType: 'inline'
        inlineScript: 'sbt test'
      displayName: 'Running $ sbt test'
    

    现在我需要弄清楚如何使用 java11 而不是 ubuntu-latest 上可用的默认 jre

    【讨论】:

    • 干得好!感谢您在这里分享您的解决方案,您可以Accept it as an Answer,这样它可以帮助遇到同样问题的其他社区成员,我们可以存档这个帖子,谢谢。 (提醒this
    • 我想我不确定这是否是“正确的方法”,它看起来对吗?在正常的 bash 任务中是否有更直接的方法来获取/使用awsCredentials
    • 查看this,azure devops 服务建议使用模板重用类似任务。但是由于您的任务内容不同,我认为没有比上述方式更好的方法了。所以我建议你可以随时accept it as answer :)
    猜你喜欢
    • 2020-11-26
    • 2021-08-06
    • 1970-01-01
    • 2022-08-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多