hyperledger/indy-jenkins-pipeline-lib

Name: indy-jenkins-pipeline-lib

Owner: Hyperledger

Description: null

Created: 2017-12-21 18:34:40.0

Updated: 2018-03-21 12:24:53.0

Pushed: 2018-03-21 12:24:52.0

Homepage: null

Size: 23

Language: Groovy

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Indy Jenkins Pipeline Library

The repository contains a library of reusable Jenkins Pipeline steps and functions for that are used in Hyperledger Indy projects' CI/CD pipelines.

Indy Pipeline Steps
indyAutoMergePR
indyAutoMergePR {
    node = 'node-label-with-linux-docker'
            // default: indyConfig.indyNodeLabel
    prDetails = [
        owner: 'github-repo-owner',
            // default: parsed from env.CHANGE_URL or env.ghprbPullLink
        repo: 'github-repo-name',
            // default: parsed from env.CHANGE_URL or env.ghprbPullLink
        number: 1, // PR number
            // default: env.CHANGE_ID or env.ghprbPullId
    ]
    credentialsId = 'GitHub-token-with-PRs-write-permissions'
            // default: indyConfig.credentials.gitHubToken
    approveMessage = 'comment-in-PR'
            // default: 'Approved'
    statusState = 'pending|success|error|failure'
            // default: 'success'
    statusUrl = 'status-url'
            // default: env.RUN_DISPLAY_URL
    statusDescr = 'status-description'
            // default: 'Success: This commit looks good for auto merge'
    statusContext = 'status-context'
            // default: indyConfig.prStatusContext
}
indyCleanWs
indyCleanWs()
indyConfig
indyIsTested {
    node = 'node-label-with-linux-docker'
            // default: indyConfig.indyNodeLabel
    branch = 'PRs-target-branch-filter'
            // default: env.$BRANCH_NAME
    contexts = ['PRs-context-filters', ...] //default: ['continuous-integration/jenkins/pr-merge']
    age = 5      // filter PRs by number of days from the last update, default: 7
            // default: 7
}
indyJNode
indyJNode(nodeLabel)
indyLogger
email
indyNotify.email message

Please check docs for details about message attributes.

Default message:

[
    body: '$DEFAULT_CONTENT',
    replyTo: '$DEFAULT_REPLYTO',
    subject: '$DEFAULT_SUBJECT',
    to: '$DEFAULT_RECIPIENTS'
]
slack
  indyNotify.slack message

Please check docs for details about message attributes.

indyPackaging
indyPackaging {
    node = 'node-label-with-linux-docker'
            // default: indyConfig.indyNodeLabel
    builders = [deb: debBuilderClosure]
            // default: not-defined
    version = '1.2.3'
            // default: not-defined
}
indyPipeline
indyPipeline {
    :
    timeout = 90 // minutes
            // default: not defined
    onFail = onFailCallback
            // default: not defined
    onSuccess = onSuccessCallback
            // default: not defined
    // format = stageName, stageConfigClosure],
    // config closures are empty by default
    stages = [
        ['indyVerifyStatic', {}],
        ['indyVerify', {
            ...
        }],
        ['indyAutoMergePR', {}],
        ['indyPackaging', {
            version = "1.2.3"
            builders.deb = buildDebUbuntu
        }]
    ]
            // default: all steps from indyConfig with dummy closures {}
}
indyPublish
indyPublish {
    packageName = 'myPackage'
        // default: not defined
    releaseVersion = '1.2.3'
        // default: not defined
    projectName = 'myProject'
        // default: not defined
    builders = [deb: debBuilderClosure]
        // default: not defined
}
indyVerify
indyVerify {
    labels = ['linux', 'windows']
            // default: not defined
    tests = [
        common: [
            resFile: { "test-result-filename.${NODE_NAME}.xml" },
                // default: 'test-result.txt'
            testDir: 'indy_common',
                // default: '.'
            python: 'python-executable-to-use',
                // default: 'python'
            useRunner: true,    // run or not the custom runner for tests
                // default: false
            docker: 'ubuntu' // reference to item in 'dockers' 
                // default: not defined
        ],
        // ...
    ]
            // default: not defined
    dockers = [
        ubuntu: [
            imgName: 'ci-image-name',
                // default: not defined
            dockerfile: "path-to-dockerfile",
                // default: not defined
            contextDir: "path-to-docker-build-context-dir"
                // default: not defined
        ]
    ]
            // default: not defined

}
indyVerifyStatic
indyVerifyStatic {
    node = 'node-label-with-linux-docker'
            // default: indyConfig.indyNodeLabel
    dockerEnv = [
        imgName: 'ci-image-name',
            // default: 'code-validation'
        dockerfile: "path-to-dockerfile",
            // default: 'ci/code-validation.dockerfile'
        contextDir: "path-to-docker-build-context-dir"
            // default: 'ci'
    ]
}
indyStagesInit

e.g.

def call() {
    return [
        indyPublish: myLibraryPublishStep
    ]
}

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.