Labelling a build from a deployment plan

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

目的

When you run a deployment plan, you may wish to label the build that produced its artifacts. When the deployment plan runs, you would like the label to be applied automatically. 

ソリューション

This can be achieved using the Bamboo REST API, which specifies an endpoint for retrieving, adding and deleting labels. To do this:

  • Add a Script task to your deployment plan containing the following:

    ##### Set these values
    LABEL="deployed"
    BAMBOO_URL="http://your.bamboo.inst"
    USERNAME="youruser"
    PASSWORD="your password"
    
    ##### Leave these values as is
    XMLDATA='<?xml version="1.0" encoding="UTF-8" standalone="yes"?><label name="'$LABEL'"/>'
    POSTURL="${BAMBOO_URL%/}"'/rest/api/latest/result/${bamboo.buildResultKey}/label?os_authType=basic'
    curl -X POST --user $USERNAME:$PASSWORD -H "Content-Type: application/xml" --data "$XMLDATA" -X POST $POSTURL
  • Set the LABEL variable to the label text you would like to apply, and set the BAMBOO_URL, USERNAME and PASSWORD variables accordingly

This will perform an HTTP POST will add your label to the build that produced the artifacts for your deployment

最終更新日: 2016 年 2 月 10 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.