jenkins-pipeline

Jenkinsfile access aws credentials

青春壹個敷衍的年華 提交于 2020-01-03 10:21:33
问题 I am trying to access AWS credentials stored in Jenkins with following in jenkins pipeline ( Jenkinsfile ) steps { withCredentials([usernamePassword(credentialsId: 'eb1092d1-0f06-4bf9-93c7-32e5f7b9ef76', accessKeyVariable: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY')]) { sh 'echo $AWS_ACCESS_KEY_ID' sh 'echo $AWS_SECRET_ACCESS_KEY' } } Its erroring with org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: Could not find credentials entry with ID

Jenkinsfile access aws credentials

十年热恋 提交于 2020-01-03 10:21:15
问题 I am trying to access AWS credentials stored in Jenkins with following in jenkins pipeline ( Jenkinsfile ) steps { withCredentials([usernamePassword(credentialsId: 'eb1092d1-0f06-4bf9-93c7-32e5f7b9ef76', accessKeyVariable: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY')]) { sh 'echo $AWS_ACCESS_KEY_ID' sh 'echo $AWS_SECRET_ACCESS_KEY' } } Its erroring with org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: Could not find credentials entry with ID

Jenkins pipeline and Robot Framework results

随声附和 提交于 2020-01-03 08:39:09
问题 I had to implement a Pipeline and trying to find a way, how to publish Robot Framework results in Jenkins Pipeline. I found multiple questions about implementation of Robot Framework plugin into Pipeline and also found this question which seems to be solution. However I have tried this approach and results are still missing. Is there any workaround or functional example? 回答1: [Edited to reflect successful workaround] This comment on the issue tracker shows a workaround that seems to work:

Jenkins Pipeline conditional stage succeeds but Jenkins shows build as failed

冷暖自知 提交于 2020-01-03 07:24:11
问题 Jenkins version = 2.19 Jenkins Multibranch Pipeline plugin version = 2.92 I have a Jenkinsfile with a few conditional stages based on the branch. Here is a modified for the sake of brevity version of my Jenkinsfile: node { stage('Checkout') { checkout scm } stage('Clean Verify') { sh 'mvn clean verify' } if (env.BRANCH_NAME == "develop") { stage('Docker') { sh 'mvn docker:build -DpushImage' } } } I am using the multibranch pipeline plugin. It successfully detects and builds all my branches.

Commands fail when moving to them custom class in jenkinsfile

感情迁移 提交于 2020-01-03 02:52:10
问题 I'm setting up a new build. Running a simple shell command works perfectly, like below: stage("Demo") { sh "echo 'Hi There'" } I have been trying to "package" my shell scripts into their own classes just to neaten things up a bit. The problem is that when trying to execute the same exact shell script from within a class, jenkins fails the builds with: org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified method java.lang.Class sh java.lang.String This is a simple

How do i use the “Publish TAP Results” plugin on Jenkins 2.0 Pipeline?

两盒软妹~` 提交于 2020-01-02 10:22:36
问题 I would like to use the "Publish TAP results" plugin on Jenkins 2.0 pipeline. I'm not sure of the equivalent Groovy script for the same. Can someone help? 回答1: This support was added to the TAP plugin 2.0 (2016-08-20). Usage: step([$class: "TapPublisher", testResults: "**/target/tap-unit.log"]) https://issues.jenkins-ci.org/browse/JENKINS-34000 回答2: Currently there is no support for the pipeline, see https://issues.jenkins-ci.org/browse/JENKINS-34000. But you can create on GitHub a pull

How do i use the “Publish TAP Results” plugin on Jenkins 2.0 Pipeline?

别说谁变了你拦得住时间么 提交于 2020-01-02 10:21:15
问题 I would like to use the "Publish TAP results" plugin on Jenkins 2.0 pipeline. I'm not sure of the equivalent Groovy script for the same. Can someone help? 回答1: This support was added to the TAP plugin 2.0 (2016-08-20). Usage: step([$class: "TapPublisher", testResults: "**/target/tap-unit.log"]) https://issues.jenkins-ci.org/browse/JENKINS-34000 回答2: Currently there is no support for the pipeline, see https://issues.jenkins-ci.org/browse/JENKINS-34000. But you can create on GitHub a pull

mvn: command not found

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-02 09:28:18
问题 I'm trying to run a pipeline with jenkinsfile on a specific for which I don't have access to manage the path. But I'm having this error can any one know how to solve this one? 回答1: You need to install Maven on the build agent executing the job. An alternative by Jenkins is that it can install Maven for you. This can be configured in the Global Tool Configuration of the Jenkins Master. If you are really only allowed to modify the Jenkinsfile , you could first download and unpack maven into

Jenkinsfile with user input with variable in choices

懵懂的女人 提交于 2020-01-02 09:09:17
问题 I want to use new Jenkinsfile for new job. I have jenkinsfile wich I have in solo repository: I get branches from another gitlab repository by git ls-remote in bash. And I store them in variables: branch1, branch2, brach3.... Then I want to use these variables in user input choices script { env.BRANCHDEPLOY = input message: 'User input required', ok: 'Deploy!', parameters: [choice(name: 'Branch to deploy', choices: '${branch1}\n${branch2}\n${branch3}', description: 'What branch you wont

Jenkins Pipeline currentBuild duration time returns always 0

吃可爱长大的小学妹 提交于 2020-01-02 08:50:11
问题 I am trying to get build duration for our report but it always returns 0. From reading docs, going through Slack plugin source and reading other resources I should be able to do one of the following: def duration = currentBuild.duration def duration = currentBuild.durationString def duration = currentBuild.durationString() def duration = currentBuild.getDurationString() none of which works. From my understanding this might be because I am calling this before the build actually finished and so