Skip to content

Commit

Permalink
Merge pull request #409 from lipkau/fix/#404-UpdatingApiForUserData
Browse files Browse the repository at this point in the history
Workaround: fix #404 updating api for user data
  • Loading branch information
lipkau authored Mar 28, 2020
2 parents ca56170 + f7e04b7 commit 1f243a2
Show file tree
Hide file tree
Showing 74 changed files with 176 additions and 167 deletions.
18 changes: 11 additions & 7 deletions JiraPS.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@ task GetNextVersion {

#region HarmonizeVariables
switch ($true) {
{$IsWindows} {
{ $IsWindows } {
$OS = "Windows"
if (-not ($IsCoreCLR)) {
$OSVersion = $PSVersionTable.BuildVersion.ToString()
}
}
{$IsLinux} {
{ $IsLinux } {
$OS = "Linux"
}
{$IsMacOs} {
{ $IsMacOs } {
$OS = "OSX"
}
{$IsCoreCLR} {
{ $IsCoreCLR } {
$OSVersion = $PSVersionTable.OS
}
}
Expand Down Expand Up @@ -185,7 +185,7 @@ task GenerateExternalHelp Init, {
task UpdateManifest GetNextVersion, {
Remove-Module $env:BHProjectName -ErrorAction SilentlyContinue
Import-Module $env:BHPSModuleManifest -Force
$ModuleAlias = @(Get-Alias | Where-Object {$_.ModuleName -eq "$env:BHProjectName"})
$ModuleAlias = @(Get-Alias | Where-Object { $_.ModuleName -eq "$env:BHProjectName" })

BuildHelpers\Update-Metadata -Path "$env:BHBuildOutput/$env:BHProjectName/$env:BHProjectName.psd1" -PropertyName ModuleVersion -Value $env:NextBuildVersion
# BuildHelpers\Update-Metadata -Path "$env:BHBuildOutput/$env:BHProjectName/$env:BHProjectName.psd1" -PropertyName FileList -Value (Get-ChildItem "$env:BHBuildOutput/$env:BHProjectName" -Recurse).Name
Expand Down Expand Up @@ -247,7 +247,7 @@ task Deploy Init, PublishToGallery, TagReplository, UpdateHomepage
# Synpsis: Publish the $release to the PSGallery
task PublishToGallery {
Assert-True (-not [String]::IsNullOrEmpty($PSGalleryAPIKey)) "No key for the PSGallery"
Assert-True {Get-Module $env:BHProjectName -ListAvailable} "Module $env:BHProjectName is not available"
Assert-True { Get-Module $env:BHProjectName -ListAvailable } "Module $env:BHProjectName is not available"

Remove-Module $env:BHProjectName -ErrorAction Ignore

Expand All @@ -258,6 +258,8 @@ task PublishToGallery {
task TagReplository GetNextVersion, Package, {
$releaseText = "Release version $env:NextBuildVersion"

Set-GitUser

# Push a tag to the repository
Write-Build Gray "git checkout $ENV:BHBranchName"
cmd /c "git checkout $ENV:BHBranchName 2>&1"
Expand All @@ -283,6 +285,8 @@ task TagReplository GetNextVersion, Package, {
# Synopsis: Update the version of this module that the homepage uses
task UpdateHomepage {
try {
Set-GitUser

Write-Build Gray "git close .../AtlassianPS.github.io --recursive"
$null = cmd /c "git clone https://github.com/AtlassianPS/AtlassianPS.github.io --recursive 2>&1"

Expand All @@ -307,7 +311,7 @@ task UpdateHomepage {

Pop-Location
}
catch { Write-Warning "Failed to deploy to homepage"}
catch { Write-Warning "Failed to deploy to homepage" }
}
#endregion Publish

Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Add-JiraGroupMember.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function Add-JiraGroupMember {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/group/user?groupname={0}"
$resourceURi = "$server/rest/api/2/group/user?groupname={0}"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Add-JiraIssueLink.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function Add-JiraIssueLink {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/issueLink"
$resourceURi = "$server/rest/api/2/issueLink"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Find-JiraFilter.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function Find-JiraFilter {

$server = Get-JiraConfigServer -ErrorAction Stop

$searchURi = "$server/rest/api/latest/filter/search"
$searchURi = "$server/rest/api/2/filter/search"

[String]$Fields = $Fields -join ','
}
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Get-JiraComponent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function Get-JiraComponent {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest{0}"
$resourceURi = "$server/rest/api/2{0}"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Get-JiraField.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/field"
$resourceURi = "$server/rest/api/2/field"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Get-JiraFilter.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/filter/{0}"
$resourceURi = "$server/rest/api/2/filter/{0}"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Get-JiraGroup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Get-JiraGroup {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/group?groupname={0}"
$resourceURi = "$server/rest/api/2/group?groupname={0}"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Get-JiraGroupMember.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function Get-JiraGroupMember {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/group/member"
$resourceURi = "$server/rest/api/2/group/member"

if ($PageSize -gt 50) {
Write-Warning "JIRA's API may not properly support MaxResults values higher than 50 for this method. If you receive inconsistent results, do not pass the MaxResults parameter to this function to return all results."
Expand Down
4 changes: 2 additions & 2 deletions JiraPS/Public/Get-JiraIssue.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ function Get-JiraIssue {

$server = Get-JiraConfigServer -ErrorAction Stop

$searchURi = "$server/rest/api/latest/search"
$resourceURi = "$server/rest/api/latest/issue/{0}"
$searchURi = "$server/rest/api/2/search"
$resourceURi = "$server/rest/api/2/issue/{0}"

[String]$Fields = $Fields -join ","
}
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Get-JiraIssueCreateMetadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function Get-JiraIssueCreateMetadata {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/issue/createmeta?projectIds={0}&issuetypeIds={1}&expand=projects.issuetypes.fields"
$resourceURi = "$server/rest/api/2/issue/createmeta?projectIds={0}&issuetypeIds={1}&expand=projects.issuetypes.fields"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Get-JiraIssueEditMetadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function Get-JiraIssueEditMetadata {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/issue/{0}/editmeta"
$resourceURi = "$server/rest/api/2/issue/{0}/editmeta"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Get-JiraIssueLinkType.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function Get-JiraIssueLinkType {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/issueLinkType{0}"
$resourceURi = "$server/rest/api/2/issueLinkType{0}"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Get-JiraIssueType.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/issuetype"
$resourceURi = "$server/rest/api/2/issuetype"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Get-JiraPriority.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function Get-JiraPriority {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/priority{0}"
$resourceURi = "$server/rest/api/2/priority{0}"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Get-JiraProject.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function Get-JiraProject {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/project{0}?expand=description,lead,issueTypes,url,projectKeys"
$resourceURi = "$server/rest/api/2/project{0}?expand=description,lead,issueTypes,url,projectKeys"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Get-JiraServerInformation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function Get-JiraServerInformation {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/serverInfo"
$resourceURi = "$server/rest/api/2/serverInfo"
}

process {
Expand Down
6 changes: 3 additions & 3 deletions JiraPS/Public/Get-JiraUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ function Get-JiraUser {

$server = Get-JiraConfigServer -ErrorAction Stop

$selfResourceUri = "$server/rest/api/latest/myself"
$searchResourceUri = "$server/rest/api/latest/user/search?username={0}"
$exactResourceUri = "$server/rest/api/latest/user?username={0}"
$selfResourceUri = "$server/rest/api/2/myself"
$searchResourceUri = "$server/rest/api/2/user/search?username={0}"
$exactResourceUri = "$server/rest/api/2/user?username={0}"

if ($IncludeInactive) {
$searchResourceUri += "&includeInactive=true"
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Get-JiraVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/{0}"
$resourceURi = "$server/rest/api/2/{0}"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Move-JiraVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

$server = Get-JiraConfigServer -ErrorAction Stop

$versionResourceUri = "$server/rest/api/latest/version/{0}/move"
$versionResourceUri = "$server/rest/api/2/version/{0}/move"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/New-JiraFilter.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function New-JiraFilter {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/filter"
$resourceURi = "$server/rest/api/2/filter"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/New-JiraGroup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/group"
$resourceURi = "$server/rest/api/2/group"
}

process {
Expand Down
4 changes: 2 additions & 2 deletions JiraPS/Public/New-JiraIssue.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function New-JiraIssue {

$createmeta = Get-JiraIssueCreateMetadata -Project $Project -IssueType $IssueType -Credential $Credential -ErrorAction Stop -Debug:$false

$resourceURi = "$server/rest/api/latest/issue"
$resourceURi = "$server/rest/api/2/issue"

Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] ParameterSetName: $($PsCmdlet.ParameterSetName)"
Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] PSBoundParameters: $($PSBoundParameters | Out-String)"
Expand Down Expand Up @@ -177,7 +177,7 @@ function New-JiraIssue {
if ($PSCmdlet.ShouldProcess($Summary, "Creating new Issue on JIRA")) {
if ($result = Invoke-JiraMethod @parameter) {
# REST result will look something like this:
# {"id":"12345","key":"IT-3676","self":"http://jiraserver.example.com/rest/api/latest/issue/12345"}
# {"id":"12345","key":"IT-3676","self":"http://jiraserver.example.com/rest/api/2/issue/12345"}
# This will fetch the created issue to return it with all it'a properties
Write-Output (Get-JiraIssue -Key $result.Key -Credential $Credential)
}
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/New-JiraUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function New-JiraUser {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/user"
$resourceURi = "$server/rest/api/2/user"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/New-JiraVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/version"
$resourceURi = "$server/rest/api/2/version"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Remove-JiraGroup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/group?groupname={0}"
$resourceURi = "$server/rest/api/2/group?groupname={0}"

if ($Force) {
Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] -Force was passed. Backing up current ConfirmPreference [$ConfirmPreference] and setting to None"
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Remove-JiraGroupMember.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function Remove-JiraGroupMember {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/group/user?groupname={0}&username={1}"
$resourceURi = "$server/rest/api/2/group/user?groupname={0}&username={1}"

if ($Force) {
Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] -Force was passed. Backing up current ConfirmPreference [$ConfirmPreference] and setting to None"
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Remove-JiraIssue.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function Remove-JiraIssue {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/issue/{0}?deleteSubtasks={1}"
$resourceURi = "$server/rest/api/2/issue/{0}?deleteSubtasks={1}"

if ($Force) {
Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] -Force was passed. Backing up current ConfirmPreference [$ConfirmPreference] and setting to None"
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Remove-JiraIssueAttachment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function Remove-JiraIssueAttachment {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/attachment/{0}"
$resourceURi = "$server/rest/api/2/attachment/{0}"

if ($Force) {
Write-DebugMessage "[Remove-JiraGroupMember] -Force was passed. Backing up current ConfirmPreference [$ConfirmPreference] and setting to None"
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Remove-JiraIssueLink.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function Remove-JiraIssueLink {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/issueLink/{0}"
$resourceURi = "$server/rest/api/2/issueLink/{0}"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Remove-JiraRemoteLink.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function Remove-JiraRemoteLink {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/issue/{0}/remotelink/{1}"
$resourceURi = "$server/rest/api/2/issue/{0}/remotelink/{1}"

if ($Force) {
Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] -Force was passed. Backing up current ConfirmPreference [$ConfirmPreference] and setting to None"
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Remove-JiraUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function Remove-JiraUser {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/user?username={0}"
$resourceURi = "$server/rest/api/2/user?username={0}"

if ($Force) {
Write-DebugMessage "[Remove-JiraGroup] -Force was passed. Backing up current ConfirmPreference [$ConfirmPreference] and setting to None"
Expand Down
2 changes: 1 addition & 1 deletion JiraPS/Public/Set-JiraUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function Set-JiraUser {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/user?username={0}"
$resourceURi = "$server/rest/api/2/user?username={0}"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functions/Add-JiraFilterPermission.Unit.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Describe 'Add-JiraFilterPermission' -Tag 'Unit' {
foreach ($_id in $Id) {
$object = New-Object -TypeName PSCustomObject -Property @{
id = $_id
RestUrl = "$jiraServer/rest/api/latest/filter/$_id"
RestUrl = "$jiraServer/rest/api/2/filter/$_id"
}
$object.PSObject.TypeNames.Insert(0, 'JiraPS.Filter')
$object
Expand Down
4 changes: 2 additions & 2 deletions Tests/Functions/Add-JiraIssueAttachment.Unit.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Describe "Add-JiraIssueAttachment" -Tag 'Unit' {
Mock Get-JiraIssue -ModuleName JiraPS {
$Issue = [PSCustomObject]@{
Key = $issueKey
RestURL = "$jiraServer/rest/api/latest/issue/$issueKey"
RestURL = "$jiraServer/rest/api/2/issue/$issueKey"
}
$Issue.PSObject.TypeNames.Insert(0, 'JiraPS.Issue')
$Issue
Expand All @@ -92,7 +92,7 @@ Describe "Add-JiraIssueAttachment" -Tag 'Unit' {
Get-JiraIssue -Key $Issue
}

Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter { $Method -eq 'Post' -and $URI -eq "$jiraServer/rest/api/latest/issue/$issueKey/attachments" } {
Mock Invoke-JiraMethod -ModuleName JiraPS -ParameterFilter { $Method -eq 'Post' -and $URI -eq "$jiraServer/rest/api/2/issue/$issueKey/attachments" } {
ShowMockInfo 'Invoke-JiraMethod' 'Method', 'Uri'
ConvertFrom-Json -InputObject $attachmentJson
}
Expand Down
Loading

0 comments on commit 1f243a2

Please sign in to comment.