Skip to content

murati-hu/PsBamboo

Repository files navigation

PsBamboo PowerShell module

Build status

PsBamboo is a PowerShell module that provides a wrapper for Bamboo REST API to allow easy and fast authenticated access to Bamboo CI in a scriptable and automatable manner.

The module handles both authenticated and anonymous methods, it supports paged reading and manipulation of the following Bamboo resources: Project, Plan, PlanBranch, Build, Artifact, Server, CurrentUser,DeployProject

In addition to several already implemented functions, it also provides generic Cmdlets to access any not yet covered Bamboo REST API resources too.

Installation

PsBamboo is available via PsGet or via PowerShell Gallery , so you can simply install it with the following command:

Install-Module PsBamboo

Of course you can download and install the module manually too from Downloads

Usage

Import-Module PsBamboo

Examples

Try and execute the sample scripts in the Examples folder against your local Bamboo server to see all the Cmdlets in action or call help on any of the PsBamboo cmdlets.

Intro

Server and Authentication

# Set the target Bamboo Server
Set-BambooServer -Url 'http://localhost:8085'

# Set login credentials for further cmdlets
Set-BambooAuthentication -Credential (Get-Credential)

# Get the current authenticated user details
Get-BambooCurrentUser

Build cmdlets

# List all the latest build results
Get-BambooBuild

# Get the latest or all build results for a specific Plan
Get-BambooBuild -PlanKey 'PRJKEY-PLANKEY'
Get-BambooBuild -PlanKey 'PRJKEY-PLANKEY' -All

# Start a new build or resume a pause build
Start-BambooBuild -PlanKey 'PRJKEY-PLANKEY'
Resume-BambooBuild -BuildKey 'PRJKEY-PLANKEY-2'

# Execute all manual stages for a build
Start-BambooBuild  -PlanKey 'PRJKEY-PLANKEY' -ExecuteAllStages

# Read logs from a specific build job
Get-BambooBuildLog -PlanKey 'PRJKEY-PLANKEY' -StageKey JOB1

Log and Resume

Project cmdlets

# List all projects
Get-BambooProject

# Detail a specific Project defined by the -ProjectKey
Get-BambooProject -ProjectKey 'PRJKEY'

Plan cmdlets

# List all Bamboo Plans
Get-BambooPlan

# List all Bamboo Plans for a specific Project
Get-BambooPlan -ProjectKey 'PRJKEY'

# Get details for a specific Plan
Get-BambooPlan -PlanKey 'PRJKEY-PLANKEY'

# Disable/Enable a specific Plan
Disable-BambooPlan -PlanKey 'PRJKEY-PLANKEY'
Enable-BambooPlan -PlanKey 'PRJKEY-PLANKEY'

# Clone/Copy a BambooPlan to a new Plan
Copy-BambooPlan -PlanKey 'PRJKEY-PLANKEY' -NewPlanKey 'PRJKEY-NEWPLAN'

Plan-Branch cmdlets

# Create a new PlanBranch to a VCS-branch
$BranchName='pester'
Add-BambooPlanBranch -PlanKey 'PRJKEY-PLANKEY' -BranchName $BranchName -VcsBranch 'feature/pester'

# Enable/Disable PlanBranches
Enable-BambooPlanBranch -PlanKey 'PRJKEY-PLANKEY' -BranchName $BranchName
Disable-BambooPlanBranch -PlanKey 'PRJKEY-PLANKEY' -BranchName $BranchName

Note: Plan-branches are technically child-plans for regular plans in Bamboo, which means most of the Plan cmdlets can be used for PlanBranches too, by passing their PlanKey.

Documentation

Cmdlets and functions for PsBamboo have their own help PowerShell help, which you can read with help <cmdlet-name>. PsBamboo Wiki is also added to this project with some more information.

Versioning

PsBamboo aims to adhere to Semantic Versioning 2.0.0.

Issues

In case of any issues, raise an issue ticket in this repository and/or feel free to contribute to this project if you have a possible fix for it.

Development

Pull requests are very welcome! Make sure your patches are well tested with Pester. Ideally create a topic branch for every separate change you make. For example:

  1. Fork the repo
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Make sure Invoke-Pester tests are passing with all your changes
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

Authors

Created and maintained by Akos Murati ([email protected]).

License

Apache License, Version 2.0 (see LICENSE)