Jenkins

Jenkins Pipeline stage skip based on groovy variable defined in pipeline

柔情痞子 提交于 2020-08-27 21:41:50
问题 I'm trying to skip a stage based a groovy variable and that variable value will be calculated in another stage. In the below example, Validate stage is conditionally skipped based Environment variable VALIDATION_REQUIRED which I will pass while building/triggering the Job. --- This is working as expected. Whereas the Build stage always runs even though isValidationSuccess variable is set as false . I tried changing the when condition expression like { return "${isValidationSuccess}" == true ;

Allow promotion of job in Jenkins pipeline

痴心易碎 提交于 2020-08-27 07:15:10
问题 I have a Jenkins pipeline which is responsible for about 5 stages (build and several different tests). I'm migrating from Jenkins 1.XX (with no pipelines) to Jenkins 2 and I'd like to replicate my process as closely as possible. The pipeline job I have set up on J2 handles everything exactly the same except it's using a JenkinsFile. The only issue is that the pipeline plugin does not appear to support Promotion of particular builds like you can do with Freestyle Jobs. Has anyone found a way

No such DSL method 'when' found among steps in Jenkinsfile

徘徊边缘 提交于 2020-08-27 04:09:26
问题 I want to execute some stage in loop. I have Jenkinsfile pipeline { agent any tools {} parameters {} environment {} stages { stage('Execute') { steps { script { for (int i = 0; i < hostnameMap.size; i++) { hostname = hostnameMap[i] echo 'Executing ' + hostname stage('Backup previous build ' + hostname) { backup(hostname, env.appHome) } stage('Deploy ' + hostname) { when { expression { env.BRANCH_NAME ==~ /(dev|master)/ } } steps { script { deploy(hostname , env.appHome, env.appName) } } }

Protractor How do I Start the Selenium Server on a Jenkins Build

﹥>﹥吖頭↗ 提交于 2020-08-26 08:39:59
问题 Some Background I've been reading up about Protractor Tests running on a Jenkins Server. I'm still a little confused as to how you can start the selenium server on a Jenkins Build. Since you need to first run the following 2 commands webdriver-manager update webdriver-manager start and then you need to run the appropriate protractor command protractor conf.js The Problem Once you've run the first 2 commands, you essentially need to leave that command window open for the server to continue to

XVFB and Selenium on EC2 - Unable to view Chrome UI on VNC Viewer

谁都会走 提交于 2020-08-26 05:38:18
问题 My Selenium headless tests are triggered from Jenkins server and run in EC2-Ubuntu. I want to view the test live on Chrome so I installed Xvfb plugin on Jenkins. On EC2 I installed Xvfb. When I start executing the build, my test starts execution and I see below logs: Xvfb /usr/bin/Xvfb :1 -fbdir /var/lib/jenkins/xvfb 27-..fbdir13700092919317283985 Parsing POMs Established TCP socket on 30810 and I see the test is running successfully. Now I do SSH to EC2 from Mac terminal by ssh -L 5901

XVFB and Selenium on EC2 - Unable to view Chrome UI on VNC Viewer

浪子不回头ぞ 提交于 2020-08-26 05:34:18
问题 My Selenium headless tests are triggered from Jenkins server and run in EC2-Ubuntu. I want to view the test live on Chrome so I installed Xvfb plugin on Jenkins. On EC2 I installed Xvfb. When I start executing the build, my test starts execution and I see below logs: Xvfb /usr/bin/Xvfb :1 -fbdir /var/lib/jenkins/xvfb 27-..fbdir13700092919317283985 Parsing POMs Established TCP socket on 30810 and I see the test is running successfully. Now I do SSH to EC2 from Mac terminal by ssh -L 5901