Jenkins

Jenkins Pipelines: How to use withCredentials() from a shared-variable script

荒凉一梦 提交于 2020-05-15 04:15:19
问题 I'd like to use a withCredentials() block in a shared-variable ("vars/") script rather than directly in the Jenkins pipeline because this is a lower-level semantic of a particular library, and also may or may not be required depending on the situation. However, withCredentials (or, at least, that signature of it) doesn't appear to be in scope. script: def credentials = [ [$class: 'UsernamePasswordMultiBinding', credentialsId: '6a55c310-aaf9-4822-bf41-5500cd82af4e', passwordVariable: 'GERRIT

How reliable is Tox' caching?

风流意气都作罢 提交于 2020-05-14 09:14:09
问题 I am using Tox as a wrapper around all the python code quality tools like flake8, mypy and pytest. I also invoke Tox from Jenkins. Currently, for every git push we create a fresh Conda environment holding python=3.7 and tox invoke tox, which will recreate all virtual environments freshly remove .tox/ and the Conda environment Due to this, running tox takes 2 seconds locally but 90 seconds in Jenkins. I now wonder whether we are to cautious. Would it be ok to leave the .tox/ cache folder alone

Jenkins Shared Library - Importing classes from the /src folder in /vars

我的梦境 提交于 2020-05-13 23:18:47
问题 I am trying to writing a Jenkins Shared Library for my CI process. I'd like to reference a class that is in the \src folder inside a global function defined in the \vars folder, since it would allow me to put most of the logic in classes instead of in the global functions. I am following the repository structure documented on the official Jenkins documentation: Jenkins Shared Library structure Here's a simplified example of what I have: /src/com/example/SrcClass.groovy package com.example

Jenkins Shared Library - Importing classes from the /src folder in /vars

限于喜欢 提交于 2020-05-13 23:16:23
问题 I am trying to writing a Jenkins Shared Library for my CI process. I'd like to reference a class that is in the \src folder inside a global function defined in the \vars folder, since it would allow me to put most of the logic in classes instead of in the global functions. I am following the repository structure documented on the official Jenkins documentation: Jenkins Shared Library structure Here's a simplified example of what I have: /src/com/example/SrcClass.groovy package com.example

Nodejs with jenkins plugin not executable in alpine image and displays “symbol not found”

核能气质少年 提交于 2020-05-13 19:25:12
问题 Background : We have node version 8 installed and is working fine in a Jenkins alpine based docker image (running in AWS ECS). The node 8 was installed in the jenkins-alpine docker image. Then, there came another requirement to install node js Jenkins plugin, so that custom version can be installed and applied as needed using global tools configuration, We installed nodejs 10 as shown in the image below: Nodejs Plugin failed to run in jenkins I then tried using the jenkins nodejs 10 plugin in

Run jenkins job as another user

|▌冷眼眸甩不掉的悲伤 提交于 2020-05-13 08:10:55
问题 I Installed jenkins using a guide, and that guide created a "jenkins" user in the server and apparently runs the jenkins server under it. All my setup on the server (virtual env, python package installations) is for a different user ("ci-user"). Is there any way for me to run my jobs as "ci_user" instead of as "jenkins"? I'd like to avoid doing all the setup again for the "jenkins" user. 回答1: There is JENKINS_USER variable in etc/default/jenkins file. You could change it to ci_user, then you

Jenkins GitHub pull request builder - get branch name for execute shell

别说谁变了你拦得住时间么 提交于 2020-05-13 06:27:59
问题 I am using Jenkins GitHub pull request builder plugin for running my unit tests when a pull request is made vis a vis a web hook. For the build step, I need to know the name of the branch that is being merged in (e.g. I need develop branch if merging that into master branch). Is there a way to get access to this in the Jenkins execute shell? Thanks, 回答1: Your link has the answer: The plugin makes some very useful environment variables available. ghprbActualCommit ghprbActualCommitAuthor

Jenkins GitHub pull request builder - get branch name for execute shell

狂风中的少年 提交于 2020-05-13 06:27:30
问题 I am using Jenkins GitHub pull request builder plugin for running my unit tests when a pull request is made vis a vis a web hook. For the build step, I need to know the name of the branch that is being merged in (e.g. I need develop branch if merging that into master branch). Is there a way to get access to this in the Jenkins execute shell? Thanks, 回答1: Your link has the answer: The plugin makes some very useful environment variables available. ghprbActualCommit ghprbActualCommitAuthor

Jenkins NodeJSPlugin node command not found

陌路散爱 提交于 2020-05-13 04:40:43
问题 The build shell is: echo $PATH which node ls -l /var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node_6.10.2/bin node -v The result is: /var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node_6.10.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin /var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node_6.10.2/bin/node -rwxrwxr-x 1 jenkins

Jenkins with Azure active directory authentication: REST API access not working with Bearer token

本小妞迷上赌 提交于 2020-05-12 04:46:19
问题 I need to access Jenkins REST API using python code. Need some guidance about the correct approach. I have hosted jenkins v2.176.1 in apache tomcat with SSL enabled. I have configured Azure AD authentication based on this. I am able to login using my Azure AD credentials in browser and access the REST API of jenkins. When i try to access the REST API from curl or postman based on the samples here i am able to get the access token but jenkins rest api(with Authorization: Bearer [access_token]