Jenkinsfile nested stage(s) throwing error

I have the following Jenkinsfile which I believe is setup correctly. I used as an example but for some reason when I run this in jenkins I am receiving,

WorkflowScript: 11: Unknown stage section "stages". Starting with version 0.5, steps in a stage must be in a steps block

Can someone tell me what I am missing or doing wrong?

pipeline { agent {label 'windows'} stages { stage('Quick Build') { steps { echo 'Building' } } stage('Deploy to Dev') { // when { // branch 'develop' // } stages { stage('Building Distributable Package') { steps { echo 'Building' } } stage('Archiving Package') { steps { echo 'Archiving Aritfacts' archiveArtifacts artifacts: '/*.zip', fingerprint: true } } stage('Deploying Dev') { steps { echo 'Deploying' timeout(time:3, unit:'DAYS') { input message: "Approve build?" } } } } } stage('Deploy to Test') { when { branch 'develop' } steps { echo 'deploying..' timeout(time:3, unit:'DAYS') { input message: "Approve build?" } } } stage('Deploy to Prod') { when { branch 'release' } steps { timeout(time:3, unit:'DAYS') { input message: "Deploy to Prod?" } echo 'Deploying....' } } } } 

Thanks in advance!

3

1 Answer

This ended up being a problem in version 2.107.3. Once upgraded to 2.121.2 this functionality started working.

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like