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

Still not able to get pipelines to work

Keith Smith November 27, 2022

This might be a duplicate from something I have posted before.

I am running with a Runner on Windows so I am assuming that my code needs to be Powershell (the guidelines state I need to have PS on my machine).  My runner is online.

Just to be clear about my use case, I just want to execute an ant build to see if it succeeds.  So what might be my issues?

Let's start:

1) The "Build setup" makes it look like it's cloning my entire code base into the temp folder.  Is that what I should expect?  Are the commands executing inside this temp folder environment?  If that is the case, I will have to copy the ignored assets such as binaries into that temp folder in order to get an ant build to work.

2) How do I access the Workspace, Repository, and Pipeline variables?  I have tried using $ and that gives me an error every time because they are null.

3) Where is my output going?  This is maddening.  The echo command gives me output but simple commands like pwd or dir give me nothing.  Do I need to just have one command per step?  This is my main complaint with the examples - none of them are real examples, they either are echo something or npm something.  And the web - all of the sites that get pulled up are trash plagiarized sites.

4) Going back to 1) - Am I supposed to cd to my branch and run the ant command?

Please help me with real examples.

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 12, 2022

Hi @Keith Smith ,

 

1) The "Build setup" makes it look like it's cloning my entire code base into the temp folder. Is that what I should expect? Are the commands executing inside this temp folder environment? If that is the case, I will have to copy the ignored assets such as binaries into that temp folder in order to get an ant build to work.

For every step in your bitbucket-pipelines.yml, the repo will get cloned in a directory of your machine. It will not get cloned in the temp folder, the path is

C:\Users\<User>\Documents\atlassian-bitbucket-pipelines-runner\temp\0682re46-003f-741b-e673-767067ckef21\1670408929964\build

where
C:\Users\<User>\Documents\ is the path where you unzipped the runner zip
0682re46-003f-741b-e673-767067ckef21 should be the uuid of your runner
1670408929964 is the EPOCH time when the build starts

The clone directory is exposed in the variable BITBUCKET_CLONE_DIR and it is where the build's commands are executed.

 

2) How do I access the Workspace, Repository, and Pipeline variables? I have tried using $ and that gives me an error every time because they are null.

Windows runners use PowerShell, and environment variables in PowerShell can be accessed with $env:name_of_variable, where name_of_variable is the name of the environment variable.

 

3) Where is my output going? This is maddening. The echo command gives me output but simple commands like pwd or dir give me nothing. Do I need to just have one command per step? This is my main complaint with the examples - none of them are real examples, they either are echo something or npm something. And the web - all of the sites that get pulled up are trash plagiarized sites.

I tried to reproduce this issue and for certain commands, it looks like their output is appended to the output of the last command of my build. I cannot reproduce this consistently though. Could you please check the output of the last command of your build and let me know if that's the case for your build as well?

I have reached out to the development team regarding this issue.

4) Going back to 1) - Am I supposed to cd to my branch and run the ant command?

There is no such thing as doing a cd to a branch in Git, I assume you mean doing a git checkout to a branch?

If your builds are configured in your bitbucket-pipelines.yml to run on branches, then when you push a commit to a branch, this specific branch will get cloned by default with a depth of 50 during the runner build, and it will be the one checked out.

If you want to check out other branches during the build (with a git checkout command), you will need to add configuration in your yml file to do a full clone, otherwise you won't be able to checkout other branches

clone:
    depth: full

You can add this either to a specific step or at the top of your yml file if you want this config to apply to all steps.

If your repo has directories, you can also add a cd command in the build if you want to execute commands inside a specific directory.

If you have any other questions, please feel free to let me know.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events