Jenkins

How to get a reference to form elements in a Jenkins jelly script for a Builder configuration when the form loads?

坚强是说给别人听的谎言 提交于 2021-01-29 02:11:32
问题 I am writing a Jenkins Builder, and in the jelly script for its configuration in the build configuration page I have some Javascript that I want to run when the form is loaded, to do a server lookup and get some information to help the user out with their configuration, which will also be performed when the user changes the form's values. Previously I have got references to the form elements by passing this in to functions in onchange or onkeyup attributes. However, now I want to run some

How to use pom version in shell command in jenkinsfile?

∥☆過路亽.° 提交于 2021-01-28 20:53:45
问题 I am trying to get pom.xml version within Jenkinsfile and then use that version in a shell script. This gives the exception bad substitution when trying to use pom.version . What is the correct syntax to pass the pom version? script { def pom = readMavenPom file: 'pom.xml' withCredentials(...) { sh '''#!/bin/bash cp "${WORKSPACE}/target/stats-${pom.version}-shaded.jar" /xyz ''' } } I installed Pipeline Utility Steps plugin for readMavenPom cmd but didn't restart Jenkins. Is it necessary to

CI cannot build .NET project, fails with: “Couldn't find a valid ICU package installed on the system…”

隐身守侯 提交于 2021-01-28 20:11:06
问题 I am working on having Jenkins build our legacy .NET 2.1 applications as part of streamlining our kubernetes deployments Therefore I have created a custom Jenkins agent based on the jenkins/jnlp-slave:latest-jdk11 docker image (https://github.com/jenkinsci/docker-jnlp-slave) which in turn is Debian 9 based, extended with the official .NET Core (unpacked the ZIP from https://dotnet.microsoft.com/download/dotnet-core/2.1 , Debian updates does not work well with our firewall), and for trivial

When running an ansible playbook via a shell script in Jenkins pipeline, the echo output is buffered and does not show in real time

吃可爱长大的小学妹 提交于 2021-01-28 20:00:53
问题 So below I have attached my pipeline code for Jenkins. The runansible.sh script takes in the parameters given and then proceeds to run an ansible playbook based on the paramMode value. When kicking off the shell script in a terminal I get realtime output of the ansible playbook running, but when using the Jenkins pipeline I just get the loading cogwheel during the echo stage. I do not get any echo output until the whole playbook has completed and then it spits it out all at once. I need to be

Jenkins publish over SSH failed to change to remote directory

女生的网名这么多〃 提交于 2021-01-28 19:32:19
问题 I am using the Jenkins publish over SSH plugin to transfer files to a remote server. When I configure the Publish over SSH plugin and specify a Remote Directory, testing the configuration always fails with this error: jenkins.plugins.publish_over.BapPublisherException: Failed to change to remote directory [C:\zzTest] However if I leave the Remote Directory filed blank I get a success message when I test the configuration. Any ideas as to what I am doing wrong here? The directory definitely

Jenkins - Email-ext plugin display name of job in email

烈酒焚心 提交于 2021-01-28 19:01:51
问题 Is there an easy way to include the display name of the job in the email subject? Maybe there is an environment variable for this? I know it should be possible because the default functionality (email notification) in jenkins already provides this information in the email subject. 回答1: Yes, You can use the built-in environment JOB_NAME , other available environments you can use are like BUILD_STATUS , BUILD_NUMBER , etc. [${BUILD_STATUS}]${JOB_NAME} Build #${BUILD_NUMBER} As always, you can

Creating a tarball using Jenkins

无人久伴 提交于 2021-01-28 18:12:55
问题 I need to create a tarball after a successful Jenkins build. I am new to this. So Wanted to find out if there is a plugin for this. Or I should be writing down a shell script from as a post build action in order to create this tarball. 回答1: You can use ArtifactDeployer Plugin but you should think why you create tarball shoud your send it to mail recipients publish somethere or something else. 来源: https://stackoverflow.com/questions/37248963/creating-a-tarball-using-jenkins

Launch a .bat from Jenkins does not work

荒凉一梦 提交于 2021-01-28 18:00:30
问题 This is the .bat file : start cmd.exe /k "C:\Users\etudes.ext46\AppData\Local\Android\sdk1\tools\emulator.exe -avd ff &" ping 127.0.0.1 -n 60 > nul start cmd.exe /k "adb shell input keyevent 82" start cmd.exe /k "node "C:\Program Files\Appium\node_modules\appium\bin\appium.js" -a 127.0.0.1 -p 4723 &" ping 127.0.0.1 -n 30 > nul C:\Users\etudes.ext46\Downloads\NUnit-2.6.4\NUnit-2.6.4\bin\nunit-console.exe C:\Users\etudes.ext46\Downloads\NUnit-2.6.4\NUnit-2.6.4\bin\apk\UnitTestProject1.dll start

How to perform when..else in declarative pipeline

杀马特。学长 韩版系。学妹 提交于 2021-01-28 14:40:56
问题 I'm using a declarative pipeline. This part works: steps { script { if ('xxx' == 'cloud') { sh 'xxx' } else { sh 'xxx' } } } But I want to follow the more declarative pipeline syntax using when. I tried something like this: stage ('Newman run') { when { expression { "xxx" == "cloud" } } steps { echo 'Use proxy for cloud' sh 'xx' } when { expression { "cloud" == "cloud" } } steps { echo 'Do not use proxy (non-cloud)' sh 'xxx' } But it didn't work. How I can specify a sort of ' else ' statement