jenkins-pipeline

How do Jenkins pipeline builds determine the workspace folder?

你离开我真会死。 提交于 2020-02-02 03:03:22
问题 In Jenkins pipeline, when a build is run on a particular node, a workspace is allocated on that agent. We do not set the workspace path, so it's automatically determined. I understand that the workspace must contain the executor number to isolate builds when the same job is running concurrently on the same agent. But... How exactly is the workspace path constructed? Our build is assigned to a particular node (with 4 executors) and is configured to not allow concurrent builds. Usually it was

How do Jenkins pipeline builds determine the workspace folder?

旧巷老猫 提交于 2020-02-02 03:03:10
问题 In Jenkins pipeline, when a build is run on a particular node, a workspace is allocated on that agent. We do not set the workspace path, so it's automatically determined. I understand that the workspace must contain the executor number to isolate builds when the same job is running concurrently on the same agent. But... How exactly is the workspace path constructed? Our build is assigned to a particular node (with 4 executors) and is configured to not allow concurrent builds. Usually it was

How to use multiple credentials in withCredentials in Jenkins Pipeline

自闭症网瘾萝莉.ら 提交于 2020-01-31 03:06:08
问题 I have the following step in my declarative jenkins pipeline: I create script which comes from my resources/ folder using libraryResource. This script contains credentials for my autobuild user and for some admintest user. stage('Build1') { steps { node{ def script = libraryResource 'tests/test.sh' writeFile file: 'script.sh', text: script sh 'chmod +x script.sh' withCredentials([usernamePassword(credentialsId: xxx, usernameVariable: 'AUTOBUILD_USER', passwordVariable: 'AUTOBUILD_PASSWD')]){

Setting Dependencies or Priorities in parallel stages in Jenkins pipeline

我的梦境 提交于 2020-01-30 06:05:48
问题 I am doing parallel steps as - stages { stage ('Parallel build LEVEL 1 - A,B,C ...') { steps{ parallel ( "Build A": { node('Build_Server_Stack') { buildAndArchive(A) // my code } }, "Build B" : { node('Build_Server_Stack') { buildAndArchive(B) } }, "Build C" : { node('Build_Server_Stack') { buildAndArchive(C) } } ) } } } Now I require to start the execution of B, after C is done. I can pull the B job out of the parallel block and add after the parallel block to achieve this. But in that case

Setting Dependencies or Priorities in parallel stages in Jenkins pipeline

可紊 提交于 2020-01-30 06:04:04
问题 I am doing parallel steps as - stages { stage ('Parallel build LEVEL 1 - A,B,C ...') { steps{ parallel ( "Build A": { node('Build_Server_Stack') { buildAndArchive(A) // my code } }, "Build B" : { node('Build_Server_Stack') { buildAndArchive(B) } }, "Build C" : { node('Build_Server_Stack') { buildAndArchive(C) } } ) } } } Now I require to start the execution of B, after C is done. I can pull the B job out of the parallel block and add after the parallel block to achieve this. But in that case

How to check if parameter/variable is available for Jenkins “Build with Parameters” in Groovy

萝らか妹 提交于 2020-01-30 05:43:30
问题 We used to be able to check if a parameter is available via: binding.variables.containsKey() or getBinding().hasVariable() But that no longer works at least as of Jenkins v 2.39. (These functions work for variables set within the groovy script but not the parameters from 'Build with Parameters'.) 回答1: Instead of using binding.variables.containsKey() to check, you should use: params.containsKey() 来源: https://stackoverflow.com/questions/42234822/how-to-check-if-parameter-variable-is-available

Jenkins - java.lang.IllegalArgumentException: Last unit does not have enough valid bits & Gradle error: Task 'null' not found in root project

无人久伴 提交于 2020-01-27 08:45:56
问题 Jenkins 2.176.4-3 rolling Gradle 4.3.1 Issue area : Parallel run of a given single Gradle task (or it could be any simple action) and especially when running concurrent runs of Jenkinsfile based pipelines All the sudden I got this error in Jenkins log page, never seen this error before (found no stackoverflow posts either for this error in Jenkins). Error: java.lang.IllegalArgumentException: Last unit does not have enough valid bits For some reason the previous build failed and automatically

Store Kubernetes Cluster Credentials in Jenkins and use in declarative pipeline

会有一股神秘感。 提交于 2020-01-25 09:26:11
问题 I am trying to deploy k8s cluster using Helm 3 and jenkins. Jenkins and k8s running on different servers.I merged the kubeconfig files and I had all information in one config file ./kube directory. I would like to deploy my app to the related environment and namespace according to the GIT_BRANCH value. I have two question for below script. 1.What is the best way should I store k8s cluster credentials and will use in pipeline. I saw some plugins such as Kubernetes CLI but I can not be sure

Why Jenkins mounts a temporary volume in addition to the workspace?

前提是你 提交于 2020-01-25 09:22:26
问题 I am using gulp to run my js app on the docker container from an image built using a dockerfile. I am an advanced beginner :) in Jenkins. dockerfile FROM node:10.11.0-alpine RUN apk update && apk add --no-cache git curl python py-pip bzip2 alpine-sdk && \ pip install --upgrade awscli && \ rm -rf /tmp/* /var/lib/apt/lists/* /var/cache/apk/* WORKDIR /app COPY . . ADD . /usr/src/app/. RUN chmod -R 777 /usr/src/app WORKDIR /usr/src/app jenkinsFile - I am using sequential stages. The first stage

Jenkins: trigger the same job from different BitBucket repositories

佐手、 提交于 2020-01-25 09:05:56
问题 I have 50+ repositories in a BitBucket project and I want them to execute the same job when a commit is pushed (that is maven build and deploy to artifactory). I tried to create a Maven job and make it work, but that can be linked to only one repository. I also tried installing the Bitbucket Team plugin and creating a project with it, and I think this could lead to a solution. In fact I saw that it scans automatically all the repositories with a JenkinsFile in it, so I thought that I could