jenkins-pipeline

Jenkins Pipeline logs braces from ansiColor plugin?

那年仲夏 提交于 2019-12-02 13:16:46
I do not like that when I output a message using a ansiColor plug-in, it prints a lot of extra braces and words. How to fix it? Jenkins Pipeline Method: def printVariable(String message) { ansiColor('xterm') { echo "\033[34m ${message} \033[0m" } } Call: printVariable("ENVIRONMENT: ${ENVIRONMENT}") printVariable("PROJECT_VERSION: ${PROJECT_VERSION}") printVariable("TAG_NAME: ${TAG_NAME}") Output: [Pipeline] } [Pipeline] // ansiColor [Pipeline] ansiColor [Pipeline] { [Pipeline] echo ENVIRONMENT: prod [Pipeline] } [Pipeline] // ansiColor [Pipeline] ansiColor [Pipeline] { [Pipeline] echo PROJECT

GIT SCM configuration for bitbucket pull requests checkout using generic Webhook parameters

谁都会走 提交于 2019-12-02 13:02:15
This stackoverflow page can help you checkout bitbucket pull requests in Jenkins with Generic webhook trigger. Pre-requisites: Jenkins: 1) Installing Generic Webhook Trigger Plugin and Bitbucket plugin in Jenkins 2) Configuring 'Bitbucket Endpoints' in Jenkins configuration. 3) Creating sample 'Pipeline' job in Jenkins (can configure Generic webhook plugin / configure bitbucket repo / include custom Jenkins file path) Bitbucket: 4) Configuring Webhook in bitbucket repo to connect to Jenkins webhook plugin and checking 'Events' - Push, Comment Added. Now assuming you can trigger Jenkins job

Jenkins + Gradle + Artifactory: Couldn't read generated build info

假装没事ソ 提交于 2019-12-02 11:02:43
I'm trying to push my artifacts to Artifactory with Jenkins Pipeline, which call Gradle tool. I am following the examples published on GitHub: Example1 Example2 My Jenkins Pipeline script: stage('Perform Gradle Release') { //ssh-agent required to perform GIT push (when tagging the branch on release) sshagent([git_credential]) { sh "./gradlew clean release unSnapshotVersion -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=${release_version} -Prelease.newVersion=${development_version}" } // Create an Artifactory server instance def server = Artifactory.server('my-artifactory') //

Jenkins groovy pipeline - Need sout of command from executing jar file

丶灬走出姿态 提交于 2019-12-02 10:21:48
问题 I am using Jenkins v:1.647 and the Pipeline plugin v: 1.14. My pipeline job pulls a groovy script which runs my orchestration. My issue is I have a executable jar that will perform some Scalr API operations and return a new servers hostname, passed in standard out. I have a working snippet that works outside of Jenkins. def serverHostName = "java -jar scalr-api.jar testing654 n1-standard-8".execute().text This code works fine outside of Jenkins but my issue is when running my pipeline I

Why won't groovy run in Jenkins pipeline?

和自甴很熟 提交于 2019-12-02 08:08:56
问题 I am currently trying to run a groovy script from my pipeline as one of my nodes, but I ran into this error: [CompanyName] Running shell script + ./ideainspect.groovy env: groovy: No such file or directory Also, I tried installing the plugin for groovy, but for some reason, it won't install. Whenever I refresh the page for tools, the installer goes away. Am I installing groovy wrong? Please help! Edit: Relevant Data stage 'Static Analysis' node { dir("Android/btMobileApp") { sh "./ideainspect

Calling shell commands in groovy script, used in Jenkins pipeline

落花浮王杯 提交于 2019-12-02 07:31:11
I have a Jenkins pipeline script in that I load an external Groovy script that contains some functions to perform my build. These functions should be plain groovy because I also want to use them outside of Jenkins, if someone runs a build on a local computer somewhere. In these functions I need to execute shell commands and evaluate the result. This works fine in groovy calling a function like def SomeFunction() { def result = "Some shell command".execute().text } However, this method of execution doesn't work in a pipeline script. I can't use "bat/sh" because this is pipeline-script-only, and

Jenkins Pipelines: Why is CPS Global Lib not loading?

穿精又带淫゛_ 提交于 2019-12-02 06:17:41
问题 I'm following the tutorial on the pipeline library plugin. I made a repository containing the following files: D:. │ Test.groovy │ ├───src └───vars helloWorld.groovy helloWorld.groovy contains: def call(name){ echo "Hello world, ${name}" } Test.groovy contains: helloWorld("Joe") I installed all the pipeline plugins, in particular workflow-cps-global-lib-plugin. Then I created a new pipeline job in which I load this repository and set the Script Path to Test.groovy. When I run this job I get

Can you parse TAP format using Jenkins Pipeline?

笑着哭i 提交于 2019-12-02 04:58:39
I'm trying to parse the output from a BATS script ( https://github.com/gaia-adm/docker-bench-test ) which outputs into TAP format. I've modified the scripts slightly to cover CIS 1.13 instead of 1.11, but I don't know how to make Jenkins Pipeline handle that output. I know there is a Jenkins plugin for TAP format, but I don't believe this works with Jenkins Pipeline Groovy scripts. @Grab will work only if you jenkins has access to the internet workspace/job_name/tap.groovy @Grab(group='org.tap4j', module='tap4j', version='4.2.1') import org.tap4j.consumer.TapConsumerFactory def parse(def src){

Jenkins: get the build number of a Job triggered inside pipeline

二次信任 提交于 2019-12-02 04:33:45
问题 I have a pipeline which runs another bunch of jobs inside a stage: node{ stage("building_other_components") { build 'job1' build 'job2' }} How can I recover the build number or URL of these jobs? I just want to send the URL by mail ( Example: http://localhost:8080/job/job1/25 / last-changes/ , I will add the last-changes part) Thanks, 回答1: As long as you wait for the run to complete (defaults true ), you can access the result from the returned value of the build step. The returned value is of

Jenkins groovy pipeline - Need sout of command from executing jar file

∥☆過路亽.° 提交于 2019-12-02 04:20:56
I am using Jenkins v:1.647 and the Pipeline plugin v: 1.14. My pipeline job pulls a groovy script which runs my orchestration. My issue is I have a executable jar that will perform some Scalr API operations and return a new servers hostname, passed in standard out. I have a working snippet that works outside of Jenkins. def serverHostName = "java -jar scalr-api.jar testing654 n1-standard-8".execute().text This code works fine outside of Jenkins but my issue is when running my pipeline I receive the ever annoying RejectedAccessException.But unlike the other script security exceptions there is