Local Bitbucket Windows run script

Mark Blackburn June 12, 2022

I wrote a basic python script for testing bitbucket-pipelines.yml files locally:

bitbucket_pipelines_test.py 

This allows you to test a bitbucket-pipelines.yml file locally without pushing it to a repository.

The 'script' blocks in each step run as a powershell script.

Example usage:

python bitbucket_pipelines_test.py "Pipeline step 1" --env env.json

 

1 comment

Comment

Log in or Sign up to comment
Jayant Gawali
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 19, 2022

Hi @Mark Blackburn ,

 

The windows runner, runs the powershell scripts in non-interactive mode. Anything that needs interaction with the user is blocked.


For the above script that you are running what sort of error do you see in the logs of the runner? 

I need more information to help on this issue.

Can you please check :

1. If the script that you are running is not an interactive script.

2. If you can get the runner logs and share it with us.

 

Regards,

Jayant

Mark Blackburn June 22, 2022

This is not an issue report. I was sharing a script I use for local testing of pipelines. I posted this to share with other users. I guess my description was lacking.

I find it difficult to test a powershell script before putting it into the script block of the bitbucket_pipelines.yml file since you often have to put quotes around some lines and it's never as simple as just putting the '-' in front of all your script lines.

The point of my powershell script is to read the script blocks from the yml file and let you execute them for testing without having to push your working copy and wait for the pipeline to get to the script block you are working on. And catching the .yml parse errors when you copying from a powershell script into the .yml file.

TAGS
AUG Leaders

Atlassian Community Events