All Projects → jenkinsci → multibranch-action-triggers-plugin

jenkinsci / multibranch-action-triggers-plugin

Licence: MIT license
MultiBranch Actions Trigger Plugin

Programming Languages

java
68154 projects - #9 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to multibranch-action-triggers-plugin

metagraf
metaGraf is a opinionated specification for describing a software component and what its requirements are from the runtime environment. The mg command, turns metaGraf specifications into Kubernetes resources, supporting CI, CD and GitOps software delivery.
Stars: ✭ 15 (-48.28%)
Mutual labels:  pipeline, declarative
bitbucket-push-and-pull-request-plugin
Plugin for Jenkins v2.138.2 or later, that triggers job builds on Bitbucket's push and pull request events.
Stars: ✭ 47 (+62.07%)
Mutual labels:  pipeline, trigger
templating-engine-plugin
create tool-agnostic, templated pipelines to be shared by multiple teams
Stars: ✭ 138 (+375.86%)
Mutual labels:  pipeline, multibranch-pipeline
pipeline-as-yaml-plugin
Jenkins Pipeline As Yaml Plugin
Stars: ✭ 111 (+282.76%)
Mutual labels:  pipeline, multibranch-pipeline
streamalg
Extensible stream pipelines with object algebras.
Stars: ✭ 26 (-10.34%)
Mutual labels:  pipeline
pachinko
modular pluggable media sorter
Stars: ✭ 27 (-6.9%)
Mutual labels:  pipeline
stateless
Finite State Machine porting from Stateless C#
Stars: ✭ 25 (-13.79%)
Mutual labels:  trigger
bactmap
A mapping-based pipeline for creating a phylogeny from bacterial whole genome sequences
Stars: ✭ 36 (+24.14%)
Mutual labels:  pipeline
pipeline
Spline is a tool that is capable of running locally as well as part of well known pipelines like Jenkins (Jenkinsfile), Travis CI (.travis.yml) or similar ones.
Stars: ✭ 29 (+0%)
Mutual labels:  pipeline
react-sync
A declarative approach to fetching data via a React higher order component
Stars: ✭ 18 (-37.93%)
Mutual labels:  declarative
dagshub-branch-source-plugin
Jenkins plugin for using DAGsHub as a source for multibranch projects
Stars: ✭ 12 (-58.62%)
Mutual labels:  pipeline
cmdc
Maya Python API 3.0
Stars: ✭ 98 (+237.93%)
Mutual labels:  pipeline
ngs pipeline
Exome/Capture/RNASeq Pipeline Implementation using snakemake
Stars: ✭ 40 (+37.93%)
Mutual labels:  pipeline
Ext.ux.form.trigger.Clear
Ext JS 5 trigger implementation. Adds a clear icon to textfields and comboboxes
Stars: ✭ 22 (-24.14%)
Mutual labels:  trigger
CodeDeobfuscator
Code Deobfuscator
Stars: ✭ 45 (+55.17%)
Mutual labels:  multibranch
rmonad
Pipelines you can compute on
Stars: ✭ 66 (+127.59%)
Mutual labels:  pipeline
pianola
A declarative function composition and evaluation engine.
Stars: ✭ 18 (-37.93%)
Mutual labels:  declarative
jira-trigger-plugin
Triggers a build when a certain condition is matched in JIRA
Stars: ✭ 112 (+286.21%)
Mutual labels:  trigger
needlestack
Multi-sample somatic variant caller
Stars: ✭ 45 (+55.17%)
Mutual labels:  pipeline
ngs-preprocess
A pipeline for preprocessing NGS data from Illumina, Nanopore and PacBio technologies
Stars: ✭ 22 (-24.14%)
Mutual labels:  pipeline

MultiBranch Action Triggers Plugin

This plugin enables building/triggering other jobs when a Pipeline job is created or deleted, or when a Run (also known as Build) is deleted by a Multi Branch Pipeline Job.

Summary

Multi Branch Pipeline Jobs are capable of creating/deleting Pipelines depending on the branches in the repository. They also remove old runs, depending on the orphaned item strategy configured for the pipeline, or when a branch is deleted.

For some reasons, tasks/jobs/scripts may be needed to run depending on Pipeline creation/deletion. For example, you may need to build up a new environment when a new branch is created and this environment must be ready before the pipeline starts. Also same behavior may be necessary for destroying environments with the deletion of the branch/Pipeline.

Also, there might be reasons to start a job when a run is deleted. For example, if a run has published an artifact (e.g. a docker image) in an external storage (e.g. a docker registry), it might be desirable to remove the artifact from the external storage whenever the run is deleted.

This plugin enables triggering/building Jobs when a new Pipeline is created or deleted with in the Multi Branch Pipeline job, or when a run is deleted.

How It Works

  1. Install plugin from Update Center of Jenkins.

  2. Create your Jobs (Pipeline/FreeStyle) which will be triggered. You can define any name for your jobs.

    Example screenshot:

    1a

    1b

    1c

  3. Create your Multi Branch Pipeline

    Example screenshot:

    3a

  4. Define "Pipeline Action Triggers" Jobs at the bottom of the configuration page of the Multi Branch Pipeline.

    • This fields has Auto-Complete feature.
    • You can define more then one Job. All jobs defined in this fields will be triggered/built in the same time.
    • Do not forget to save configuration.

    Example screenshot:

    4a

    Example screenshot:

    4b

  5. (Optional) Add filtering for triggering Jobs. In default, Trigger Jobs are build for all branches which is discovered by Branch Indexing. In some cases you may need to filter branches on which Trigger Jobs will be build. To achieve this you can define both Include and Exclude Filters (wildcard).

    5a

  6. After Multi Branch Pipeline indexes the branches and creates Pipelines, you will notice that, Jobs that you defined in "Pipeline Create Event" field has the same number of builds with the number of Pipelines.

    • When you go to Configuration of the Jobs, you will notice that Build Parameter is defined automatically.
    • Branch/Pipeline name value is passed to the job by the parameter named "SOURCE_PROJECT_NAME". This parameter will have the name of the Pipeline/Branch which is created by Multi Branch Pipeline. For example if you only have master branch in your repository, this value will be "master".
    • Full name of the Branch/Pipeline is passed to the job by the parameter named "SOURCE_PROJECT_FULL_NAME". This parameter will have the full name of the Pipeline/Branch which is created by Multi Branch Pipeline. For example if you only have master branch in your repository, this value will be "MyMultiBranchPipeline/master".
    • If the Pipeline/Branch job is type of Pull Request/Merge Request, then two more parameters are passed to the job.
      • SOURCE_BRANCH_NAME is the source branch of the Pull Request/Merge Request which is created by Multi Branch Pipeline.
      • TARGET_BRANCH_NAME is the target branch of the Pull Request/Merge Request which is created by Multi Branch Pipeline.
    • You can use this variable for your needs in your scripts/pipelines.

    Example screenshots:

    6a

    6b

    6c

    6d

  7. Whenever the Multi Branch Pipeline deletes a run (either by deleting the run, or by deleting the complete branch), or whenever a run is deleted manually, the Jobs that you defined in "Run Delete Event" will be executed. Additionally, to the parameters which are passed on branch creation or deletion, two other parameters ("SOURCE_RUN_NUMBER" and "SOURCE_RUN_DISPLAY_NAME") are passed to the triggered job(s).

    Example Screenshots:

    7a

    7b

  8. (Optional) Add additional parameters for passing to Triggering Jobs. Parameters which are defined in this section will be automatically defined in Trigger Jobs and values will be passed during the build.

    Example Screenshots:

    8a

    8b

Job DSL

MultiBranch Action Triggers Plugin can be defined by using Jenkins Job DSL Plugin as shown below.

multibranchPipelineJob('multi-branch-job') {
    branchSources { // This block is for creating MultiBranch Job. Please check Job DSL Plugin for more details.
        git {
            id('123456789') // IMPORTANT: use a constant and unique identifier
            remote('https://github.com/jenkinsci/multibranch-action-triggers-plugin.git')
            credentialsId('your-credentials') 
            includes('*')
        }
    }
    properties{
        pipelineTriggerProperty{
            createActionJobsToTrigger('job1, job2') // Comma separated list of Jobs
            deleteActionJobsToTrigger('job1, job3') // Comma separated list of Jobs
            actionJobsToTriggerOnRunDelete('job2, job3') // Comma separated list of Jobs
            branchIncludeFilter('*') // Can bet set to empty string
            branchExcludeFilter('exclude') // Can bet set to empty string
            additionalParameters{ // This block is optional.
                additionalParameter{ // This block can be defined as much as required
                    name('KEY1')
                    value('VALUE1')
                }
                additionalParameter{
                    name('KEY2')
                    value('VALUE2')
                }
            }
        }
    }
}

Reporting Issues

Please create issue in this repository.

Create Issue

Thank You!

If you feel your self generous today, you can buy me a coffee : )
Or you can star the project. Thanks.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].