Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Why does git describe fail to find tags in a build plan, but does succeed from the command line

David FALLAS
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2017

I have a build plan that includes a Powershell script that calls git describe --tags --long. This plan is run by a remote agent on Windows Server 2012. The return from the script is: fatal: No names found, cannot describe anything.

Yet when the same Powershell script is run from the command line, in the same build directory, it succeeds.

The first task in the build is to freshly clone the git repository and from the build log I can see that tags are included:

30-Jan-2017 08:19:21 * [new branch]        master     -> master

30-Jan-2017 08:19:21 * [new tag]           0.2.34.2   -> 0.2.34.2

30-Jan-2017 08:19:21 * [new tag]           0.2.33.0   -> 0.2.33.0

30-Jan-2017 08:19:21 * [new tag]           0.2.0.0    -> 0.2.0.0

 

Bamboo Server is running on Ubuntu 16.0 and is v5.12.3.1. The remote agent is the same version.

Can anyone please explain this behaviour?

 

1 answer

1 vote
David FALLAS
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 31, 2017

No takers thus far. I have been doing some more research. I found an Answers Atlassian response that appears to address this - https://answers.atlassian.com/questions/11962663.

However, the response that contained instructions to create script.ps1 and place it in the build directory do not work. The Script body I have in Bamboo is:

Set-ExecutionPolicy “RemoteSigned” -Scope Process -Confirm:$false
Set-ExecutionPolicy “RemoteSigned” -Scope CurrentUser -Confirm:$false

. ${bamboo.build.working.directory}\script.ps1
add-numbers -intOne 1 -intTwo 2
Test "ABC" "DEF"

The response logged is:

. : The term
'C:\Bamboo-agent-home\xml-data\build-dir\BC-PSTES-JOB1\script.ps1' is not
recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At C:\bamboo-agent-home\temp\BC-PSTES-JOB1-24-ScriptBuildTask-91391238611516135
56.ps1:4 char:3
+ . C:\Bamboo-agent-home\xml-data\build-dir\BC-PSTES-JOB1\script.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Bamboo-agent...JOB1\script.p
s1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

add-numbers : The term 'add-numbers' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At C:\bamboo-agent-home\temp\BC-PSTES-JOB1-24-ScriptBuildTask-91391238611516135
56.ps1:5 char:1
+ add-numbers -intOne 1 -intTwo 2
+ ~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (add-numbers:String) [], Command
NotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Test : The term 'Test' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At C:\bamboo-agent-home\temp\BC-PSTES-JOB1-24-ScriptBuildTask-91391238611516135
56.ps1:6 char:1
+ Test "ABC" "DEF"
+ ~~~~
+ CategoryInfo : ObjectNotFound: (Test:String) [], CommandNotFoun
dException
+ FullyQualifiedErrorId : CommandNotFoundException

I have tried all manner of changes to the Bamboo Script body attempting to run this script, none of which have worked. Other Bamboo documentation I have found also seems to indicate that PowerShell scripts can be run from Bamboo tasks, but so far, like the original questioner (referenced above) - "I'm having a heck of a time with this... burned a lot of time"

I also tried the Command option that was mentioned somewhere after adding PowerShell as a new capability on the remote agent. This failed to do anything at all.

Bamboo agent is v5.12.3, PowerShell is v5, both running on Windows Server 2012.

Any suggestions welcome.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events