Skip to content

magichome/xlr-bitbucket-plugin

 
 

Repository files navigation

XLR Bitbucket plugin

Build Status Codacy Badge Code Climate License: MIT Github All Releases

This plugin offers an interface from XL Release to Atlassian Stash(Now Bitbucket Server) and Bitbucket Cloud API

IMPORTANT

  • Use Stash Connection and Stash Tasks if you're using an on-prem hosted Bitbucket Server. Stash is now called Bitbucket Server.
  • Use Bitbucket Connection and Bitbucket Tasks if you're using Bitbucket Cloud.
  • All Stash/Bitbucket Server tasks are based on api /rest/api/1.0/ prefix
  • All Bitbucket Cloud tasks are based on api /2.0/ prefix

Development

  • Start XLR: ./gradlew runDockerCompose

Type definitions

Commit Pull Triggers

  • bitbucket.CommitTrigger : This trigger can be used to poll Bitbucket cloud for triggering releases on code commit
  • stash.CommitTrigger : This trigger can be used to poll Stash for triggering releases on code commit

Webhook (Push)

  • Stash Push Webhook http://<xlr server:port>/api/extension/stash/push_webhook?template=<template name> : This can be used to push Commit notifications across branches in a repository. Requires Web POST Hooks Plugin

  • Stash Pull Request Webhook http://<xlr server:port>/api/extension/stash/pr_webhook?template=<template name> : This can be used to push Pull Request notifications. Requires Pull Request Notifier Plugin

    • Method : POST
    • Provide Auth using XLR Credentials
    • Provide Header :: Content-Type : application/json
    • Trigger Condition : PR OPENED
    • Select Option : Encode HTML ( so that commit squash line breaks get encoded)
    • POST Body Content:
     	{ "push":"true",
         "pr_number":"${PULL_REQUEST_ID}",
         "repository":"${PULL_REQUEST_FROM_REPO_SLUG}",
         "proj": "${PULL_REQUEST_FROM_REPO_PROJECT_KEY}",
         "pr_title":"${PULL_REQUEST_TITLE}",
         "comment" :"${PULL_REQUEST_DESCRIPTION}",
         "source_hash":"${PULL_REQUEST_FROM_HASH}",
         "source_branch":"${PULL_REQUEST_FROM_BRANCH}",
         "source_project":"${PULL_REQUEST_FROM_REPO_PROJECT_KEY}",
         "source_repo":"${PULL_REQUEST_FROM_REPO_SLUG}",
         "target_hash": "${PULL_REQUEST_TO_HASH}",
         "target_branch":"${PULL_REQUEST_TO_BRANCH}",
         "target_project":"${PULL_REQUEST_TO_REPO_PROJECT_KEY}",
         "target_repo":"${PULL_REQUEST_TO_REPO_SLUG}"
         }
    
  • Bitbucket Push Webhook http://<xlr server:port>/api/extension/bitbucket/push_webhook?template=<template name> : This can be used to push Commit notifications across branches in a repository.

Bitbucket Tasks

  • bitbucket.CreatePullRequest : This task helps to create a pull request
  • bitbucket.MergePullRequest : This task helps to Merge a pull request
  • bitbucket.WaitForMerge : This task waits and polls bitbucket to check the status of a Pull request Merge Status
  • bitbucket.DownloadCode : This task allows to export a code zip file that can be downloaded to a specified folder on XL Release server locally for a provided branch in repository

Stash Tasks

  • stash.CreatePullRequest : This task helps to create a pull request

  • stash.MergePullRequest : This task helps to Merge a pull request

  • stash.DeclinePullRequest : This task can be used to Decline a pull request

  • stash.WaitForMerge : This task waits and polls stash to check the status of a Pull request Merge Status

  • stash.DownloadCode : This task allows to export a code zip file that can be downloaded to a specified folder on XL Release server locally for a provided branch in repository. Requires Bitbucket Server Archive plugin

  • stash.searchFileContent : This task allows to search a file's content in a repository/branch using a provided pattern and return group0 and group1 as results. eg.

     version[ ]*=[ ]*(\d+)
    
    
  • stash.DeleteBranch : This task allows to delete a branch

  • stash.TagRelease : This task adds a tag to a branch

Commit Trigger Usage

  • Stash commit trigger configuration

Bitbucket Tasks Usage

  • Setup the server configuration

  • Create pull request

  • Merge pull request

  • Wait for merge

  • Download Code

Stash Tasks Usage

  • Setup the server configuration

  • Create pull request

  • Merge pull request

  • Wait for merge

  • Decline pull request

  • Delete branch

  • Search file content

  • Download Code

  • Get Pull Request

  • Tag Release

References

Stash/Bitbucket Server REST API
Bitbucket Cloud REST API

About

XL Release plugin to work with stash and bitbucket cloud

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%