简体   繁体   中英

Jenkins "No such DSL method 'steps' found among steps"

Jenkins output error..

[Checks API] No suitable checks publisher found.

java.lang.NoSuchMethodError: No such DSL method 'steps' found among steps

My jenkinsfile.

node {
 stage('Clone repository') {
     checkout scm
 }
 stage('Build packer') {
     steps {
         dir('packer') {
             sh 'git clone https://github.com/changhyuni/packer'
             sh 'packer build ec2.json'
         }
     }
 }

 stage('Build image') {
     app = docker.build("475667265637.dkr.ecr.ap-northeast-2.amazonaws.com/chang")
 }
 
 stage('Create ECR') {
     sh 'pip3 install boto3 --upgrade'
     sh 'python3 ecr.py'  
 }


 stage('Push image') {
     sh 'rm  ~/.dockercfg || true'
     sh 'rm ~/.docker/config.json || true'
     
     docker.withRegistry('https://475667265637.dkr.ecr.ap-northeast-2.amazonaws.com', 'ecr:ap-northeast-2:chang-aws-ecr') {
         app.push("chang")
         app.push("${env.BUILD_NUMBER}")
         app.push("latest")
  }
 }
}

steps is a directive from declarative syntax https://www.jenkins.io/doc/book/pipeline/syntax/#steps

Your example is scripted syntax https://www.jenkins.io/doc/book/pipeline/syntax/#scripted-pipeline

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM