Skip to content

Commit

Permalink
Update build.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
marcschier authored May 17, 2024
1 parent 62734f1 commit 00501d8
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions tools/scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,9 @@ if ($script:Debug.IsPresent) {

$repositoryName = $null
if ($script:DetermineRepository.IsPresent) {
try {
$argumentList = @("rev-parse", "--abbrev-ref", "HEAD")
$branchName = (& "git" @argumentList 2>&1 | ForEach-Object { "$_" });
if ($LastExitCode -ne 0) {
throw "git $($argumentList) failed with $($LastExitCode)."
}
}
catch {
Write-Warning $_.Exception
$branchName = $(git rev-parse --abbrev-ref HEAD 2>&1) | ForEach-Object { "$_" }
if ([string]::IsNullOrEmpty($branchName)) {
Write-Warning "Git rev-parse failed."
$branchName = $env:BUILD_SOURCEBRANCH
if (![string]::IsNullOrEmpty($branchName)) {
if ($branchName.StartsWith("refs/heads/")) {
Expand All @@ -70,7 +64,7 @@ if ($script:DetermineRepository.IsPresent) {
}
}
if ([string]::IsNullOrEmpty($branchName) -or ($branchName -eq "HEAD")) {
throw "Not building from a branch - skip image build."
throw "Unsupportrd branch - '$($branchName)' - fail image build."
}
# Set namespace name based on branch name
$namespace = $branchName
Expand Down

0 comments on commit 00501d8

Please sign in to comment.