When I using Jenkins Gerrit Trigger Plugin, I want to show my kick off Jenkins builds folder, I konw $GERRIT_PROJECT could show project name and $GERRIT_BRANCH could show branch name,but I want to show $GERRIT_PROJECT/$GERRIT_BRANCH/{this folder},I search this url:What environment variables are passed to Jenkins when using the Gerrit Trigger Plugin?, but not found my need, Does such environment variables exist?
Related
I have Jenkins Mutibranch pipeline. I want to integrate my Jira with one of multibranch project. I have installed the JIRA Trigger Plugin and configured Webhook in Jira. however, when I checked in my Jenkins job it does not show me the B***uild when an issue is updated in JIRA*** but it shows when I go to View Configuration in the particular branch. it allows me to select the Build when an issue is updated in JIRA but there is no option to save the changes. I know this might be a reason the option is view only. but how can I configure this?
Is anyone configured JIRA Trigger Plugin with Jenkins mutibranch project where using Jenkinsfile? and what is the correct way of integrating this?
Should I do some coding in the Jenkins file to get this done?
Current scenario: Build and deployment happens in development environment and the code is checked in to GIT and the JAR file is placed in Nexus. Then a change request is raised to deploy the same to the QA environments. The CR is attached with two parameterized text files (One of which contains the nexus path and other contains website URL) which act as input for parametrized build along with selection of environment. Run deploy
Target Scenario:We want to remove the CR part and in doing so we want a file (containing parameters which were attached in CR) which when pushed to GIT, a copy-paste should happen to the parametrized Jenkins job in respective parameters and select the environment from dropdown.
What is the best way to achieve this, either by creating another Jenkins job which can read the parameters from the file or is there any other way.
P.S. We don't want to make any editing in the existing Parameterized Jenkins jobs.
Using the Jenkins GitHub Plugin, you can create a separate job with a GitHub build trigger. By adding the GitHub repo (where the parameter file is pushed) to this Jenkins job, you can process the file to get the parameters you want in order to kick off the appropriate Jenkins jobs.
For Jenkins to process the parameters, one option is to use the EnvInject Plugin. (As suggested in this answer.) Another suggestion: Extended Choice Parameter Plugin (from this answer).
Is there a way/plugin to manipulate artifacts after build on Jenkins?
Basically, from the build result page, you can click on "MANIPULATE" link or button and execute a script/command.
Thank you.
One way you could accomplish this is:
Create a RESTful web service on the box running Jenkins. The endpoint would contain the logic/script that you want to execute. If you edit the artifact on the Jenkins master directly, it will get updated in the UI.
Add some simple HTML to the build description to call the RESTful end point you made in #1. For example, via a link target in a button or a tag. Note, you can also update the build description dynamically for each build using a plugin like Groovy Postbuild.
UPDATE
Note that if you don't want to create a web service running on the master, you can just invoke another job via the Jenkins remote access api that does the update for you using something like Groovy Postbuild Plugin. The Groovy postbuild step runs on the Jenkins master, so you technically have access to the entire filesystem as well as the Jenkins API.
For example, you would:
Create button that would start another job by hitting the url "http://myjenkinsurl/job/myjob/buildWithParameters?param1=test". Depending on your security, you might need to specify a token to kickoff jobs like this.
Inside that job write a groovy script to update the artifacts via Groovy Postbuild. For example, a small groovy script like
'copy C:\\Jenkins\\jobs\\myjob\\myartifact C:\\Backup'.execute(); could be used to backup the artifact somewhere else.
I have a Jenkins task that triggers on any changes made to a gitlab project.
There are a few situations I'd like to be able to set up, however I'm not sure how to best accomplish them. Most of it centers around being able to do the following:
Once the job is complete, I'd like to trigger another job that takes the contents of the first job's workspace (emptying out the initial one).
I'd like for a way to only run certain other jobs when the workspace contains a specific branch (automatically deploy develop branch to a preview environment).
"to trigger another job that takes the contents of the first job's workspace" see Shared workspace plugin:
This plugin allows to share workspaces by Jenkins jobs with the same SCM repos.
I normally check out code to a temp folder and run composer against the folder. If it passes, I then create a tag from within said folder. In Jenkins I can kick off composer just fine, but I need Jenkins to create the tag from the workspace and not from the branch.
If this can't be done using tagging feature within Jenkins, I suppose I could use a series of Post-Build scripts.
There is an option on Jenkins to tag a particular build, which captures the workspace at that point in time.
Using the GUI, it's the Tag this build option which appears when viewing a build.
Using a URL, it's
http://my-server:portnumber/jenkins/job/my_job_name/buildnumber/tagBuild/
Is that what you meant?