AtlassianPS / JiraPS

PowerShell module to interact with Atlassian JIRA
https://AtlassianPS.org/module/JiraPS
MIT License
322 stars 131 forks source link

Jira 2.12.0 can no longer query my Jira Server #372

Closed glennsarti closed 4 years ago

glennsarti commented 4 years ago

Description

I have automation to query my on premises Jira server. It did a basic Jira Issue query https://github.com/puppetlabs/pdk-planning/blob/master/tools/SyncProjects.ps1#L150-L183

However as of Jira 2.12.0 this functionality is silently failing.

Running some debugging I've found the following:

Jira 2.12

VERBOSE: [Get-JiraIssue] Function started
VERBOSE: [Get-JiraConfigServer] Function started
VERBOSE: [Get-JiraConfigServer] Complete
VERBOSE: [ConvertTo-URLEncoded] Encoding string to URL
VERBOSE: [Invoke-JiraMethod] Function started
VERBOSE: [ConvertTo-GetParameter] Making HTTP get parameter string out of a hashtable
VERBOSE:
Name                           Value
----                           -----
validateQuery                  True
maxResults                     25
fields                         -comment
expand                         transitions
jql                            project+%3d+%22Puppet+Development+Kit%22+and+fixVersion+%3d+%22PDK+August+Release%22

VERBOSE: [Get-JiraSession] Function started
VERBOSE: [Get-JiraSession] Complete
VERBOSE: [Invoke-JiraMethod] Get https://tickets.puppetlabs.com//rest/api/latest/search?validateQuery=True&maxResults=25&fields=-comment&expand=transitions&jql=project+%3d+"Puppet+Development+Kit"+and+fixVersion+%3d+"PDK+August+Release"
VERBOSE: [Invoke-JiraMethod] Failed to get an answer from the server
VERBOSE: [Test-ServerResponse] Checking response headers for authentication errors
VERBOSE: [Invoke-JiraMethod] Status code: NotFound
VERBOSE: [Resolve-ErrorWebResponse] Function started
VERBOSE: [Resolve-ErrorWebResponse] Retrieved body of HTTP response for more information about the error ($responseBody)
VERBOSE: [Resolve-ErrorWebResponse] Function ended
VERBOSE: [Invoke-JiraMethod] Function ended
VERBOSE: [Get-JiraIssue] Complete

Jira 2.11.1

VERBOSE: [Get-JiraIssue] Function started
VERBOSE: [Get-JiraConfigServer] Function started
VERBOSE: [Get-JiraConfigServer] Complete
VERBOSE: [ConvertTo-URLEncoded] Encoding string to URL
VERBOSE: [Invoke-JiraMethod] Function started
VERBOSE: [ConvertTo-GetParameter] Making HTTP get parameter string out of a hashtable
VERBOSE:
Name                           Value

----                           -----

expand                         transitions

validateQuery                  True

maxResults                     25

fields                         -comment

jql
project+%3d+%22Puppet+Development+Kit%22+and+fixVersion+%3d+%22PDK+August+2019%22

VERBOSE: [Get-JiraSession] Function started
VERBOSE: [Get-JiraSession] Complete
VERBOSE: [Invoke-JiraMethod] Get
https://tickets.puppetlabs.com/rest/api/latest/search?expand=transitions&validateQuery=True&maxResults=25&fields
=-comment&jql=project+=+"Puppet+Development+Kit"+and+fixVersion+=+"PDK+August+2019"
VERBOSE: [Test-ServerResponse] Checking response headers for authentication errors
VERBOSE: [Invoke-JiraMethod] Status code: 200
VERBOSE: [Invoke-JiraMethod] Invoking pagination [currentTotal: 0]

VERBOSE: [Invoke-JiraMethod] Function ended
VERBOSE: [Get-JiraIssue] Complete

Note the url used:

2.12.0 - https://tickets.puppetlabs.com//rest/api 2.11.1 - https://tickets.puppetlabs.com/rest/api

Indeed hitting those URLs manually, Jira is throwing a 404 for the double slash URL.

I suspect this is related to https://github.com/AtlassianPS/JiraPS/pull/370

Also no warnings or errors are thrown which is a concern. Surely a 404 should surface something.

Steps To Reproduce

Expected behavior

Should query and return the issues

Screenshots

Your Environment

Get-Module JiraPS -ListAvailable | Select Name, Version
$PSVersionTable

PS C:\projects\pdk-planning> Get-Module JiraPS -ListAvailable | Select Name, Version

Name Version


JiraPS 2.12.0



## Possible Solution

Workaround - pin to 2.11.1 until fixed.
lipkau commented 4 years ago

Thank you for reporting this. Fix should come out today.

btw: can I suggest

    if ($Issue.Status -in @('In progress', 'Ready for merge', 'Ready for test', 'Ready for ci', 'Ready for review')) { $hash['expectedColumn'] = 'In progress'}

for https://github.com/puppetlabs/pdk-planning/blob/13b397e60447ea6bb07bd6abd8cb129eb485e979/tools/SyncProjects.ps1#L169-L173 ?

glennsarti commented 4 years ago

Yeah. It grew organically so it's not quite fully optimised.