Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions BuildHelpers/BuildHelpers.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
RootModule = 'BuildHelpers.psm1'

# Version number of this module.
ModuleVersion = '2.0.0'
ModuleVersion = '2.0.1'

# ID used to uniquely identify this module
GUID = 'ec079170-28b7-40b4-aaae-f8ebf76850ab'
Expand Down Expand Up @@ -106,7 +106,7 @@ PrivateData = @{
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = "Add support for GitHub Actions, and fix bug in Invoke-Git error handling"
ReleaseNotes = "Add support for GitHub Actions, and fix bug in Invoke-Git error handling`nfix: prevent git commands from hanging when using pager"

} # End of PSData hashtable

Expand Down
20 changes: 10 additions & 10 deletions BuildHelpers/Public/Get-BuildVariable.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function Get-BuildVariable {
{
# Using older than 1.6.3 in your build system? Yuck
# Thanks to earl: http://stackoverflow.com/a/1418022/3067642
$BuildBranch = Invoke-Git @IGParams -Arguments "rev-parse --abbrev-ref HEAD"
$BuildBranch = Invoke-Git @IGParams -Arguments "--no-pager rev-parse --abbrev-ref HEAD"
}
}

Expand All @@ -160,21 +160,21 @@ function Get-BuildVariable {
'CI_COMMIT_SHA' {
if($WeCanGit)
{
Invoke-Git @IGParams -Arguments "log --format=%B -n 1 $( (Get-Item -Path "ENV:$_").Value )"
Invoke-Git @IGParams -Arguments "--no-pager log --format=%B -n 1 $( (Get-Item -Path "ENV:$_").Value )"
break
} # Gitlab 9.0+ - thanks to mipadi http://stackoverflow.com/a/3357357/3067642
}
'CI_BUILD_REF' {
if($WeCanGit)
{
Invoke-Git @IGParams -Arguments "log --format=%B -n 1 $( (Get-Item -Path "ENV:$_").Value )"
Invoke-Git @IGParams -Arguments "--no-pager log --format=%B -n 1 $( (Get-Item -Path "ENV:$_").Value )"
break
} # Gitlab 8.x - thanks to mipadi http://stackoverflow.com/a/3357357/3067642
}
'GIT_COMMIT' {
if($WeCanGit)
{
Invoke-Git @IGParams -Arguments "log --format=%B -n 1 $( (Get-Item -Path "ENV:$_").Value )"
Invoke-Git @IGParams -Arguments "--no-pager log --format=%B -n 1 $( (Get-Item -Path "ENV:$_").Value )"
break
} # Jenkins - thanks to mipadi http://stackoverflow.com/a/3357357/3067642
}
Expand All @@ -186,21 +186,21 @@ function Get-BuildVariable {
'BUILD_SOURCEVERSION' { #Azure Pipelines, this will be triggered in the case of a classic release pipeline
if($WeCanGit)
{
Invoke-Git @IGParams -Arguments "log --format=%B -n 1 $( (Get-Item -Path "ENV:$_").Value )"
Invoke-Git @IGParams -Arguments "--no-pager log --format=%B -n 1 $( (Get-Item -Path "ENV:$_").Value )"
break
} # Azure Pipelines Classic Release (https://docs.microsoft.com/en-us/azure/devops/pipelines/release/variables)
}
'BUILD_VCS_NUMBER' {
if($WeCanGit)
{
Invoke-Git @IGParams -Arguments "log --format=%B -n 1 $( (Get-Item -Path "ENV:$_").Value )"
Invoke-Git @IGParams -Arguments "--no-pager log --format=%B -n 1 $( (Get-Item -Path "ENV:$_").Value )"
break
} # Teamcity https://confluence.jetbrains.com/display/TCD10/Predefined+Build+Parameters
}
'BAMBOO_REPOSITORY_REVISION_NUMBER' {
if($WeCanGit)
{
Invoke-Git @IGParams -Arguments "log --format=%B -n 1 $( (Get-Item -Path "ENV:$_").Value )"
Invoke-Git @IGParams -Arguments "--no-pager log --format=%B -n 1 $( (Get-Item -Path "ENV:$_").Value )"
break
} # Bamboo https://confluence.atlassian.com/bamboo/bamboo-variables-289277087.html
}
Expand All @@ -211,7 +211,7 @@ function Get-BuildVariable {
'GITHUB_SHA' {
if($WeCanGit)
{
Invoke-Git @IGParams -Arguments "log --format=%B -n 1 $( (Get-Item -Path "ENV:$_").Value )"
Invoke-Git @IGParams -Arguments "--no-pager log --format=%B -n 1 $( (Get-Item -Path "ENV:$_").Value )"
break
} # GitHub Actions https://developer.github.com/actions/creating-github-actions/accessing-the-runtime-environment/#environment-variables
}
Expand All @@ -221,7 +221,7 @@ function Get-BuildVariable {
{
if($WeCanGit)
{
$CommitMessage = Invoke-Git @IGParams -Arguments "log --format=%B -n 1"
$CommitMessage = Invoke-Git @IGParams -Arguments "--no-pager log --format=%B -n 1"
}
}
if($CommitMessage) {$CommitMessage = $CommitMessage -join "`n"}
Expand All @@ -243,7 +243,7 @@ function Get-BuildVariable {
{
if($WeCanGit)
{
$CommitHash = Invoke-Git @IGParams -Arguments "log --format=%H -n 1"
$CommitHash = Invoke-Git @IGParams -Arguments "--no-pager log --format=%H -n 1"
}
}
# Build number
Expand Down
4 changes: 2 additions & 2 deletions BuildHelpers/Public/Get-GitChangedFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function Get-GitChangedFile {
$Path = (Resolve-Path $Path).Path
try
{
$GitPathRaw = Invoke-Git rev-parse --show-toplevel -Path $Path -ErrorAction Stop
$GitPathRaw = Invoke-Git --no-pager rev-parse --show-toplevel -Path $Path -ErrorAction Stop
}
catch
{
Expand Down Expand Up @@ -197,7 +197,7 @@ function Get-GitChangedFile {
return
}

[string[]]$Files = Invoke-Git "diff --name-only $revisionString" -Path $GitPath
[string[]]$Files = Invoke-Git "--no-pager diff --name-only $revisionString" -Path $GitPath
if ($Files) {
Write-Verbose "Found [$($Files.Count)] files with raw values:`n$($Files | Foreach-Object {"'$_'"} | Out-String)"
if($Include)
Expand Down
2 changes: 1 addition & 1 deletion BuildHelpers/Public/Get-ProjectName.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function Get-ProjectName
#Last ditch, are you in Azure Pipelines or another CI that checks into a folder unrelated to the project?
#let's try some git
elseif ( $WeCanGit ) {
$result = (Invoke-Git -Path $Path -GitPath $GitPath -Arguments "remote get-url origin").Split('/')[-1] -replace "\.git",""
$result = (Invoke-Git -Path $Path -GitPath $GitPath -Arguments "--no-pager remote get-url origin").Split('/')[-1] -replace "\.git",""
}
else
{
Expand Down