jenkins-pipeline

How to rebuild Jenkins pipeline

点点圈 提交于 2019-12-24 10:46:07
问题 We have been using Rebuilder plugin (https://wiki.jenkins.io/display/JENKINS/Rebuild+Plugin) on our Jenkins and see a lot of value with that. However, I dont see the "Rebuild" / "Rebuild with parameters" action for pipeline jobs. Am I missing a configuration / version? If you know of any other plugin that allows re-building a pipeline job, with an ability to modify the parameters, defaulting to parameters of last run, that would be good too. We are using Jenkins "CloudBees Jenkins Enterprise

jenkins pipelines: shell script cannot get the updated environment variable

本小妞迷上赌 提交于 2019-12-24 10:40:03
问题 In Jenkins, I want to get a user input and pass to a shell script for further use. I tried to set as environment variable, but the shell script failed to get the latest value and the old value is echo. pipeline { agent none environment{ myVar='something_default' } stages { stage('First stage') { agent none steps{ echo "update myVar by user input" script { test = input message: 'Hello', ok: 'Proceed?', parameters: [ string(name: 'input', defaultValue: 'update it!', description: '') ] myVar = "

groovy job DSL for triggering jenkins based on new release tags

时光总嘲笑我的痴心妄想 提交于 2019-12-24 10:24:31
问题 I came across this setting for jenkins job to trigger jenkins when a new release tag is created on git repo like github but wondering what the equivalent is for groovy jobs DSL script. https://mohamicorp.atlassian.net/wiki/spaces/DOC/pages/136740885/Triggering+Jenkins+Based+on+New+Tags Here is also link to same question asked but without the groovy job DSL script version jenkins trigger build if new tag is released How can one know how to write groovy job DSL scripts based on jenkins job

Jenkins: Can't send zip archive via email

泄露秘密 提交于 2019-12-24 09:28:20
问题 I want to fetch project source code from GitLab, archive it and send it via email. Jenkinsfile: def gitlabRepo = 'http://repository.vrpconsulting.com/roman.skaskevich/koshcheck-copy.git' deleteDir() dir('koshcheck-copy') { stage 'Fetch' def curdir = pwd() echo curdir git url: "${gitlabRepo}", branch: 'master' stage 'Archive' zip archive: true, dir: './src', glob: '', zipFile: 'src.zip' def savedZip = archive 'src.zip' echo savedZip stage 'Notify' emailext ( to: 'roman.skaskevich@gmail.com',

Jenkins Pipeline - How to upload folder to S3?

 ̄綄美尐妖づ 提交于 2019-12-24 08:55:21
问题 I have, as I think, simple use case, when jenkins builds static website, so in the end of the build, I have a folder like $WORKSPACE/site-result. Now I want to upload this folder to S3 (and clean bucket if something already there). How can I do it? I'm using pipeline, but can switch to freestyle project if necessary. So far I installed S3 Plugin (S3 publisher plugin). Created IAM user. Added credentials to "Configure system" section. And can't find any further info. Thanks! 回答1: If the answer

Jenkins Build Pipeline to Publish Applications JAR for Multiple Paths

蹲街弑〆低调 提交于 2019-12-24 08:46:31
问题 I have a repository, where different project owners commit their use-case specific code into their designated sub-directory. You may think of such repo to look something like this: repo_root | |-- proj_1 ------ 1_1_code --> 1_1_code.JAR | |-- 2_1_code --> 2_1_code.JAR | |-- 3_1_code --> 3_1_code.JAR | ... |-- proj_2 ------ 1_2_code --> 1_2_code.JAR | |-- 2_2_code --> 2_2_code.JAR | |-- 3_2_code --> 3_2_code.JAR | ... |-- proj_3 ------ 1_3_code --> 1_3_code.JAR | |-- 2_3_code --> 2_3_code.JAR

Password shows in plain text using Jenkins credentials plugin

让人想犯罪 __ 提交于 2019-12-24 08:28:09
问题 I am trying to use Jenkins Credentials plugin to get user input and make use of it in Jenkinsfile for processing. Since the password field is highly sensitive, I was hoping credentials plugin would mask the password from displaying in the console output. However seems like password is displayed in plain text. I noticed an existing issue https://issues.jenkins-ci.org/browse/JENKINS-38181 that talks about echo statements outside of withCredentials block displays passwords in plain text, which

Jenkins 2 Pipeline Serialization problems in global function

孤人 提交于 2019-12-24 08:09:15
问题 I defined a global function in the vars directory of my Global Pipeline Library. I always got java.io.NotSerializableException caused by JsonSlurper . I replaced it by JsonSlurperClassic and now I get a similar execption caused by HttpURLConnection . I could not find any documentaion how I could handle serialization issues in global functions. @NonCPS does not work. I created a file names sonar.groovy in the vars directory and added the following code: import groovy.json.JsonSlurperClassic

Jenkins parallel build on different agents

≡放荡痞女 提交于 2019-12-24 07:53:30
问题 I have a small example of a Jenkins declarative pipeline that should run on both 'Windows' and 'Linux' agents in parallel. The goal is to dynamically build a configuration matrix (e.g. Release / Debug configurations; different CMake parameters; etc.) and let all combinations run in parallel. However, I'm stuck in building a pipeline that executes the parallel steps from a prepared variable. This is a version of the script where the parallel stages are specified explicitly within the parallel{