我是Azure开发人员的新手。作为poc的一部分,我正在尝试构建基于Java的docker映像。
所以我有以下管道yaml文件
# Maven
# Build your Java project and run tests with Apache Maven.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/java
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'package'
resources:
- repo: self
variables:
tag: '$(Build.BuildId)'
stages:
- stage: Build
displayName: Build image
jobs:
- job: Build
displayName: Build
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Docker@2
displayName: Build an image
inputs:
command: build
dockerfile: '$(Build.SourcesDirectory)/Dockerfile'
tags: |
$(tag)
我所期望的是,此管道需要创建一个Java应用程序(jar文件),然后应使用此jar创建一个docker映像
我遇到错误
unexpected value 'stages' azure pipelines
我不明白这个问题...
很高兴有人可以帮忙。.
谢谢
答案 0 :(得分:0)
请先将其移入工作import SwiftUI
@available(iOS 13.0, *)
struct TestView: UIViewRepresentable {
func makeUIView(context: Context) -> UIView {
print("body")
let classicUnit = UIView(frame: CGRect(x: 0, y: 0, width: 200, height: 200))
classicUnit.backgroundColor = UIColor.red
return classicUnit
}
func updateUIView(_ uiView: UIView, context: Context) {
//
}
}
- task: Docker@2
这只是语法问题。如果使用步骤,则不能在根级别使用阶段。 Here您可以检查语法。
如果要将jar创建作为单独的阶段/作业,则必须将其明确定义为另一个阶段或作业。但是,以这种方式,您需要以pipeline artifact的形式发布然后下载jar。
如果您只从事一项工作,则可以使用:
steps:
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'package'