jenkins-pipeline

Deploying Azure Webjobs from Jenkins pipeline

房东的猫 提交于 2021-02-11 16:59:39
问题 Please guide me to setup the procedure how to deploy the azure web jobs from Jenkins Pipeline. I have gone through the google of searching the documentation but couldn't able to make it. 回答1: After many tests I did it by adding the OutputPath parameter in the deploy script and deleting the folder before. The script looks like this: dir('Publish'){ deleteDir() } bat "\"${tool 'Your MS Build'}\" Path_To_Project.csproj /p:Configuration=Release /p:DeployOnBuild=true /p:AllowUntrustedCertificate

Is it possible to set the value of an environmental variable on an agent/node from a pipeline?

拥有回忆 提交于 2021-02-11 15:55:56
问题 I'm trying to pass the value for an environmental variable that set on the node under "Node Properties" Example: I have GIT_BRANCH environmental variable set on the node the value is passed to that variable is ${BRANCH_Z}. ${BRANCH_Z} value comes from a pipeline script like so pipeline { agent none; parameters { string(defaultValue: "master", description: 'Branch to build', name: 'BRANCH_Z') } environment { GIT_BRANCH = "${params.BRANCH_Z}" } But when I run this I get back params.BRANCH_Z as

Authenticating to Github reppository with Username and Password credentials in Jenkins pipeline

自作多情 提交于 2021-02-11 15:37:34
问题 I have created a Multibranch pipeline on Jenkins 2.107.2. I want to perform Git commands like git commit , git push etc on the cloned repository. To authenticate to the GitHub repository, I have configured my user credentials in Jenkins using (https://wiki.jenkins-ci.org/display/JENKINS/Credentials+Binding+Plugin). I have tried few approaches to use these credentials to authenticate but they result in different errors. First Approach stage('clone'){ steps{ checkout([$class: 'GitSCM', branches

Set the build unstable if sonar Quality Gate is failed

守給你的承諾、 提交于 2021-02-11 14:44:21
问题 I have a very simple pipeline. Everything is defined in my pom.xml files and .m2/settings.xml. I want to set my build as instable on Jenkins when SonarQube's Quality Gate is failed. Here is what I did but I have several errors like "expected }". Does anyone know how it works ? Note that the environment part is optional. Thank you. pipeline { agent { label "master" } tools { // Note: this should match with the tool name configured in your jenkins instance (JENKINS_URL/configureTools/) maven

Escaping parameters with white space in the docker .withRun command in Jenkins declarative pipeline

倖福魔咒の 提交于 2021-02-11 14:33:09
问题 Currently unable to get my head around how to correctly pass my parameters from Jenkins, to the docker .withRun function, in Jenkins Docker Plugin (specifically in declarative pipelines), which contain whitespace. Tried an unknown amount of methods to get this working and currently at a loss. See code below stage('Send Notifications') { steps { // Send a notification based on the parameters passed script { docker.withRegistry(registry, registryCredentials) { // echo "${TITLE}" docker.image(

Permission denied when connecting to docker daemon on jenkinsci/blueocean image deployed to kubernetes

萝らか妹 提交于 2021-02-11 14:32:57
问题 Summary Running a declarative pipeline job in jenkins which was deployed to a kubernetes cluster fails when using the docker agent with the following error: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.39/images/create?fromImage=node&tag=10.15.1: dial unix /var/run/docker.sock: connect: permission denied How can I solve this permission error in the kubernetes declaration? Background We have

How to pass powershell variable from one session to another or from one stage to another in terms of Jenkinsfile

只愿长相守 提交于 2021-02-11 12:29:37
问题 Every time I close the powershell session or window all the variable created in there is destroyed. Is there any command or way to create a variable which does not gets destoryed evenafter the session is closed. I know using script works but my situation is that my jenkins stage opens one window and creates a variable and the stage is closed which closes the session and in the next stage the new session is opened but all the initial variables are lost. I tried using jenkins environment

How do I escape a single quote inside single quotes in jenkins-pipeline bash command

北战南征 提交于 2021-02-11 12:13:11
问题 in jenkins-pipeline, I'm trying to use SED to append the following line to the end of a file. sh "sed -i '\$ s/\$/ public_file=\\/var\\/lib\\/jenkins\\/workspace\\/test-project\\ ansible_ssh_common_args='-o StrictHostKeyChecking=no' /' file.txt" but I can't figure out how to escape the below line in my Jenkins file to make it work. ansible_ssh_common_args='-o StrictHostKeyChecking=no' I've already tried the following, which works in katacoda playground, but not in jenkins pipeline. '"'"'-o

How do I escape a single quote inside single quotes in jenkins-pipeline bash command

倖福魔咒の 提交于 2021-02-11 12:11:53
问题 in jenkins-pipeline, I'm trying to use SED to append the following line to the end of a file. sh "sed -i '\$ s/\$/ public_file=\\/var\\/lib\\/jenkins\\/workspace\\/test-project\\ ansible_ssh_common_args='-o StrictHostKeyChecking=no' /' file.txt" but I can't figure out how to escape the below line in my Jenkins file to make it work. ansible_ssh_common_args='-o StrictHostKeyChecking=no' I've already tried the following, which works in katacoda playground, but not in jenkins pipeline. '"'"'-o

Jenkins concurrent builds on docker slaves

血红的双手。 提交于 2021-02-11 12:11:36
问题 I have a Jenkins Server (2.204.1) with Docker plugin (1.1.9) and a docker cloud API. I work with Jenkins docker agents (slaves) And i map the docker slave build workspace between the container and the host in order to be able to path Artifacts to the downstream jobs. in Jenkins Configuration - Docker Cloud Details - Container settings: Volumes /var/lib/jenkins:/var/lib/jenkins This works fine for a single build , The problem starts when i run concurrent builds, They are all mapped to the same