How to update table in Confluence page from Jenkins job? - jenkins

I have a table on Confluence page. It contains the versions of my builds in Jenkins. As of now I update it manually. But I want to automate this by updating the table from Jenkins job.
To explain in more detail, I want to update row corresponding to the build with latest version.
How can this be achieved?

Related

List TFS Work Items during Jenkins Promote

I am looking for a way to produce all TFS Work Items from a Jenkins promote job.
We have an on prem deployment of TFS with service hooks in place to build the corresponding applications on check-in. The changeset Id is included with the notification, but I need the TFS work item for that Changeset.
More importantly - we will have several builds run; each with a singular changeset before we actuall run the promotion job.
What I would like to do is find a way to produce the list of TFS work items between releases. Looking a plug-in or tool that will help produce this.
Update
You should first get the built changeset info in Jenkins side.
There seems to be a build.changeSets variable which could retrieve all the changeset.
Then you could directly use rest api in TFS to query work items info from changeset ID. Detail steps kindly take a look at here: How to retrieve work items associated to a build in jenkins with pipeline?
According to your description, seems you just want to get all work items between releases (for example: the current release and a previous release).
Retrieve work items by calling
https://{account}.vsrm.visualstudio.com/[teamproject]/_apis/Release/releases/{current release id}/workitems?api-version=4.1-preview.1&baseReleaseId={release id}
It just return the id, url of work items, and then you need to get details of work item through Get a list of work items REST API.

how to get jenkins build urls related to a jira fix version?

I need some help to ingrate Jenkins with jira my user case is this one : i would like to feed urls of builds related to a Jira fix version. This is important for us ( audit & compliance purposes )
How can i do that ?
Think you in advance.
regards,
This is how we handled it:
Add a custom text field to every jira issue type. it can be 'build number' or 'build url' or whatever information you need to display regarding the jenkins build
Create a python script that receives as parameters a list of jira issues and a build number.
Using the JIRA python module (pip install jira), the script creates a connection to jira, goes over the list of issues and updates the custom field above to the given build number.
if the list of issues is not known in advance, then instead of parameter you can provide (or hard-code) a JQL query which the script can use to obtain the list of issues.
Depending on your needs, you may want to skip updating issues who already has a build
number set (either manually or by a previous build)
(Sorry, i can't share exact code but it shouldn't be complicated.)
In your Jenkins build, add a 'batch command' item which runs that python script with the appropriate parameters.

Is the Build Pipeline Trigger available in TFS on premise

I've got the latest update of TFS (Version 16.131.27701.1), this link seems to imply that the build pipeline trigger is available: build pipeline triggers
It does not show up on the triggers page for a given build just the Scheduled option.
triggers page
Is there something I need to enable or maybe I am misunderstanding the link.
That feature hasn't made its way on-prem yet. It's slated for "2019" (the next major release of TFS), per the Features Timeline page.

Passing values between promotions in Jenkins

I have a Jenkins job with two promotions steps. The first promotion creates a Jira ticket. The 2nd promotion needs to close the Jira ticket created in the first promotion. How can I pass the Jira ticket information (ie key/id) from the first promotion to the second promotion?
Possibly the following contains the information you're after:
☑ Promote builds when...
Promotion process
Actions
Add action
JIRA: Add related environment variables to build →
Extracts JIRA information for the build to environment variables.
Available variables:
 
JIRA_ISSUES - A comma separated list of issues which are referenced in the version control system changelog
I was able to resolve this issue by using the Copy files back to the job's workspace on the master node plugin in the first promotion step, and then use the Copy artifacts from another project plugin in the second promotion step to get those files.

Enable Perforce job creation for each issue that is created on JIRA

I followed the next guide:
https://ecosystem.atlassian.net/wiki/display/FISH/JIRA+FishEye+Plugin+2.5.3+-+Perforce+Job+Integration
and successfully created a link between Perforce and JIRA.
I did manage to create a Perforce job on JIRA issue creation while selecting that option with the p4 job custom field.
What I cannot configure is a creation of a job automatically for each issue for a specific project as described in the next section:
Creating Jobs for ALL issues in a project
Another method of creating jobs (without the need to configure custom fields) is to set the Always create jobs for issues in this project flag in the project-level Perforce administration screen."
I can't find that flag for some reason.
Can anyone assist with screenshots or any other helpful information?
Eventually what I need to do is that for each issue that is created in JIRA a job should be created in Perforce.
Thanks in advance,
Max.

Resources