Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v2.9 #326

Merged
merged 47 commits into from
Dec 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
6414364
Release v2.8
lipkau Jun 28, 2018
9d191a1
Merge tag 'v2.8.0' into develop
lipkau Jun 28, 2018
da7c99b
Merge tag 'v2.8.0' into develop
lipkau Jun 30, 2018
0aa2cd5
Adding parameter for fields
tuxgoose Jul 5, 2018
1ec9412
byjql is working
tuxgoose Jul 7, 2018
f8b0bc7
byjql,issuekey,byfilter all functional with fields
tuxgoose Jul 7, 2018
ead3cc2
byfilter was broken
tuxgoose Jul 7, 2018
d8b97c6
updated docs and fixed line 109 (naume)
tuxgoose Jul 7, 2018
fd91143
added space in get-jiraissue.md
tuxgoose Jul 7, 2018
af52b83
Improved documentation of -Fields parameter
lipkau Jul 8, 2018
2ecf612
Cleaned up code
lipkau Jul 8, 2018
6445874
modifed $Fields = $Fields -join ,
tuxgoose Jul 8, 2018
5db83e7
Merge remote-tracking branch 'tuxgoose/master'
lipkau Jul 8, 2018
3d78204
Fixed casting of String[] when parameter -Fields is left empty
lipkau Jul 8, 2018
f6fa0ad
removing un from write-debugmessage
tuxgoose Jul 8, 2018
d315a61
updated documentation
tuxgoose Jul 8, 2018
33da44c
Fixed name of the function in debug messages
lipkau Jul 8, 2018
15badd1
Added Unit Tests for -Fields
lipkau Jul 8, 2018
f9313fe
updating tests
tuxgoose Jul 8, 2018
e324728
Merge branch 'master' of https://github.com/tuxgoose/JiraPS-1
tuxgoose Jul 8, 2018
925cc9b
Merge pull request #300 from tuxgoose/master
lipkau Jul 8, 2018
57378c8
Fixed issue with params from pipeline.
ctolan Sep 21, 2018
c01061f
Added example showing how to pass multiple new issues via a object.
ctolan Sep 21, 2018
d0ed7c5
Put verbose message back into begin block.
ctolan Sep 21, 2018
fbd7100
Merge pull request #312 from ctolan/fix-issue-229
lipkau Sep 21, 2018
d73d9f7
Added Parameter -SkipNotification to Set-JiraIssue Command https://gi…
alexsuslin Oct 1, 2018
bb66099
Updated Set-JiraIssue.md
alexsuslin Oct 1, 2018
3159533
fix typo in parameter name in documentation and remove Write-Verbose …
alexsuslin Oct 1, 2018
fa53434
Changed logic for verbose message
lipkau Dec 5, 2018
d61162c
Merge branch 'master' into develop
lipkau Dec 5, 2018
3d48685
Fix for binary file
lipkau Dec 5, 2018
6b1fb51
Merge branch 'develop' into feature/issue-315
lipkau Dec 5, 2018
1347523
Merge pull request #316 from alexsuslin/feature/issue-315
lipkau Dec 5, 2018
274cba7
Added group membership when querying the current user
lipkau Dec 5, 2018
9ecc07a
Added documentation for authenticating with PAT
lipkau Dec 6, 2018
2543b4e
Removed error for issues without attachments
lipkau Dec 6, 2018
5015419
Added function for persisting attachment to disk
lipkau Dec 6, 2018
9c8bffc
Merge pull request #321 from AtlassianPS/enhance/#319-AddMissingPrope…
lipkau Dec 8, 2018
e6509d6
Merge branch 'develop' into enhance/#313-AuthWithPAT
lipkau Dec 8, 2018
9aadf08
Merge branch 'develop' into enhance/#318-DownloadOfAttachments
lipkau Dec 8, 2018
1f5f641
Fixed the DateTime representation of DateStarted
lipkau Dec 12, 2018
6b63b86
Merge pull request #322 from lipkau/enhance/#313-AuthWithPAT
lipkau Dec 12, 2018
b87a7b0
Merge branch 'develop' into enhance/#318-DownloadOfAttachments
lipkau Dec 12, 2018
41d4bb3
Merge pull request #323 from lipkau/enhance/#318-DownloadOfAttachments
lipkau Dec 12, 2018
b8b4130
Merge branch 'develop' into fix/#324-FixedDateFormat
lipkau Dec 12, 2018
ce0a39d
Merge pull request #325 from lipkau/fix/#324-FixedDateFormat
lipkau Dec 12, 2018
db256de
Bumped version to v2.9
lipkau Dec 12, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Change Log

## [2.9] - 2018-12-12

### Added

- Parameter for selecting what fields to return the the issue's payload (#300, [@tuxgoose])
- Added pipeline support to `New-JiraIssue` (#312, [@ctolan])
- Added parameter to avoid notifying user when running `Set-JiraIssue` (#315, [@alexsuslin])
- Improved documentation to demonstrate how to authenticate with 2FA (#313, [@lipkau])
- Added function to download attachments from issue: `Get-JiraIssueAttachmentFile` (#323, [@lipkau])

### Changed

- Fixed the way a user is resolved in `Remove-JiraGroupMember` (#301, [@lipkau])
- Improved the resolving of server responses with an error (#303, [@lipkau])
- Fixed payload of `New-JiraFilter` (#304, [@lipkau])
- Fixed paging when server responds with only 1 result (#307, [@lipkau])
- Fixed `Set-JiraIssue` to allow to unassigned an issue (#309, [@lipkau])
- Changed CI/CD pipeline from AppVeyor to Azure DevOps (#317, [@lipkau])
- Fixed missing properties on `Get-JiraUser` (#321, [@lipkau])
- Fixed `-DateStarted` on `Add-JiraIssueWorklog` (#324, [@lipkau])


## [2.8] - 2018-06-28

More detailed description about the changes can be found on [Our Website](https://atlassianps.org/article/announcement/JiraPS-v2.8.html).
Expand Down Expand Up @@ -279,6 +301,7 @@ which is in turn inspired by the [Vagrant](https://github.com/mitchellh/vagrant/
[@beaudryj]: https://github.com/beaudryj
[@brianbunke]: https://github.com/brianbunke
[@Clijsters]: https://github.com/Clijsters
[@ctolan]: https://github.com/ctolan
[@colhal]: https://github.com/colhal
[@Dejulia489]: https://github.com/Dejulia489
[@ebekker]: https://github.com/ebekker
Expand All @@ -290,4 +313,5 @@ which is in turn inspired by the [Vagrant](https://github.com/mitchellh/vagrant/
[@lukhase]: https://github.com/lukhase
[@padgers]: https://github.com/padgers
[@ThePSAdmin]: https://github.com/ThePSAdmin
[@tuxgoose]: https://github.com/tuxgoose
[@WindowsAdmin92]: https://github.com/WindowsAdmin92
2 changes: 1 addition & 1 deletion JiraPS/JiraPS.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
RootModule = 'JiraPS.psm1'

# Version number of this module.
ModuleVersion = '2.8'
ModuleVersion = '2.9'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
5 changes: 5 additions & 0 deletions JiraPS/Public/Add-JiraIssueWorklog.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ function Add-JiraIssueWorklog {
Write-Error @errorMessage
}

# Harmonize DateStarted:
# `Get-Date -Date "01.01.2000"` does not return the local timezone
# which is required by the API
$DateStarted = [DateTime]::new($DateStarted.Ticks, 'Local')

$requestBody = @{
'comment' = $Comment
# We need to fix the date with a RegEx replace because the API does not like:
Expand Down
36 changes: 29 additions & 7 deletions JiraPS/Public/Get-JiraIssue.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ function Get-JiraIssue {
[Object]
$Filter,

[Parameter()]
[ValidateNotNullOrEmpty()]
[String[]]
$Fields = "*all",

[Parameter( ParameterSetName = 'ByJQL' )]
[Parameter( ParameterSetName = 'ByFilter' )]
[UInt32]
Expand All @@ -91,8 +96,10 @@ function Get-JiraIssue {

$server = Get-JiraConfigServer -ErrorAction Stop

$resourceURi = "$server/rest/api/latest/issue/{0}?expand=transitions"
$searchURi = "$server/rest/api/latest/search"
$resourceURi = "$server/rest/api/latest/issue/{0}"

[String]$Fields = $Fields -join ","
}

process {
Expand All @@ -105,11 +112,18 @@ function Get-JiraIssue {
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Processing [$_key]"
Write-Debug "[$($MyInvocation.MyCommand.Name)] Processing `$_key [$_key]"

$getParameter = @{ expand = "transitions" }
if ($Fields) {
$getParameter["fields"] = $Fields
}

$parameter = @{
URI = $resourceURi -f $_key
Method = "GET"
Credential = $Credential
URI = $resourceURi -f $_key
Method = "GET"
GetParameter = $getParameter
Credential = $Credential
}

Write-Debug "[$($MyInvocation.MyCommand.Name)] Invoking JiraMethod with `$parameter"
$result = Invoke-JiraMethod @parameter

Expand All @@ -122,7 +136,7 @@ function Get-JiraIssue {
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Processing [$_issue]"
Write-Debug "[$($MyInvocation.MyCommand.Name)] Processing `$_issue [$_issue]"

Write-Output (Get-JiraIssue -Key $_issue.Key -Credential $Credential)
Write-Output (Get-JiraIssue -Key $_issue.Key -Fields $Fields -Credential $Credential)
}
}
'ByJQL' {
Expand All @@ -134,11 +148,15 @@ function Get-JiraIssue {
validateQuery = $true
expand = "transitions"
maxResults = $PageSize

}
OutputType = "JiraIssue"
Paging = $true
Credential = $Credential
}
if ($Fields) {
$parameter["GetParameter"]["fields"] = $Fields
}
# Paging
($PSCmdlet.PagingParameters | Get-Member -MemberType Property).Name | ForEach-Object {
$parameter[$_] = $PSCmdlet.PagingParameters.$_
Expand All @@ -158,14 +176,14 @@ function Get-JiraIssue {
Invoke-JiraMethod @parameter
}
'ByFilter' {
$filterObj = Get-JiraFilter -InputObject $Filter -Credential $Credential -ErrorAction Stop
$filterObj = (Get-JiraFilter -InputObject $Filter -Credential $Credential -ErrorAction Stop).searchurl
<#
#ToDo:CustomClass
Once we have custom classes, this will no longer be necessary
#>

$parameter = @{
URI = $filterObj.SearchUrl
URI = $filterObj
Method = "GET"
GetParameter = @{
validateQuery = $true
Expand All @@ -175,6 +193,10 @@ function Get-JiraIssue {
OutputType = "JiraIssue"
Paging = $true
Credential = $Credential

}
if ($Fields) {
$parameter["GetParameter"]["fields"] = $Fields
}
# Paging
($PSCmdlet.PagingParameters | Get-Member -MemberType Property).Name | ForEach-Object {
Expand Down
8 changes: 0 additions & 8 deletions JiraPS/Public/Get-JiraIssueAttachment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,6 @@ function Get-JiraIssueAttachment {

ConvertTo-JiraAttachment -InputObject $attachments
}
else {
$errorMessage = @{
Category = "ObjectNotFound"
CategoryActivity = "Searching for resource"
Message = "This issue does not have any attachments"
}
Write-Error @errorMessage
}
}

end {
Expand Down
68 changes: 68 additions & 0 deletions JiraPS/Public/Get-JiraIssueAttachmentFile.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
function Get-JiraIssueAttachmentFile {
# .ExternalHelp ..\JiraPS-help.xml
[CmdletBinding()]
[OutputType([Bool])]
param (
[Parameter( Mandatory, ValueFromPipeline )]
[PSTypeName('JiraPS.Attachment')]
$Attachment,

[ValidateScript(
{
if (-not (Test-Path $_)) {
$errorItem = [System.Management.Automation.ErrorRecord]::new(
([System.ArgumentException]"Path not found"),
'ParameterValue.FileNotFound',
[System.Management.Automation.ErrorCategory]::ObjectNotFound,
$_
)
$errorItem.ErrorDetails = "Invalid path '$_'."
$PSCmdlet.ThrowTerminatingError($errorItem)
}
else {
return $true
}
}
)]
[String]
$Path,

[Parameter()]
[System.Management.Automation.PSCredential]
[System.Management.Automation.Credential()]
$Credential = [System.Management.Automation.PSCredential]::Empty
)

begin {
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function started"
}

process {
Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] ParameterSetName: $($PsCmdlet.ParameterSetName)"
Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] PSBoundParameters: $($PSBoundParameters | Out-String)"

foreach ($_Attachment in $Attachment) {
if ($Path) {
$filename = Join-Path $Path $_Attachment.Filename
}
else {
$filename = $_Attachment.Filename
}

$iwParameters = @{
Uri = $_Attachment.Content
Method = 'Get'
Headers = @{"Accept" = $_Attachment.MediaType}
OutFile = $filename
Credential = $Credential
}

$result = Invoke-JiraMethod @iwParameters
(-not $result)
}
}

end {
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function ended"
}
}
2 changes: 1 addition & 1 deletion JiraPS/Public/Get-JiraUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function Get-JiraUser {
Write-Debug "[$($MyInvocation.MyCommand.Name)] Invoking JiraMethod with `$parameter"
$result = Invoke-JiraMethod @parameter

Write-Output (ConvertTo-JiraUser -InputObject $result)
Get-JiraUser -UserName $result.Name
}
"ByInputObject" {
$UserName = $InputObject.Name
Expand Down
19 changes: 13 additions & 6 deletions JiraPS/Public/New-JiraIssue.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,46 @@ function New-JiraIssue {
# .ExternalHelp ..\JiraPS-help.xml
[CmdletBinding( SupportsShouldProcess )]
param(
[Parameter( Mandatory )]
[Parameter( Mandatory, ValueFromPipelineByPropertyName )]
[String]
$Project,

[Parameter( Mandatory )]
[Parameter( Mandatory, ValueFromPipelineByPropertyName )]
[String]
$IssueType,

[Parameter( Mandatory )]
[Parameter( Mandatory, ValueFromPipelineByPropertyName )]
[String]
$Summary,

[Parameter( ValueFromPipelineByPropertyName )]
[Int]
$Priority,

[Parameter( ValueFromPipelineByPropertyName )]
[String]
$Description,

[Parameter( ValueFromPipelineByPropertyName )]
[AllowNull()]
[AllowEmptyString()]
[String]
$Reporter,

[Parameter( ValueFromPipelineByPropertyName )]
[String[]]
$Labels,

[Parameter( ValueFromPipelineByPropertyName )]
[String]
$Parent,

[Parameter( ValueFromPipelineByPropertyName )]
[Alias('FixVersions')]
[String[]]
$FixVersion,

[Parameter( ValueFromPipelineByPropertyName )]
[PSCustomObject]
$Fields,

Expand All @@ -46,15 +53,15 @@ function New-JiraIssue {

begin {
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function started"
}

process {
$server = Get-JiraConfigServer -ErrorAction Stop -Debug:$false

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

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

process {
Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] ParameterSetName: $($PsCmdlet.ParameterSetName)"
Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] PSBoundParameters: $($PSBoundParameters | Out-String)"

Expand Down Expand Up @@ -161,9 +168,9 @@ function New-JiraIssue {
Write-Output (Get-JiraIssue -Key $result.Key -Credential $Credential)
}
}
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Complete"
}

end {
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Complete"
}
}
29 changes: 20 additions & 9 deletions JiraPS/Public/Set-JiraIssue.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ function Set-JiraIssue {
$Credential = [System.Management.Automation.PSCredential]::Empty,

[Switch]
$PassThru
$PassThru,

[Switch]
$SkipNotification
)

begin {
Expand Down Expand Up @@ -175,14 +178,21 @@ function Set-JiraIssue {
}
}

$SkipNotificationParams = @{}
if ($SkipNotification) {
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Skipping notification for watchers"
$SkipNotificationParams = @{notifyUsers = $false}
}

if ( @($issueProps.update.Keys).Count -gt 0 ) {
Write-DebugMessage "[$($MyInvocation.MyCommand.Name)] Updating issue fields"

$parameter = @{
URI = $issueObj.RestUrl
Method = "PUT"
Body = ConvertTo-Json -InputObject $issueProps -Depth 10
Credential = $Credential
URI = $issueObj.RestUrl
Method = "PUT"
Body = ConvertTo-Json -InputObject $issueProps -Depth 10
Credential = $Credential
GetParameter = $SkipNotificationParams
}
Write-Debug "[$($MyInvocation.MyCommand.Name)] Invoking JiraMethod with `$parameter"
if ($PSCmdlet.ShouldProcess($issueObj.Key, "Updating Issue")) {
Expand All @@ -196,10 +206,11 @@ function Set-JiraIssue {
# you customize the "Edit Issue" screen.

$parameter = @{
URI = "{0}/assignee" -f $issueObj.RestUrl
Method = "PUT"
Body = ConvertTo-Json -InputObject $assigneeProps
Credential = $Credential
URI = "{0}/assignee" -f $issueObj.RestUrl
Method = "PUT"
Body = ConvertTo-Json -InputObject $assigneeProps
Credential = $Credential
GetParameter = $SkipNotificationParams
}
Write-Debug "[$($MyInvocation.MyCommand.Name)] Invoking JiraMethod with `$parameter"
if ($PSCmdlet.ShouldProcess($issueObj.Key, "Updating Issue [Assignee] from JIRA")) {
Expand Down
Loading