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

Removing 'path' parameter from 'git log' command #118

Merged
merged 2 commits into from
Sep 19, 2019
Merged
Changes from 1 commit
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
14 changes: 7 additions & 7 deletions BuildHelpers/Public/Get-BuildVariable.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 "log --format=%B -n 1"
Copy link
Owner

@RamblingCookieMonster RamblingCookieMonster Sep 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So! In this section (getting commit message), the deleted bit is the commit sha. If you leave this off, AFAICT it will get the current commit. Potential corner case: Someone has been moving around in their build (checking out a different commit), but still want to refer to the commit message of the build's commit.

Do these lines ever error out for you? Maybe I'm grabbing a wrong environment variable? Intention in this section is to grab commit to do this: https://stackoverflow.com/a/3357357

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 "log --format=%B -n 1"
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 "log --format=%B -n 1"
break
} # Jenkins - thanks to mipadi http://stackoverflow.com/a/3357357/3067642
}
Expand All @@ -186,21 +186,21 @@ function Get-BuildVariable {
'SYSTEM_DEFAULTWORKINGDIRECTORY' { #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 )").split([Environment]::NewLine,[System.StringSplitOptions]::RemoveEmptyEntries) -join " "
(Invoke-Git @IGParams -Arguments "log --format=%B -n 1").split([Environment]::NewLine,[System.StringSplitOptions]::RemoveEmptyEntries) -join " "

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this one is weird. It should be a commit sha, not a path, not sure what happened.

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 "log --format=%B -n 1"
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 "log --format=%B -n 1"
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 "log --format=%B -n 1"
break
} # GitHub Actions https://developer.github.com/actions/creating-github-actions/accessing-the-runtime-environment/#environment-variables
}
Expand Down