Wiki

Clone wiki

PowerShell Task / Home

PowerShell Task for Bamboo Documentation

A convenient way to use the power of the PowerShell!

1. Overview

Windows PowerShell is a mighty script system and now it can be used for building, deploying and everything else in Atlassian Bamboo. You can easily create, edit and run scripts directly in Bamboo enjoying syntax highlighting and configuring your scripts with arguments and environment variables. Also scripts benefit from Bamboo variables substitutions.

Features

  • Create, edit and run PowerShell scripts
  • Syntax highlighting
  • Bamboo variables substitution
  • Run external PowerShell scripts
  • Pass arguments and environment variables
  • Use Bamboo variables as PowerShell variables
  • Show script exit code
  • Control whether to load user profile
  • Choose PowerShell bitness
  • Linux support (pwsh and pwsh-preview)
  • Run as a different user

Compatibility

  • Version 1.3.x => Bamboo 8.0-9.x (DC only)
  • Version 1.2.x => Bamboo 6.0-9.5
  • Version 1.1.x => Bamboo 5.0-6.x
  • Version 1.0.x => Bamboo 4.2-4.4.8

For download and purchasing details visit Atlassian Marketplace.

2. Installation

The Universal Plugin Manager (UPM) is a tool for administering apps in Atlassian applications. You can use the UPM to find and install, manage, and configure apps:

3. PowerShell Task Parameters

Each PowerShell task has the following parameters:

  • Script location
  • Script body or filename
  • Arguments
  • Environment variables
  • Working directory
  • Load the current user profile
  • Bitness
  • Run as (username/password)

Note: each of these parameters can use Bamboo variables substitution.

3.1. Script Location

This switch chooses whether to write a script body directly in Bamboo or use an external file.

3.2. Script Body or Filename

The script body text area works as a text editor and used to write a PowerShell script directly in Bamboo. Also it provides syntax highlighting.

The script filename text field specifies an external PowerShell script. Typically it contains a relative to the working directory path. However absolute paths are also supported. Note that a file must have the .ps1 extension.

3.3. Arguments

This field is used to pass arguments to a script. If an argument contain spaces enclose it in double-quotes. Examples:

  • "my arg1" myarg2

3.4. Environment Variables

There you can specify environment variables for a script. Use the format <name>=<value> and separate name-value pairs with spaces. Examples:

  • myvar1="my value" myvar2=value2

3.5. Working Directory

By default the working directory is a plan directory. However it can be changed to any other relative directory. Examples:

  • bin/release

3.6. Load User Profile

This option changes -NoProfile command line switch. The default value is to use global settings.

The global settings can be changed under Bamboo administration-->Add-ons-->Powershell Task. The default global setting is set to No.

3.7. Bitness

You can choose the bitness of the PowerShell execuatable: Any, x86 or x64. The default is Any.

Note: Works only on Windows.

3.8. Run As

PowerShell can be run under different user account. Turn on this option and specify a target username/password. You can use bamboo variables in the username/password fields. For example: ${bamboo.username}.

Passwords are stored encrypted in the bamboo database. To recover a password you have to get an access to the database (for PowerShell Task 1.1.x) or to the database and file system (for PowerShell Task 1.2.x). Read more at https://confluence.atlassian.com/bamboo/system-wide-encryption-873930114.html and #26.

Note: Works only on Windows.

4. Release Notes

4.1. Version 1.3.x (for Bamboo 8.0-9.x DC only)

Version 1.3.0 (29 Mar 2024)

  • Fix: Compatibility with Bamboo DC 9.6
  • Fix: Eager user/password autocomplete from browser
  • Enh: Drop Bamboo Server support (only DC now)
  • Enh: Update dependencies

4.2. Version 1.2.x (for Bamboo 6.0-9.5)

Version 1.2.9 (31 Jul 2022)

  • Enh: Add data center compatibility and pass the approval process

Version 1.2.8 (06 May 2022)

  • New: INCOMING DATA CENTER APPROVAL
  • Enh: Update dependencies

Version 1.2.7 (06 Jun 2021)

  • Fix #35: AuthorizationManager check failed

Version 1.2.6 (28 Dec 2020)

  • Fix #34: Bamboo yaml specs shouldn't require arguments, environment and subdirectory

Version 1.2.5 (06 Dec 2020)

  • New #32: Bamboo 7.2 support
  • New: Update syntax highlighting

Version 1.2.4 (23 Nov 2020)

  • Fix #31: RunAs engine is not reading user environment variables

Version 1.2.3 (09 Nov 2020)

  • New #30: Rework RunAs engine

Version 1.2.2 (27 Aug 2020)

  • Fix #28: Backslashes escaping in the arguments field

Version 1.2.1 (15 Mar 2020)

  • New: Bamboo 7.0 support

Version 1.2.0 (11 Nov 2019)

  • New #26: Use more secure API to store passwords

4.3. Version 1.1.x (for Bamboo 5.0-6.x)

Version 1.1.18 (27 Aug 2020)

  • Fix #28: Backslashes escaping in the arguments field

Version 1.1.17 (11 Nov 2019)

  • Fix #24: Pass a password to runas via a config file instead of command line parameters
  • New #25: Allow using bamboo variables for username/password filed

Version 1.1.16 (03 Nov 2019)

  • New #23: Ability to run PowerShell as another user

Version 1.1.15 (16 Dec 2018)

  • New #21: Change default script location to inline
  • Fix #22: Detect PowerShell local capabilities right after addon installation

Version 1.1.14 (07 Sep 2018)

  • New #20: Linux support (pwsh and pwsh-preview)

Version 1.1.13 (12 Jan 2018)

  • Fix #18: PowerShell task should run only on agents with PowerShell (the task needs to be resaved to apply new changes)

Version 1.1.12 (12 Mar 2017)

  • New #17: Ability to choose PowerShell bitness

Version 1.1.9 (06 Sep 2015)

  • New #16: Ability to configure NoProfile option

Version 1.1.8 (27 Aug 2014)

  • Fix #15: NoClassDefFoundError exception on some configurations

Version 1.1.7 (30 Jul 2014)

  • New #14: Move to the API provided by UPM 2.x.

Version 1.1.6 (14 May 2014)

  • Fix #13: Non-english characters not working properly

Version 1.1.5 (04 Mar 2014)

  • Fix #12: Support for spaces in a script path (allow bamboo home to contain spaces)

Version 1.1.4 (15 Dec 2013)

  • Fix #10: The '<' operator is reserved for future use (caused by too big resulting command line)

Version 1.1.3 (07 Sep 2013)

  • Fix #7: Script error if bamboo variable name contains colon

Version 1.1.2 (30 Aug 2013)

  • New #6: Export Bamboo variables as PowerShell variables so they can be used in external scripts (not only inline)

Version 1.1.1 (26 Aug 2013)

  • New #5: Return real exit codes from a script (exit statement support)

Version 1.1 (2 Aug 2013)

  • New #4: Add support for deployment projects

4.4. Version 1.0.x (for Bamboo 4.2-4.4.8)

Version 1.0.15 (12 Mar 2017)

  • New #17: Ability to choose PowerShell bitness

Version 1.0.12 (08 Sep 2015)

  • New #16: Ability to configure NoProfile option

Version 1.0.11 (27 Aug 2014)

  • Fix #15: NoClassDefFoundError exception on some configurations

Version 1.0.10 (30 Jul 2014)

  • New #14: Move to the API provided by UPM 2.x.

Version 1.0.9 (14 May 2014)

  • Fix #13: Non-english characters not working properly

Version 1.0.8 (04 Mar 2014)

  • Fix #12: Support for spaces in a script path (allow bamboo home to contain spaces)

Version 1.0.7 (15 Dec 2013)

  • Fix #10: The '<' operator is reserved for future use (caused by too big resulting command line)

Version 1.0.6 (07 Sep 2013)

  • Fix #7: Script error if bamboo variable name contains colon

Version 1.0.5 (30 Aug 2013)

  • New #6: Export Bamboo variables as PowerShell variables so they can be used in external scripts (not only inline)

Version 1.0.4 (27 Aug 2013)

  • New #5: Return real exit codes from a script (exit statement support)

Version 1.0.3 (20 Jul 2013)

  • New #3: Extend plugin compatibility to support Bamboo 4.2-5.0

Version 1.0.2 (18 Jul 2013)

  • Fix #2: Powershell Task Error in Bamboo 5.0 (Note: If you have previous Bamboo version use Powershell Task 1.0.1)

Version 1.0.1 (23 Jun 2013)

  • Fix #1: PowerShell Task error on a remote agent

Version 1.0 (4 Jun 2013)

  • Initial public release

5. Support

If you find a bug, have a feature request or have an idea how to improve this plugin please post it at the public bug tracker.

6. Contact

Feel free to contact us via email and visit our website.

Updated