jenkins-pipeline

I have a Jenkins global variable in a string - how do I evaluate it?

99封情书 提交于 2019-12-23 04:47:11
问题 I need to accept all kinds of global Jenkins variables as strings (basically as parameters to ansible like system - a template stored in \vars ). def proof = "\"${params.REPOSITORY_NAME}\"" echo proof def before = "\"\${params.REPOSITORY_NAME}\"" echo before def after = Eval.me(before) echo after The result is: [Pipeline] echo "asfd" [Pipeline] echo "${params.REPOSITORY_NAME}" groovy.lang.MissingPropertyException: No such property: params for class: Script1 the first echo proves that the

How to copy a file or jar file that has built from jenkins to a diff host server

我的未来我决定 提交于 2019-12-23 04:36:39
问题 Am having a jenkins job where am building a jar file. after the build is done I need to copy that jar file to a different server and deploy it there. Am trying this yml file to achieve the same but it is looking for the file in the different server other than the jenkins server. --- # ansible_ssh_private_key_file: "{{inventory_dir}}/private_key" - hosts: host remote_user: xuser tasks: - service: name=nginx state=started become: yes become_method: sudo tasks: - name: test a shell script

NotSerializableException using Publish Over SSH in Jenkinsfile

独自空忆成欢 提交于 2019-12-23 04:36:21
问题 I'm trying to use the Publish over SSH plugin inside a Jenkinsfile. However, I'm getting the exception java.io.NotSerializableException in the createClient method. This is my code: def publish_ssh = Jenkins.getInstance().getDescriptor("jenkins.plugins.publish_over_ssh.BapSshPublisherPlugin") def hostConfiguration = publish_ssh.getConfiguration("${env.DSV_DEPLOY_SERVER}"); if( hostConfiguration == null ) { currentBuild.rawBuild.result = Result.ABORTED throw new hudson.AbortException(

Jenkins sending notifications to the wrong commit id

此生再无相见时 提交于 2019-12-23 04:19:05
问题 I have several Jenkins pipelines, all importing a shared library from Bitbucket for some utility methods, and I want to send build status notifications to each project's own Bitbucket repo. I installed the Bitbucket build status notifier plugin, but I'm experiencing a weird behavior: when bitbucketStatusNotify is being called in my pipeline, this happens: Sending build status INPROGRESS for commit <sha> to BitBucket is done! And that would be ok, but <sha> is the commit id of the last commit

Implement matrix config in Jenkins pipeline

自古美人都是妖i 提交于 2019-12-23 01:57:38
问题 I've recently moved to the Pipeline plugin in Jenkins. I've successfully used freestyle jobs before for my project, but now would like to test something new. My project builds for Windows and Linux, in release and in debug mode, and uses a parameter, called device , to configure some C preprocessor macros: globally #define d frame_width and frame_height differ, depending on device value. Here is my Jenkinsfile: def device_config(device) { def device_config = ""; switch(device) { case ~/^dev_

Jenkins Multibranch Pipeline Scan infinite re-build

余生颓废 提交于 2019-12-23 01:43:25
问题 I have to deal with the following scenario: I am running my Jenkins Pipeline on Blue Ocean + Git (+ Maven). I have setup the "Scan Multibranch Pipeline" option to check every X minutes if something has changed on the Git repo, and in that case start the job again... My pipeline implements the usual build and test stages. My pipeline, as last stage, increments the snapshot version and pushes the updated POM to Git. Step 4 triggers my issue : the "Scan Multibranch Pipeline" feature gets

Jenkins job DSL plugin - hidden parameter

喜欢而已 提交于 2019-12-23 00:26:13
问题 I am using the Jenkins hidden parameter plugin but I cant find the syntax to write it in DSL like I am doing with other parameters. For example: https://jenkinsci.github.io/job-dsl-plugin/#method/javaposse.jobdsl.dsl.helpers.BuildParametersContext.activeChoiceParam Is there any way to reflect hidden parameter in DSL? 回答1: Job DSL has no built-in support for the Hidden Parameter plugin, so it's not mentioned in the API viewer. But it's supported by the Automatically Generated DSL: job('example

How to build docker image using Jenkins pipeline?

℡╲_俬逩灬. 提交于 2019-12-22 18:22:44
问题 By using jenkins, I create an item of "Pipeline" type. And I set "Pipeline from SCM" to get Jenkinsfile . You can check my GitHub repository: I want use Jenkins pipeline to build a docker image. Here is the Jenkinsfile: node { sh "docker build -t 192.168.59.224:5000/ubuntu-test ." } The Dockerfile is also very simple: FROM ubuntu:14.04 RUN sudo apt-get update && sudo apt-get install -y wget When I run the project. I got following error: unable to prepare context: unable to evaluate symlinks

Cucumber Report Missing report result - report was not successfully completed

£可爱£侵袭症+ 提交于 2019-12-22 14:03:04
问题 I use Cucumber Reports plugin to get cucumber reports in pipeline jobs it works fine before but now i have this error: [CucumberReport] Preparing Cucumber Reports [CucumberReport] JSON report directory is "target/" [CucumberReport] Copied 1 json files from workspace "c:/jenkins/workspace/..." to reports directory "/var/jenkins_home/jobs/..." [CucumberReport] Copied 0 properties files from workspace "c:/jenkins/workspace/..." to reports directory "/var/jenkins_home/jobs/..." [CucumberReport]

Pipeline editor unable to open Jenkinsfile in Jenkins BlueOcean

社会主义新天地 提交于 2019-12-22 13:33:06
问题 I am extremely new to BlueOcean and am getting the below error when trying to open the pipeline editor: There was an error loading the pipeline from the Jenkinsfile in this repository. Correct the error by editing the Jenkinsfile using the declarative syntax then commit it back to the repository. Cannot read property 'indexOf' of undefined Jenkinsfile : pipeline { agent any stages { stage('Build') { steps { echo 'Building..' } } stage('Test') { steps { echo 'Testing..' } } stage('Deploy') {