Git Product home page Git Product logo

jenkins-example-parallel's Introduction

jenkins-example-parallel

jenkins-example-parallel's People

Contributors

darinpope avatar

Stargazers

KristineVog avatar Renata Tavares avatar  avatar  avatar Ananda Dwi Ae avatar Milad Khakpour avatar arun9theja avatar Evgeniy Letenkov avatar  avatar Amulya Malla avatar Danny Andres Barrientos Agudelo avatar

Watchers

 avatar James Cloos avatar  avatar

jenkins-example-parallel's Issues

Jenkins Parallel Pipelines and Error Handeling

Hi @darinpope

Love all CloudBee tips on CloudBeeTV.

Can the video/example be extended to include error handling in pipelines?

So, if one of the sequential stages fails within the parallel stage, it stops downstream stages but doesn't stop the other parallel job.

For example, in https://github.com/darinpope/jenkins-example-parallel/blob/main/Jenkinsfile-4, in the stage 'linux-amd64' fails, the stages 'run', 'unit test'.... will be skipped, but the stage 'linux-armv6' & 'darwin-amd64' will continue without issues.

We have a multi-parallel job to build AWS AMIs for different tiers in our environment.

I've managed to cobble something together using a groovy map, but it seems clunky and included some scripted pipeline code.

Below is a stage script where if/try/catch is being used

    stage("Configure ${AMITierName} instance") {
      script {
        if (stageResultMap.find{ it.key == "${role}_Launch" }?.value) {
          try {
            sh (script: '''
              #/bin/bash
              /usr/local/bin/ansible-playbook ${WORKSPACE}/ansible/playbooks/${role}_base_build.yml \
                                  --extra-vars "hosts_tag_name=tag_Name_${linuxdistro}_${role}_${arch}_base_build_${DATE}_01";
            ''')
            stageResultMap."${role}_Build" = true
          }
          catch (Exception e) {
            unstable("${STAGE_NAME} failed!")
            currentBuild.result = 'UNSTABLE'
            stageResultMap."${role}_Build" = false
            echo "${stageResultMap}"
          }
        } else {
          Utils.markStageSkippedForConditional("${STAGE_NAME}")
          echo "Skip stage ${STAGE_NAME}"
        }
      }

Is there a better way to handle errors in pipelines? I don't think I can use catchError in this scenario.

Many thanks!!
Tony

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.