詹金斯管道建立形象

我正在编写一个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
a617027242 回答:詹金斯管道建立形象

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

     ""
     "
    }
   }
  }
 }
}
本文链接:https://www.f2er.com/3160196.html

大家都在问