educationperfect / azure-jira-update Goto Github PK
View Code? Open in Web Editor NEWUpdate Jira with Azure Deployment Information
License: MIT License
Update Jira with Azure Deployment Information
License: MIT License
I am a little lost on how and where to install this in Azure Pipelines. Could you provide a step-by-step solution with screenshots?
2021-11-16T23:09:32.3549810Z ##[section]Starting: Update JIRA status
2021-11-16T23:09:32.3560493Z ==============================================================================
2021-11-16T23:09:32.3561398Z Task : PowerShell
2021-11-16T23:09:32.3562156Z Description : Run a PowerShell script on Linux, macOS, or Windows
2021-11-16T23:09:32.3563062Z Version : 2.194.0
2021-11-16T23:09:32.3563699Z Author : Microsoft Corporation
2021-11-16T23:09:32.3564531Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
2021-11-16T23:09:32.3565420Z ==============================================================================
2021-11-16T23:09:32.4938693Z Generating script.
2021-11-16T23:09:32.4980409Z ========================== Starting Command Output ===========================
2021-11-16T23:09:32.5001748Z [command]/usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -Command . '/home/vsts/work/_temp/2b1d2e8b-b13a-45f1-8c0c-b08571eae222.ps1'
2021-11-16T23:09:33.2519096Z VERBOSE: Exporting function 'Add-JiraDeploymentInformation'.
2021-11-16T23:09:33.2521368Z VERBOSE: Exporting function 'Update-AzureDeploymentInformation'.
2021-11-16T23:09:34.8173089Z [Deployment Reponse] {
2021-11-16T23:09:34.8174818Z "acceptedDeployments": [],
2021-11-16T23:09:34.8175809Z "rejectedDeployments": [
2021-11-16T23:09:34.8176668Z {
2021-11-16T23:09:34.8177481Z "key": {
2021-11-16T23:09:34.8178345Z "pipelineId": "53",
2021-11-16T23:09:34.8179235Z "environmentId": "19",
2021-11-16T23:09:34.8180180Z "deploymentSequenceNumber": 1637104174
2021-11-16T23:09:34.8181106Z },
2021-11-16T23:09:34.8181931Z "errors": [
2021-11-16T23:09:34.8182930Z {
2021-11-16T23:09:34.8183959Z "message": "Associations must provide at least one value."
2021-11-16T23:09:34.8184965Z }
2021-11-16T23:09:34.8185767Z ]
2021-11-16T23:09:34.8186556Z }
2021-11-16T23:09:34.8187331Z ],
2021-11-16T23:09:34.8188166Z "unknownIssueKeys": [],
2021-11-16T23:09:34.8189072Z "unknownAssociations": []
2021-11-16T23:09:34.8189902Z }
2021-11-16T23:09:34.8270906Z
2021-11-16T23:09:34.8307083Z acceptedDeployments rejectedDeployments unknownIssueKeys unknownA
2021-11-16T23:09:34.8316425Z ssociati
2021-11-16T23:09:34.8317823Z ons
2021-11-16T23:09:34.8319517Z ------------------- ------------------- ---------------- --------
2021-11-16T23:09:34.8320674Z {} {@{key=; errors=System.Object[]}} {} {}
2021-11-16T23:09:34.8327720Z
2021-11-16T23:09:34.9076348Z ##[section]Finishing: Update JIRA status
This is primarily to help others who need to access the internal (private) functions in this excellent plugin.
https://dev.azure.com/<Organization Name>/
$DebugPreference="Continue"
$Features = Import-Module (Join-Path ".." "azure-jira-update" "EP.PowerShell.JiraDeployInfo") -PassThru # Allows us to access the private functions in this module
$SystemAccessToken = $env:SYSTEM_TOKEN # can use your Personal Access Token
$AzureChangeUrl = "$env:SYSTEM_COLLECTIONURI/$env:SYSTEM_TEAMPROJECT/_traceability/runview/changes?currentRunId=$($env:BUILD_BUILDID)&__rt=fps"
$jiraIds = @()
$jiraIds += ( & $Features `
{
param($SystemAccessToken, $AzureChangeUrl)
Get-JiraIDsFromAzureChanges -SystemAccessToken $SystemAccessToken -AzureChangeUrl $AzureChangeUrl
} `
-SystemAccessToken $SystemAccessToken -AzureChangeUrl $AzureChangeUrl )
$jiraIds
I'm going to see if I can test the PowerShell scripts locally using the build values from a previous pipeline run. Any pointers would be appreciated.
First up. This is a life saver, and would be well worth publishing on the Devops Marketplace.
We use a sync tool which adds the Jira ID into a custom field on the Work Item, and then we reference the work item on a Pull Request so it is included as a linked item on the build/release.
It would be amazing if this plugin could optionally take the Jira ID from this field instead of only scanning the ChangeSet messages.
Is this something that you would be interested in adding? If not I might take a stab at it.
Hi,
so I did my initial test with the scripts, and looks really nice. Now I was about to push this to my pipelines just to see it in action. But I think I have a problem here (like quite some others). And maybe you have an idea how to resolve that.
So from my understanding looking at the script you ask the release pipeline for the changes, such that you can extract the Issue Numbers....the thing is: using Bitbucket (Cloud) is not capable to transport that information into Azure. SO checking for Issues, or Commits, it is actually always empty.
Any Idea how to get that information via an alternative way?!
so we have Jira ABC-123-> Bitbucket [ABC-123_BanchName,CommitMsg: Ref_ABC-123] -> DevOps Ppielines (PR,CI) -> Release.
Or do I do something wrong with DevOps that it looses the Issues?
Any Ideas is welcome :)
I can finally ditch classic release pipelines (along with the awful Azure Pipelines for Jira app)!
When using your example of the Pending > InProgress > Successful/Failed as part of a single deploy task, it is incorrectly creating multiple separate deployments, rather than changing the status of the existing one.
I checked the Jira docs and can see that a new deployment will be created based on a unique combination of pipelineId, environmentId and deploymentSequenceNumber.
https://developer.atlassian.com/cloud/jira/software/rest/api-group-deployments/#api-group-deployments
This line causes the issue. I would suggest replacing the datetime with the buildid.
Thanks,
Basil
We have encountered a persistent error while running Add-JiraDeploymentInformation.ps1.
When executing the integration without an associated issue key in Jira, an error occurs. The error message received is as follows:
Invoke-RestMethod: /agent/_work/23/s/EP.PowerShell.JiraDeployInfo/Public/Add-JiraDeploymentInformation.ps1:181
Line |
181 | … $response = Invoke-RestMethod -uri "https://api.atlassian.com/jira/de …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| [{"message":"Associations must provide at least one value."}]
It appears that the issue stems from the Jira API, which no longer accepts association properties without a value.
Hi ! I had this issue:
Cannot convert value "1648551970,87108" to type "System.Int32". Error: "Input string was not in a correct format."
when calling Add-JiraDeploymentInformation in a local powershell session.
turned out to be this line in the code:
updateSequenceNumber = (Get-Date -UFormat "%s");
I changed it to:
updateSequenceNumber = [math]::Round((Get-Date -UFormat "%s"));
not sure if this is a local setting that makes it that strange none int number.
Also in term of the readme that says " you can call this locally" - there is also
deploymentSequenceNumber = [Int]($env:BUILD_BUILDID);
that actually is a pipeline parameter and should look different :)
Using Win10, Powershell 5.1
Apart from that! So happy you made this! So sad that MS didn't manage to integrate with Jira AND Bitbucket correctly with their extensions.
Starting: Update JIRA status
==============================================================================
Task : PowerShell
Description : Run a PowerShell script on Linux, macOS, or Windows
Version : 2.194.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
==============================================================================
Generating script.
========================== Starting Command Output ===========================
/usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -Command . '/home/vsts/work/_temp/c8c03347-497e-4f0b-b5fa-9d587c92c8dc.ps1'
VERBOSE: Exporting function 'Add-JiraDeploymentInformation'.
VERBOSE: Exporting function 'Update-AzureDeploymentInformation'.
acceptedDeployments rejectedDeployments unknownIssueKeys unknownA
ssociati
ons
------------------- ------------------- ---------------- --------
{} {@{key=; errors=System.Object[]}} {} {}
Finishing: Update JIRA status
Please let me know if you need any info.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.