詹金斯管道建立形象

时间:2019-11-05 11:05:21

标签: amazon-web-services docker jenkins amazon-ec2

我正在编写一个Jenkins管道Groovy脚本来构建映像。我想构建一个映像并使用此Jenkins管道在EC2中运行一些docker命令。 我在管道下面写了

 pipeline {
   agent none
   stages {
     stage ('image-build')
       steps{
         withAWS(region: 'us-east-1', roleAccount: 9441982XX , role: 
                'Jenkins')
         {
           sh """
             mkdir jenkins
             ls -a

            """
   }
   }      
  }
  }

但是我遇到了错误

 WorkflowScript: 4: Expected a stage @ line 4, column 5.
   stage ('image-build')
   ^

 WorkflowScript: 5: Expected a stage @ line 5, column 8.
      steps{
      ^

 WorkflowScript: 3: No stages specified @ line 3, column 5.
   stages {
   ^

  3 errors

at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
a

1 个答案:

答案 0 :(得分:1)

stage('image-build')将花括号{

    pipeline {
 agent none
 stages {
  stage('image-build') {
   steps {
    withAWS(region: 'us-east-1', roleAccount: 9441982 XX, role:
     'Jenkins') {
     sh ""
     "
     mkdir jenkins
     ls - a

     ""
     "
    }
   }
  }
 }
}