Skip to content

Commit

Permalink
cleanup upate jirastate
Browse files Browse the repository at this point in the history
  • Loading branch information
ITS-Unibas-Choco committed Dec 31, 2024
1 parent e7fbd7f commit b0e4f73
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions WASP/Private/Invoke-JiraObserver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,24 @@ function Invoke-JiraObserver {
# Die verfügbaren Branches werden aus der Package Gallery abgerufen
$RemoteBranches = Get-RemoteBranches -Repo $packageGalleryRepo -User $gitHubOrganization

$UpdateJiraStateFile = $true
# jedes Issue, welches vom Stand im neusten JiraState-File abweicht wird einzeln durchgegangen
foreach($key in $IssuesCompareState.keys) {
# Ermittlung des Dev-Branches anhand des Software Namens (mit Eventualität des Repackaging branches)
$DevBranchPrefix = "$GitBranchDEV$key"
$DevBranch = Get-DevBranch -RemoteBranches $RemoteBranches -DevBranchPrefix $DevBranchPrefix
# dev → test: PR nach test
if ($IssuesCompareState[$key].StatusOld -eq "Development" -and $IssuesCompareState[$key].Status -eq "Testing") {
$UpdateJiraStateFile = Create-PullRequest -SourceBranch $DevBranch -DestinationBranch $GitBranchTEST -Software $key -DestinationName "Testing"

$result = Create-PullRequest -SourceBranch $DevBranch -DestinationBranch $GitBranchTEST -Software $key -DestinationName "Testing"
if ($result -eq $false) {
$UpdateJiraStateFile = $false
}
# test → prod: PR nach prod
} elseif ($IssuesCompareState[$key].StatusOld -eq "Testing" -and $IssuesCompareState[$key].Status -eq "Production") {
$UpdateJiraStateFile = Create-PullRequest -SourceBranch $DevBranch -DestinationBranch $GitBranchPROD -Software $key -DestinationName "Production"

$result = Create-PullRequest -SourceBranch $DevBranch -DestinationBranch $GitBranchPROD -Software $key -DestinationName "Production"
if ($result -eq $false) {
$UpdateJiraStateFile = $false
}
# prod → dev: kein PR, neuer branch mit @ + random hash
} elseif ($IssuesCompareState[$key].StatusOld -eq "Production" -and $IssuesCompareState[$key].Status -eq "Development") {
# Falls kein DevBranch für die Software existiert (weil die Software schon nach Prod gemerged wurde), wird ein repackaging branch mit einer uuid erstellt
Expand All @@ -146,10 +151,8 @@ function Invoke-JiraObserver {
New-RemoteBranch -Repository $packageGalleryRepo -User $gitHubOrganization -BranchName $RepackagingBranch
Write-Log -Message "New Repackaging Branch $RepackagingBranch created" -Severity 0
}
$UpdateJiraStateFile = $true
} else {
Write-Log -Message "No action needed for $key" -Severity 0
$UpdateJiraStateFile = $true
}
}

Expand Down

0 comments on commit b0e4f73

Please sign in to comment.