jenkins-plugins

Use jenkins to inject masked password for use in code within the build

别来无恙 提交于 2019-12-11 07:39:35
问题 My aim: To use a password in jenkins which is masked after input and runtime. I only need it for my job. I can use it in my java code to login to a website. Areas I have looked at: The credentials plugin - this looks like the right area (but I'll need to get the sysadmins to add me as its locked down). Also I can't find out how you can access the output? 回答1: Have a look into the EnvInject plugin, there you can define password parameters that are masked in console output and job configuration

String parameter as lockable resources label in jenkins

六眼飞鱼酱① 提交于 2019-12-11 07:36:13
问题 I am trying to setup a job with the use of lockable resources. My job is parameterized and one of the String parameters is parameter 'ENVIRONMENT'. I would like to use this parameter as groovy expression label for lockable resources plugin, i.e.: groovy:resourceLabels.contains(${ENVIRONMENT}) but the expression is not being evaluated. Is there a way to make it evaluate String parameter like this? 回答1: I'm not sure it's the only problem, but it looks like double-quotes are missing groovy

Setup Docker Jenkins with default plugins

痞子三分冷 提交于 2019-12-11 07:26:08
问题 I want to create a Jenkins based image to have some plugins installed as well as npm . To do so I have the following Dockerfile : FROM jenkins:2.60.3 RUN install-plugins.sh bitbucket USER root RUN apt-get update RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - RUN apt-get install -y nodejs RUN npm --version USER jenkins That works fine however when I run the image I have two problems: It seems that the plugins I tried to install manually didn't get persisted for some reason. I get

Jenkins Version Number Plugin BUILD_NUMBER

只谈情不闲聊 提交于 2019-12-11 06:35:32
问题 I would like to use the Version Number Plugin to format the BUILD_NUMBER variable. I've configured it in the following way: image Environment Variable Name: FORMATTED_BUILD_NUMBER Version Number Format String: ${BUILD_NUMBER,XXX} But when I'm using the FORMATTED_BUILD_NUMBER variable (${FORMATTED_BUILD_NUMBER}) it returns the un-formatted build number. So I would like to see something like: 032 but it returns 32. 回答1: This is not supported. Formatting of the strings is done in function

Jenkins MSTestRunner plugin is unable to launch mstest.exe

半城伤御伤魂 提交于 2019-12-11 05:53:54
问题 I've configured the Jenkins MSTestRunner plugin to use the following path to the MSTest executable: 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe'. However, although this path is correct, the build fails as follows: cmd.exe /C "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe" "/resultsfile:/resultsfile testresults" /testcontainer:Project.Tests/bin/Debug/Project.Tests.dll && exit %%ERRORLEVEL%% 'C:\Program' is not recognized as an

How to get workspace of jenkins pipeline plugin job (WorkflowRun object java API )

我是研究僧i 提交于 2019-12-11 05:19:18
问题 In the java API, I can access to the workspace path from the Run.java object: (Until today, all objects were instance of hudson.model.AbstractBuild) hudson.model.AbstractBuild#getWorkspace() hudson.model.Run#getExecutor().getCurrentWorkspace() In Pipeline plugin I don’t have an access to the workspace, the run object is instance of org.jenkinsci.plugins.workflow.job.WorkflowRun and this object doesn’t link to any workspace. this call return null: hudson.model.Run#getExecutor()

Jenkins Pipeline continue latest build at certain time

笑着哭i 提交于 2019-12-11 05:09:44
问题 I have a Jenkins Pipeline which runs per commit, does a build and runs some sanity tests. Then at 8pm I want the latest successful build to carry on and run more indepth tests as part of the same pipeline. I have looked at milestone and lock but it seem that the first commit of the day would grab the lock to wait till 8pm and then be "promoted" and then when that finished it would run the latest which doesnt work for me. I have looked at milestone and then having a user-input to hold all the

Does Jenkins support docker-compose

…衆ロ難τιáo~ 提交于 2019-12-11 04:36:01
问题 I read in certain docker plugins, such as docker-slave-plugin, it shows there is support for compose but I do not understand how to implement it. Has anyone used docker-compose in the Jenkins pipeline and how? 回答1: The short answer appears to be no. It does not directly support compose. I got around this by using the script{} blocks in the Jenkinsfile to manually call docker-compose up which worked fine. 回答2: I installed docker and docker-compose on the Jenkins machine and run it with sh

Jenkins Groovy post build plugin multi line regex on console log

时光毁灭记忆、已成空白 提交于 2019-12-11 04:03:49
问题 I'm trying to create a multi-line regex using the groovy post build plugin in Jenkins. I can make this work in the normal Jenkins script console, but I'm having trouble translating that to the post build plugin. Here is the text I want to grab from the console log: def string """ TEST SUMMARY: [java] ------------------------------------------------------------ [java] 268 tests in 69 groups [java] 1 errors [java] 0 failures """ This line of code will match what I have above in the script

Detect Jenkins build abort event

限于喜欢 提交于 2019-12-11 03:35:02
问题 Is it possible to detect Jenkins build abort event in Builder plugin and perform graceful process finalization? This is the only information I was able to find: https://wiki.jenkins-ci.org/display/JENKINS/Aborting+a+build 回答1: InterruptedException is thrown on job abort, so by catching it, it is possible to detect and handle job termination. More detailed information can be found here. 回答2: You can use Post-build task plugin:- https://wiki.jenkins-ci.org/display/JENKINS/Post+build+task Use