Jenkins

Jenkinsfile and multiple nodes

瘦欲@ 提交于 2020-12-29 07:13:03
问题 I have some code that needs running (build, test, and packages in actuality but for example just running tox ) on different OSes. Currently my Jenkinsfile looks like thus: pipeline { // Where to run stuff. agent { node { label 'CentOS7' customWorkspace '/home/build/jenkins/workspace/pipelines/ook' } } // What to run goes here. stages { stage('Tox') { steps { sh 'tox -v --recreate' } } } // Clean up after ourselves. post { failure { mail subject: "\u2639 ${env.JOB_NAME} (${env.BUILD_NUMBER})

Jenkinsfile and multiple nodes

不想你离开。 提交于 2020-12-29 07:12:57
问题 I have some code that needs running (build, test, and packages in actuality but for example just running tox ) on different OSes. Currently my Jenkinsfile looks like thus: pipeline { // Where to run stuff. agent { node { label 'CentOS7' customWorkspace '/home/build/jenkins/workspace/pipelines/ook' } } // What to run goes here. stages { stage('Tox') { steps { sh 'tox -v --recreate' } } } // Clean up after ourselves. post { failure { mail subject: "\u2639 ${env.JOB_NAME} (${env.BUILD_NUMBER})

Jenkinsfile and multiple nodes

房东的猫 提交于 2020-12-29 07:12:48
问题 I have some code that needs running (build, test, and packages in actuality but for example just running tox ) on different OSes. Currently my Jenkinsfile looks like thus: pipeline { // Where to run stuff. agent { node { label 'CentOS7' customWorkspace '/home/build/jenkins/workspace/pipelines/ook' } } // What to run goes here. stages { stage('Tox') { steps { sh 'tox -v --recreate' } } } // Clean up after ourselves. post { failure { mail subject: "\u2639 ${env.JOB_NAME} (${env.BUILD_NUMBER})

How to make a curl request with json in jenkins pipeline groovy script

最后都变了- 提交于 2020-12-29 05:52:42
问题 I am trying to make a New Relic deployment API call as a Jenkins build step using the Groovy pipeline. I'm having trouble because of the use of both single and double quotes within the shell ('sh') command on the groovy script. Whenever I execute the following: node { //... def json = '''\ {"deployment": {"revision": "v1","user": "me"}}' ''' sh "curl -o /dev/null -s -X POST 'https://api.newrelic.com/v2/applications/[redacted]/deployments.json' \ -H 'X-Api-Key:[redacted]' \ -H 'Content-Type:

How to make a curl request with json in jenkins pipeline groovy script

╄→尐↘猪︶ㄣ 提交于 2020-12-29 05:52:36
问题 I am trying to make a New Relic deployment API call as a Jenkins build step using the Groovy pipeline. I'm having trouble because of the use of both single and double quotes within the shell ('sh') command on the groovy script. Whenever I execute the following: node { //... def json = '''\ {"deployment": {"revision": "v1","user": "me"}}' ''' sh "curl -o /dev/null -s -X POST 'https://api.newrelic.com/v2/applications/[redacted]/deployments.json' \ -H 'X-Api-Key:[redacted]' \ -H 'Content-Type:

How to make a curl request with json in jenkins pipeline groovy script

限于喜欢 提交于 2020-12-29 05:52:15
问题 I am trying to make a New Relic deployment API call as a Jenkins build step using the Groovy pipeline. I'm having trouble because of the use of both single and double quotes within the shell ('sh') command on the groovy script. Whenever I execute the following: node { //... def json = '''\ {"deployment": {"revision": "v1","user": "me"}}' ''' sh "curl -o /dev/null -s -X POST 'https://api.newrelic.com/v2/applications/[redacted]/deployments.json' \ -H 'X-Api-Key:[redacted]' \ -H 'Content-Type:

use gcloud with Jenkins

人走茶凉 提交于 2020-12-29 04:00:22
问题 I've been trying to write a script that polls Google Cloud Storage periodically. This works fine when I run it normally, but if I include it as a build step in Jenkins, it gives a 403 Forbidden error. This is because there's no gcloud auth login process completed for the Jenkins user, which requires a verification code to be copied..how do I do that using Jenkins ? EDIT: I tried the steps at: https://cloud.google.com/storage/docs/authentication#service_accounts and downloaded a JSON key that

Jenkins disables project builds on branches after a pull request is issued

青春壹個敷衍的年華 提交于 2020-12-28 21:16:47
问题 Note: I only have Jenkinsfile set up in one of my branches, not the master. I have setup Git webhooks to monitor push events to my Github repository. However, I am noticing that my Jenkins builds are working fine (picking up push events, triggering builds) as branches, but after a pull request is issued, my branch build gets disabled in the Branches tab of my project. However, I do see the new PR listed in my Pull Requests tab. But now, when I push to Github, the new commits are not

How can I use `def` in jenkins pipeline

别等时光非礼了梦想. 提交于 2020-12-28 18:26:43
问题 I am learning jenkins pipeline, and I tried to follow this pipeline code. But my jenkins always complain that def is not legal. I am wondering did I miss any plugins? I already installed groovy , job-dsl , but doesn't work. 回答1: As @Rob said, There are 2 types of pipelines: scripted and declarative . It is like imperative vs declarative . def is only allowed in scripted pipeline or wrapped in script {} . Scripted pipeline (Imperative) Start with node , and def or if is allowed, like below. It

How can I set the jenkins authentication token?

我与影子孤独终老i 提交于 2020-12-28 18:23:32
问题 On my Jenkins build server, I want to set an Authentication Token so that only users that know the token can fire off builds. (As described here.) This doc page says that it should be configurable under my job's "Build Triggers" configuration. However, my server has no such fields, and I'm running the latest version (1.546). Mine looks like this: . As you can see, this doesn't really look like the docs say it should. How can I set this token? 回答1: You're missing the Trigger builds remotely (e