jenkins-pipeline

How can I have a Jenkins pipeline build be triggered from a repository with no jenkinsfile?

佐手、 提交于 2019-12-22 04:57:21
问题 I have a repository that does not contain a Jenkinsfile - and I have no way of influencing the repository itself. This means I can neither add nor alter any files to or in the repository (In this case, its the Qt repo). What I want to do is create multiple Jenkinsfiles, that are each configuring and building the Qt library for a different target, or run different additional scripts. All these Jenkinsfiles will be collected in a different repository. Now, my problem is how to create a pipeline

How to display the time it took to run a build in Jenkins?

*爱你&永不变心* 提交于 2019-12-22 04:54:09
问题 I'm configuring a process of Android application build by using Jenkins pipeline. At the beginning and the end of the build, a message is sent to a relevant Slack channel. The relevant portion of the Jenkinsfile looks like so: slackSend (channel: '#slack-test', color: 'warning', message: "Finished: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' State: ${STATE}. Artifacts can be viewed here: ${env.BUILD_URL}artifact/Product/build/outputs/ ") In addition to the above information I'd like to also

Access BitBucket payload data in Jenkins pipeline job

坚强是说给别人听的谎言 提交于 2019-12-22 04:09:07
问题 I've got a Jenkins pipeline job; it is configured to build on remote trigger which is being called by a BitBucket webhook. This works and is triggering the build. I also need to access the payload data sent by BitBucket (described here) to get details about the push such as the specific branch. The BitBucket plugin would usually parse this payload and present it to the job as an environment variable, but I can't set the pipeline job as being connected to a specific repo for that plugin, so it

How to append a text to a file in jenkinsfile

て烟熏妆下的殇ゞ 提交于 2019-12-22 04:01:10
问题 How to append a text to a file in Jenkinsfile injecting Jenkins BUILD_ID I wish to see version := "1.0.25" where 25 is BUILD_ID Here is my attempt import hudson.EnvVars node { stage('versioning'){ echo 'retrieve build version' sh 'echo version := 1.0.${env.BUILD_ID} >> build.sbt' } } Error: version:=1.0.${env.BUILD_ID}: bad substitution Note the file is in the current directory 回答1: env.BUILD_ID is a groovy variable, not a shell variable. Since you used single-quotes ( ' ) groovy will not

Catching multiple errors in Jenkins workflow

孤街浪徒 提交于 2019-12-21 20:22:38
问题 My workflow sends mails when it fails using a try-catch. i have also enable concurrency and with this, when multiple jobs of the same workflow enters into a throttling stage, the new ones cancels the older ones. This throw an exception of "org.jenkinsci.plugins.workflow.steps.FlowInterruptedException" And canceled jobs also triggers the mail notification. Now i have modified my workflow to catch the specific FlowInterruptedException exception and suppress the mail notice and let anything else

Jenkins continuous delivery pipeline skip stage based on input

我怕爱的太早我们不能终老 提交于 2019-12-21 16:22:43
问题 A simplified pipeline will look something like: 1. build 2. unit test 3. deploy to dev 4. integration tests 5. deploy to prod For step #5 I've setup a Jenkins pipeline input command. We won't be deploying to prod on every commit so if we abort all those jobs it will have a big list of grey builds. Is it possible to have a skip option so the build can still be shown as green blue? 回答1: Can't you do something like this, it will be blue/green whatever you choose from input, and you can then run

Jenkins continuous delivery pipeline skip stage based on input

岁酱吖の 提交于 2019-12-21 16:21:47
问题 A simplified pipeline will look something like: 1. build 2. unit test 3. deploy to dev 4. integration tests 5. deploy to prod For step #5 I've setup a Jenkins pipeline input command. We won't be deploying to prod on every commit so if we abort all those jobs it will have a big list of grey builds. Is it possible to have a skip option so the build can still be shown as green blue? 回答1: Can't you do something like this, it will be blue/green whatever you choose from input, and you can then run

Prioritise older pipeline runs over newer

廉价感情. 提交于 2019-12-21 13:08:05
问题 In short, is there a way to sort the Jenkins queue based on build/run age instead of how long it has been in the queue? Some background, we've got a pipeline script which do several tasks in parallel and then, at the end have a step which aggregates the results from the parallel tasks. Here's a simplified version: stage ('Do Parrallel stuff') { def par = [:] for (int i = 0; i < 4; i++) { par[i] = {sleep(10)} } parallel par; } stage ('Aggregate') { node { echo "Aggregating stuff" } } Normally,

Duplicate builds triggered on Jenkins multibranch pipeline

喜夏-厌秋 提交于 2019-12-21 12:42:39
问题 We are seeing duplicate builds triggered on Jenkins multibranch pipeline projects. Builds are normally triggered using push notifications from Bitbucket using this plugin: https://marketplace.atlassian.com/plugins/com.nerdwin15.stash-stash-webhook-jenkins/server/overview However, we are now seeing 'double' builds for some reason. If you look at the 2 builds that are triggered, one is triggered by a 'commit notification', and the other is triggered by 'Branch Indexing'. What is causing the

jenkins pipeline cannot check code into git

随声附和 提交于 2019-12-21 12:14:03
问题 In my jenkins pipeline project I can check code out from git fine... but we need to do some git checkins and the credentials apparently are not cached. stage 'Checkout' git url: 'git@bitbucket.org:myproj.git', branch: 'master', credentialsId: '012ce21d-e920-44ee-b6f7-08df8ab41de0', variable: 'CREDENTIALS' sh('git push') <---- fails with Permission denied (public key). here is sample output: Entering stage Checkout Proceeding [Pipeline] git > git rev-parse --is-inside-work-tree # timeout=10