Jenkins

sudo inside Jenkins pipeline script

时光总嘲笑我的痴心妄想 提交于 2021-01-29 10:52:54
问题 We have the following setup: We have few UNIX boxes. There are users provisioned to these boxes (ex: spande ). These users have limited privileges, but can do sudo to elevate the permissions (sudo user: admin ). The sudo happens without any password. We have a CICD tool in Jenkins which uses these Unix boxes as slave. We have spande credentials to login into this unix servers via Jenkins. We are using Jenkins Pipeline Scripts (groovy). All is well, but we want the Jenkins script to run with a

Getting Jenkins build time when started

时光毁灭记忆、已成空白 提交于 2021-01-29 10:33:57
问题 I want to get the time when a build was started. I know the build name and number, but trick is the build may not have completed yet. The script can run on the Jenkins server or can be an API call. Any way I can accomplish that? 回答1: You can install ZenTimestamp Plugin and get the time stamp using BUILD_TIMESTAMP variable added by this plugin. Note: You need to specify SimpleDateFormat pattern (e.g. yyyyMMddHHmmss ). You must activate the Global Property! 回答2: Under the Jenkins job you will

sending email notifications to all developers who committed changes in a branch - Jenkins

守給你的承諾、 提交于 2021-01-29 10:05:24
问题 I want to send email notifications to all developers who committed changes in a branch. I'm using a Freestyle project integrated with Github. I've searched a lot but didn't find a solution. Any help is greatly appreciated. Thanks 回答1: You can do this as follows: Install and configure the Email-ext plugin. In your job configuration page, click Add post-build action and select Editable Email Notification . Click Advanced Settings . Under your preferred build status conditions, click Add and

How to pass parameter in curl while calling Jenkins job without using buildWithParameters

梦想与她 提交于 2021-01-29 09:50:14
问题 My Jenkins pipeline job is not parameterized, but while calling the job from a pipeline script I can provide parameters that are getting used inside my current job. I would like to pass those parameters from outside using a curl command. I tried the following options but am yet to be successful. curl -i -X POST 'https://<USERNAME>:<API_TOKEN>@JENKINS_URL/job/DS_JOB1/build?token=remotejob' --data-urlencode json='{"parameter": [{"PLATFORM":"Value1", "PROJECT": "Project_Type"}]}' This doesn't

Jenkins GitHub plugin, readTrusted stage fails with 404 if the tag was pushed to origin/master

北城余情 提交于 2021-01-29 09:03:48
问题 Jenkins build job started to fail if the tag was pushed to the origin/master. We're using a private repository, credentials are Ok, validate works correctly. In case of commit to master build successfully build. Steps to reproduce: git push origin <tagname> press build job -> will lead to error described below in log section Pipeline Steps: Start of Pipeline - (5.3 sec in block) __________Success Read trusted file from SCM - (0.76 sec in self) _ Failed If I remove the tag and commit some

jacoco:report error NoClassDefFoundError

谁都会走 提交于 2021-01-29 08:00:42
问题 I'm trying to testing using jacoco with jenkins,eclipse,maven. previously jacoco:report was done well. But now it does not works. If I try jacoco:report, this error evoke. [INFO] --- jacoco-maven-plugin:0.7.4.201502262128:report (default-cli) @ testPage --- [WARNING] Error injecting: org.apache.maven.doxia.siterenderer.DefaultSiteRenderer java.lang.NoClassDefFoundError: org/codehaus/plexus/util/xml/XmlStreamReader at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class

How to use Jenkins String Parameter in pipeline

不想你离开。 提交于 2021-01-29 07:57:41
问题 We am using Jenkins Pipeline to configure jobs in jenkins. For a bunch of jobs we need user input for which we use parameterised build where user can input parameter values and later we use the values in our .jenkinsfile in sh like sh "./build-apply.sh ${accountnumber} ${volumename} ${vpcname} services ${snapshotid}" This used to work with Jenkins 2.16 Pipeline 2.3 Groovy 2.15 However, when I rebuild Jenkins to: 2.16 or latest 2.26 Pipeline 2.5 Pipeline: Groovy 2.19 The above sh stopped

ERROR npm ERR! errno 126, when running postman collections using maven in Jenkins

混江龙づ霸主 提交于 2021-01-29 07:45:14
问题 *I am trying to run postman collections using Maven in Jenkins. I get below errors when the pipeline is run. I can run these locally with 'mvn clean verify' in intellij and all tests run successfully. I am bit lost as how to solve this issue and looking for some help.:- [INFO] --- frontend-maven-plugin:1.6:npm (merge) @ ihtests --- [INFO] Running 'npm run shipment-tests' in /var/jenkins/workspace/com.tcel_intests_merge/temp [INFO] [INFO] > postman-newman-jenkins@1.0.0 shipment-tests /var

Use special agent for whole pipeline when a condition is met

浪子不回头ぞ 提交于 2021-01-29 07:44:20
问题 There is declarative pipeline. In the beginning of pipeline block the agent selection is made using agent directive. Label-based selection is being conducted. Agent selected this way is the standard/default agent. How to set for whole pipeline a special agent when certain condition is met? The plan is to do condition check based on pipeline's one parameter >> can that work? What are the points the chosen approach needs to address? Current solution blueprint: Groovy code prior to pipeline

Cloudformation giving error “Requires capabilities : [CAPABILITY_AUTO_EXPAND]”

喜夏-厌秋 提交于 2021-01-29 07:30:52
问题 I am trying to implement Continuous Deployment for my .net core app. When lambda function is invoked, I'am trying to create a cloudformation to spin up the resources. But getting error: Creating Cloud Formation stack: gateway-api-uat-stack Failed to create stack: gateway-api-uat-stack. Reason: Detailed Message: Requires capabilities : [CAPABILITY_AUTO_EXPAND] (Service: AmazonCloudFormation; Status Code: 400; Error Code: InsufficientCapabilitiesException; Request ID: 4779587c-2a17-11e9-a093