首页 > 解决方案 > YAML azure-pipelines.yml 语法为所有步骤添加 azureSubscription

问题描述

我需要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'

标签: scalaazure-devopssbt

解决方案


我有点得到这个工作:

# 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 而不是可用的默认 jreubuntu-latest


推荐阅读