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
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
The repository contains a library of reusable Jenkins Pipeline steps and functions for that are used in Hyperledger Indy projects' CI/CD pipelines.
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()
sets indy pipelines environment
most of fields could be conigured by environment variables
returns a Map with the following fields
rsBasePath: classpath to resources, org/hyperledger/pipeline/indy, non-configurable
steps: a list of Maps, where key is name of one of indy steps and values are:
true
)failFast: turns on/off failFast mode for parallel steps, depends on env.indyFailFast (default: false
)
dryRun: turns on/off dry run mode, depends on env.indyDryRun (default: false
)
logLevel: sets logging level, depends on env.indyLogLevel (default: 'DEBUG
')
indyNodeLabel: node label where linux docker container could be run, depends on env.indyNodeLabel (default: null
)
credentials:
null
)prStatusContext: PR status set for the PR by indyAutoMergePR, depends on env.indyPRStatusContext (default: null
)
check if current commit has been already tested in scope of any PR
makes sense for branch jobs only
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(nodeLabel)
defines a set of log levels and provides API for each
log levels: TRACE, DEBUG, INFO, WARNING, ERROR
methods:
trace(message, prefix=null)
debug(message, prefix=null)
info(message, prefix=null)
warning(message, prefix=null)
error(message, prefix=null)
provides API to send notifications
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'
]
indyNotify.slack message
Please check docs for details about message attributes.
indyPackaging {
node = 'node-label-with-linux-docker'
// default: indyConfig.indyNodeLabel
builders = [deb: debBuilderClosure]
// default: not-defined
version = '1.2.3'
// default: not-defined
}
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 {
packageName = 'myPackage'
// default: not defined
releaseVersion = '1.2.3'
// default: not defined
projectName = 'myProject'
// default: not defined
builders = [deb: debBuilderClosure]
// default: not defined
}
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 {
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'
]
}
e.g.
def call() {
return [
indyPublish: myLibraryPublishStep
]
}