groovy

Can I use git command in delivery pipeline if git is installed in different path on jenkins agent than on master

◇◆丶佛笑我妖孽 提交于 2021-02-07 10:20:31
问题 I have the following scenario. I tried a simple pipeline job that clones my remote repo. It works fine when i set it to execute on master. node { //stage 'Checkout' git([url: 'ssh://someusername@gerrit.mycompany.domain:29418/bla/bla.git', branch: 'mybranch']) } It uses the default git installation to run the command. I have configured git on a different pat for slave in jenkins configuration. when i try to run the same pipeline on a slave, it fails because it always tries to go the default

Can I use git command in delivery pipeline if git is installed in different path on jenkins agent than on master

梦想与她 提交于 2021-02-07 10:20:10
问题 I have the following scenario. I tried a simple pipeline job that clones my remote repo. It works fine when i set it to execute on master. node { //stage 'Checkout' git([url: 'ssh://someusername@gerrit.mycompany.domain:29418/bla/bla.git', branch: 'mybranch']) } It uses the default git installation to run the command. I have configured git on a different pat for slave in jenkins configuration. when i try to run the same pipeline on a slave, it fails because it always tries to go the default

Jenkins Pipeline throttle other jobs

北慕城南 提交于 2021-02-07 08:42:01
问题 I'm trying to lock some other jobs from runing when a jenkins pipeline is running, I've been trying to use the exclusion-plugin or the throttle-concurrent-builds-plugin with this kind of structure : node(){ stage "test" allocate('test') sleep time: 15, unit: 'MINUTES' sh "echo 'yes'" } @NonCPS def allocate(String resource){ throttle = new hudson.plugins.throttleconcurrents.ThrottleJobProperty( maxConcurrentPerNode=1, maxConcurrentTotal=1, categories = [resource], throttleEnabled=true,

CompilerMojo#execute() caused a linkage error (java.lang.NoSuchMethodError) and may be out-of-date

本秂侑毒 提交于 2021-02-07 05:52:05
问题 I've searched google and reviewed answers on StackOverflow, but cannot seem to resolve this problem. I recently joined this project and added a few things to the POM. Being a relative neophyte with Maven, I am not grasping the issue and the response I have seen have not been clarifying. I suspect it is the addition of Groovy to the project. I want to use Groovy & Spock for testing (and, hopefully, eventually for prod as well). [INFO] Using Groovy-Eclipse compiler to compile both Java and

Jenkins/Hudson CLI API to modify the node labels using Groovy

不问归期 提交于 2021-02-07 05:31:51
问题 Does anyone know how to modify the Jenkins/Hudson node labels in a non-manually way? I mean, thorough an API like the CLI API that this tool offers (without restarting Jenkins/Hudson of course). My guess is that the best option is using a Groovy script to enter into the Jenkins/Hudson guts. Executing something like: java -jar -s HUDSON_URL:8080 groovy /path/to/groovy.groovy Being the content of that script something like: for (aSlave in hudson.model.Hudson.instance.slaves) { labels = aSlave

Jenkinsfile: permission denied when running sh step in Docker container

久未见 提交于 2021-02-06 20:49:56
问题 I have trouble running a simple Jenkinsfile - e.g. pipeline { agent { label 'ssh-slave' } stages { stage('Shell Test') { steps { sh 'echo "Hello World"' } } } } The logfiles of Jenkins on the master show that the container was started successfully but the build job crashes with a message like sh: 1: /home/jenkins/workspace/pipeline@tmp/durable-34c21b81/script.sh: Permission denied Here are some additional things that we configured / figured out: We are running the agent on a VM with RHEL We

Jenkinsfile: permission denied when running sh step in Docker container

此生再无相见时 提交于 2021-02-06 20:43:47
问题 I have trouble running a simple Jenkinsfile - e.g. pipeline { agent { label 'ssh-slave' } stages { stage('Shell Test') { steps { sh 'echo "Hello World"' } } } } The logfiles of Jenkins on the master show that the container was started successfully but the build job crashes with a message like sh: 1: /home/jenkins/workspace/pipeline@tmp/durable-34c21b81/script.sh: Permission denied Here are some additional things that we configured / figured out: We are running the agent on a VM with RHEL We

Get AWS EMR Cluster ID from Name

半城伤御伤魂 提交于 2021-02-06 13:59:38
问题 AWS CLI command aws emr list-clusters returns the following json. Is there a way through bash or groovy that I can use the Name to get the Id? I can't just use the Id becauseI am deleting clusters and rebuilding them with only the same name. So I know the name of the cluster is "my-cluster" and I would like to use it somehow to get the Id of the cluster. End case is I actually want the Master public DNS of the cluster. { "Clusters": [ { "Status": { "Timeline": { "ReadyDateTime": 1433200405

Get AWS EMR Cluster ID from Name

我的未来我决定 提交于 2021-02-06 13:57:09
问题 AWS CLI command aws emr list-clusters returns the following json. Is there a way through bash or groovy that I can use the Name to get the Id? I can't just use the Id becauseI am deleting clusters and rebuilding them with only the same name. So I know the name of the cluster is "my-cluster" and I would like to use it somehow to get the Id of the cluster. End case is I actually want the Master public DNS of the cluster. { "Clusters": [ { "Status": { "Timeline": { "ReadyDateTime": 1433200405

How to convert String to int in Groovy the right way

删除回忆录丶 提交于 2021-02-06 10:13:06
问题 First of all, I am aware of question 'Groovy String to int' and it's responses. I am a newbe to Groovy language and right now playing around some basics. The most straightforward ways to convert String to int seem to be: int value = "99".toInteger() or: int value = Integer.parseInt("99") These both work, but comments to these answers got me confused. The first method String.toInteger() is deprecated, as stated in groovy documentation. I also assume that Integer.parseInt() makes use of the