0
0
Jenkinsdevops~10 mins

Parallel stages execution in Jenkins - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a parallel block in Jenkins pipeline.

Jenkins
pipeline {
  agent any
  stages {
    stage('Build and Test') {
      steps {
        [1] {
          stage('Build') {
            steps {
              echo 'Building...'
            }
          }
          stage('Test') {
            steps {
              echo 'Testing...'
            }
          }
        }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Aparallel
Bsequence
Cmatrix
Dscript
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'sequence' instead of 'parallel' causes stages to run one after another.
Using 'matrix' is for different combinations, not parallel execution.
2fill in blank
medium

Complete the code to name a parallel stage in Jenkins pipeline.

Jenkins
pipeline {
  agent any
  stages {
    stage('Parallel Work') {
      steps {
        parallel(
          [1]: {
            echo 'Running task A'
          },
          TaskB: {
            echo 'Running task B'
          }
        )
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
A'TaskA'
BTaskA
C"TaskA"
DtaskA
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes causes syntax errors.
Using unquoted names is invalid in this context.
3fill in blank
hard

Fix the error in the parallel stages syntax.

Jenkins
pipeline {
  agent any
  stages {
    stage('Deploy') {
      steps {
        parallel {
          stage('Deploy to Dev') {
            steps {
              echo 'Deploying to Dev'
            }
          }
          stage('Deploy to Prod') {
            steps {
              echo 'Deploying to Prod'
            }
          }
        [1]
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
A)
B}
C]
D;
Attempts:
3 left
💡 Hint
Common Mistakes
Using ')' or ']' causes syntax errors.
Missing the closing brace breaks the pipeline.
4fill in blank
hard

Fill both blanks to correctly define parallel stages with named tasks.

Jenkins
pipeline {
  agent any
  stages {
    stage('Parallel Tasks') {
      steps {
        parallel(
          [1]: {
            echo 'Task 1 running'
          },
          [2]: {
            echo 'Task 2 running'
          }
        )
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
A'Task1'
B'Task2'
C'Build'
D'Test'
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted names causes errors.
Using same names for both tasks causes conflicts.
5fill in blank
hard

Fill all three blanks to create a parallel block with three stages named Build, Test, and Deploy.

Jenkins
pipeline {
  agent any
  stages {
    stage('CI Pipeline') {
      steps {
        parallel(
          [1]: {
            echo 'Building...'
          },
          [2]: {
            echo 'Testing...'
          },
          [3]: {
            echo 'Deploying...'
          }
        )
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
A'Build'
B'Test'
C'Deploy'
D'Release'
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted names causes syntax errors.
Using incorrect or duplicate names confuses the pipeline.