Does anyone use Jenkins Pipeline with Staging?
To stage a build (hold it back) until some criteria has been met. No user 
interaction or manual process involved, fully automatic.


We have N Multibranch pipeline jobs in Jenkins with various dependencies on 
each other.
When building a release we need to verify it by building all downstream 
dependencies against this release.
So far so good. We get the list of all downstream dependencies.
Loop through them to build against this new release.

This new release must not be published to a release repository until the 
verification has succeeded.
If the verification fails, mark the build Unstable. Now those downstream 
dependencies are getting fixed and themself built.
They must be build with the artifacts from the previous unstable upstream 
project. Their build succeeds, their own verification also succeeds, but we 
cannot publish its artifacts yet either.
If we build a new release. We may need to build with all upstream 
dependencies that are not yet released, and if we do, then that build 
itself cannot be released.
It is the chicken and the egg problem.

My head hurts from trying to think out a solution to improve our Scripted 
Pipeline. Trying to redesign our pipeline flow and structure gives me a 
headache.

We have 4 stages: Checkout, Build, Verify, Publish.
A boiled down scripted Pipeline that represents how ours is:

def buildNodes = getBuildNodes()
def mainBuildNode = buildNodes.first()

stage("Checkout") {
    node (mainBuildNode)
        def scmProps = scm checkout
        createArchive()
        stash name: 'buildArchive', includes: *.tar.gz
    }
}

stage("Build") {
   parallel doBuild(buildNodes)
}

def allUpstreamDependencies = getAllUpstreamDependencies()
def allDownstreamDependencies = getAllDownstreamDependencies()

stage("Verify") {
   parallel doVerify(buildNodes, allDownstreamDependencies)
}

stage("Publish") {
   parallel doPublish(buildNodes)
}

checkUpstreamAndStartBuild(allUpstreamDependencies)
checkDownstreamAndStartBuild(allDownstreamDependencies)

if (releaseBuild && verified)
    doTagScmRelease()
}

The triggering of upstream and downstream projects works, but we have one 
remaining flaw. If a build succeeds and verifies, it will be published to 
release, even though It has an upstream dependencies that is in a failed 
state (not yet released).

We cannot be the only organization with such a complicated Pipeline. Can a 
Declarative Pipeline work better? We have a lot of pipeline code.
Any suggestions, ideas and tips is highly appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/3cbbd251-4ab6-40dc-852d-32bcc8fa8be4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to