jenkins-pipeline

Why is Jenkins flagging an error with correct AWS CLI syntax?

本秂侑毒 提交于 2020-01-06 14:42:07
问题 I was having issues with escaping quotes for a shell command in Jenkins pipeline, so I asked in How to escape quotes in a AWS CLI in a Jenkins pipeline?, which was answered and the quotes are now escaped correctly when I run the command. However I get the following in Jenkins when I execute the following aws elbv2 CLI command in a pipeline + aws elbv2 modify-listener --listener-arn arn:aws:elasticloadbalancing:us-east-1:1234567890:listener/app/my-alb/123456789 --default-actions '[{"Type":

Branch specifier regex in Jenkins scripted pipeline

北城以北 提交于 2020-01-06 10:17:29
问题 Suppose i want to define pipeline for different branches under same scripted pipeline, how to define the regex for certain pattern of branches. Say for example :- if(env.BRANCH_NAME ==~ /release.*/){ stage("Deploy"){ echo 'Deployed release to QA' } Here i want to define that regex in such a way for any branch of the pattern *release* (meaning any branch with release string in it). How to achieve that? And similarly how to achieve something like :- if the branch is anything but develop, master

Branch specifier regex in Jenkins scripted pipeline

时光总嘲笑我的痴心妄想 提交于 2020-01-06 10:16:23
问题 Suppose i want to define pipeline for different branches under same scripted pipeline, how to define the regex for certain pattern of branches. Say for example :- if(env.BRANCH_NAME ==~ /release.*/){ stage("Deploy"){ echo 'Deployed release to QA' } Here i want to define that regex in such a way for any branch of the pattern *release* (meaning any branch with release string in it). How to achieve that? And similarly how to achieve something like :- if the branch is anything but develop, master

how to know which git branch triggered the jenkins job

我是研究僧i 提交于 2020-01-06 08:44:14
问题 I have a pipeline Jenkins job which is working as expected, configured with the option "GitHub hook trigger for GITScm polling" for auto build on any push to git repo. I have hooked this Jenkins URL for multiple git repo's say repo-A , repo-B , repo-B . Jenkins job is triggering automatically on any code pushes to these repo's. But I would like to know which repo has triggered the Jenkins job as it is configured to multiple git repo's at Jenkins level. Any help on this highly appreciated. 回答1

Jenkins: how to stop downstream projects when upstream is aborted

。_饼干妹妹 提交于 2020-01-06 08:38:37
问题 I have an upstream project in Jenkins which calls in sequence some downstream projects with the "Trigger/call builds on other projects" plugin. How can I automatically abort a build of any downstream project when I perform the aborting of the upstream project? If the upstream is aborted, the downstream is still running and I want a different behaviour. Thanks. 回答1: As mentioned in my comment, you can have downstream jobs listen to upstream jobs instead of having upstream jobs trigger

Terraform remote state in Jenkins

久未见 提交于 2020-01-06 06:51:34
问题 am working on a declarative Jenkins pipeline for Terraform deployments. I want to have the terraform state stored remotely in my s3 I get an error terraform apply -input=false ow.plan [31mFailed to load Terraform configuration or plan: open ow.plan: no such file or directory Any suggestions? Here's my code: pipeline { agent any tools { "org.jenkinsci.plugins.terraform.TerraformInstallation" "terraform" } parameters { choice(name: 'action', choices: 'create\ndestroy', description: 'Create

HTTP Request using Jenkins Pipeline Job

女生的网名这么多〃 提交于 2020-01-06 06:45:25
问题 I have been trying to do HTTP request in Jenkins Pipeline Job using HTTPRequest plugin script{def response = httpRequest authentication: 'CredentialsID', url: "https://host/api/project-summary/kj/?kj=123"} I have created Credentials with the ID 'CredentialID' in Jenkins. I am getting the following error when I build the job- I have already referred to this question on StackOverflow but it didn't help. Could someone point out the mistake in this or is there some other approach that I can use

How to replace --from tag in Dockerfile to be able to build the image from within Jenkins pipeline

让人想犯罪 __ 提交于 2020-01-06 06:41:44
问题 I have the following Dockerfile : FROM docker.m.our-intra.net/microsoft/dotnet:2.1-sdk WORKDIR /app COPY . ./aspnetapp/ WORKDIR /app/aspnetapp RUN dotnet publish -c Release -o out FROM docker.m.our-intra.net/microsoft/dotnet:2.1.4-aspnetcore-runtime WORKDIR /app COPY --from=docker.m.our-intra.net/microsoft/dotnet:2.1-sdk /app/aspnetapp/MyProject.WebApi/out ./ ENTRYPOINT ["dotnet", "MyProject.WebApi.dll"] The image is builded locally successfully. I'm trying to configure a Jenkins pipeline and

Jenkins Pipeline, downstream job and Agent label

删除回忆录丶 提交于 2020-01-06 05:15:09
问题 I have a Jenkins Pipeline that executes Job A and Job B. I have 10 agents/nodes on which Job A is executed. If I specify Agent1, when I Build Pipeline, then Job A should execute on Agent1. Issue: Pipeline is running on Agent1 and JobA is getting picked up on any random available agent. Script: pipeline { agent none stages { stage('JOB A') { agent { label "${machine}" } steps { build job: 'JOB A', parameters: [a,b,c,d,e,f] } } stage('JOB B') { agent { label 'xyz' } steps { build job: 'JOB B',

Continue Jenkins job after failed stage while marking stage as failed

安稳与你 提交于 2020-01-05 07:19:13
问题 I currently have separate perf tests running as 4 jenkins stages. Currently if a perf test fails the entire pipeline fails. I can mitigate this by wrapping in a try catch which will let me continue, but will mark the stage as a success when it has actually failed. I'd like to get a red failure box for the stage that has failed, and allow the other stages to run. I'm not worried if Jenkins marks the entire job as a failure, so long as the stage that failed is highlighted and doesn't prevent