デプロイ変数

Bamboo manages a number of standard reserved variables that are available during deployment executions. 

名前が繰り返される場合、次のリストで後にある変数が前の変数をオーバーライドします。

  • グローバル変数
  • 以下に定義されているリリース変数
  • 環境レベルで定義されたユーザー変数
  • 次の表の自動生成変数
変数説明
bamboo.agentIDThe id of the agent that the deployment is executed on.
bamboo.agentWorkingDirectoryエージェントの作業ディレクトリへのパス。これは Bamboo の作業ディレクトリとは異なります。
bamboo.build.working.directoryBamboo の作業ディレクトリへのパスです。これはビルド計画とデプロイ プロジェクトの両方で使用されます。
bamboo.deploy.environmentリリースがデプロイされる環境の名前。
bamboo.deploy.projectデプロイ プロジェクトの名前。
bamboo.deploy.rollbackデプロイされるリリースが置き換えられるリリースよりも古い場合に当てはまります。

bamboo.deploy.release

bamboo.deploy.version

デプロイされているリリースの名前。「.release」と「.version」のいずれかを使用できます。どちらもデプロイされるリリースの名前を返します。

bamboo.deploy.release.previous

bamboo.deploy.version.previous

The name of the release that is being replaced (if available). Either .release or .version can be used - both return the name of the release being replaced.
bamboo.resultsUrlThe URL to the screen in Bamboo that dispays build results.

For Bamboo variables to do with build plans, and releases, see Bamboo variables.

デプロイ環境の変数を設定する

デプロイ環境変数は、環境パネルの [その他の設定] セクションの一部として設定されます。

環境変数を設定する手順は以下のとおりです。

  1. Open your deployment project and expand the relevant environment panel. In the Other settings section, click Variables:
  2. [変数] 画面の関連フィールドに有効なキーと値を入力します。
  3. Click on Add to add the variable scheme:


  4. You can remove unwanted variables by clicking the relevant dustbin icon on the right of the Variables screen.
  5. 戻るには、[Back to deployment project (デプロイ プロジェクトに戻る)] をクリックします。
  • ラベルなし

28 Comments

  1. Jeremy Goodwin

    Is there an equivalent to '${bamboo.build.working.directory} for a deployment?

     

    #edit

    Turns out it is the build working directory. While appreciating this is beta so documentation etc is going to be light, it would be helpful to state that it uses the same build variables when creating a deployment (smile)

  2. Dennis Alberti

    Is there a way to use JIRA custom variables when a release is started out of JIRA with existing Build?

    I see the custom variables in the build summary when i trigger a release out of JIRA, like 

    jira.version1.0.2.1

    But i can't access the Variable with '${bamboo.jira.version}' for configuring release versioning in Bamboo (sad) 

    1. Anonymous

      In order to use the version number from your JIRA project, you have to release from within JIRA.

      JIRA -> Project -> Versions -> Release. Then the JIRA variables will be transferred to Bamboo for deployment.

  3. Barry Pitman

    I think that the "bamboo.deploy.release" should actually be "bamboo.deploy.version", and probably the same for "bamboo.deploy.release.previous". The variable "bamboo.deploy.release" doesn't resolve to anything in Bamboo 5. 

    Also, I am finding that URL resolved from "bamboo.resultsUrl" is something like this: https://<my server>/bamboo/browse/viewDeploymentResult.action?deploymentResultId=18874369. Following that URL results in an "Internal Server Error" with message:

    There is no Action mapped for namespace /browse and action name viewDeploymentResult.
    1. James Dumay

      Thanks Barry. Ill get someone to take a look at this and fix it for 5.1

  4. Anonymous

    Great call Barry! I've been tearing my hair out!

  5. Anonymous

    Custom plan variables do not seem to resolve to their values consistently when generating a release.  I have plan variables to store the major and minor versions separately, as our deploy scripts handle major and minor upgrades differently, and the variables only seem to resolve to their value half of the time when generating a new release.  Funny thing is, the variables always seem to work right when I click preview on the Release Versioning page.

  6. Casey Entzi

    I experienced the same problem but i assumed it was due to an automatic build vs a manual build, as the automatic build didn't seem to have access to the plan variables from the build but when I reran the build manually, and created another release, it worked..

  7. Steven de Salas

    Casey, Anonymous,

    I added the following ticket to track loss of plan variables in deployment for automated builds: 

    BAM-13644 - Getting issue details... STATUS  

    Steven
  8. Ron Chan

    I am reiterating Dennis question: 

    "Is there a way to use JIRA custom variables when a release is started out of JIRA with existing Build?

    I see the custom variables in the build summary when i trigger a release out of JIRA, like 

    jira.version1.0.2.1

    But i can't access the Variable with '${bamboo.jira.version}' for configuring release versioning in Bamboo"

    We're really excited to jump into Deployment Projects but this seems like a blocker to me.

    Our desired setup:
    - Commits generate auto-builds
    - Release from a JIRA version (select 'existing build' option)
    - Create deployment project using ${bamboo.jira.version}

    So why isn't Bamboo picking up the version???

     

    1. Ron Chan

      By the way, I've tried  BAM-13644 - Getting issue details... STATUS  by upgrading to Bamboo 5.1.0...still no luck! (sad)

      1. James Dumay

        Thanks for commenting on the ticket Ron. I've asked our support team to contact you and get to the bottom of this problem.

    2. Anonymous

      In order to use the version number from your JIRA project, you have to release from within JIRA.

      JIRA -> Project -> Versions -> Release. Then the JIRA variables will be transferred to Bamboo for deployment.

      1. Spot Support

        That response is incorrect because of  BAM-13730 - Getting issue details... STATUS

        Anonymous - You should know that it works instead of giving bad information.

         

  9. Ron Chan

    Thank you James.

  10. user-055e6

    Is there a way to send variables from custom builds to deployments in Bamboo 5.2? We need to be able to send username and password that were used in a build to a deployment for ssh and ftp deployment tasks.

     

    1. user-055e6

      After setting up a deployment it looks like the plan variables are being passed to the deployment. This is great!

  11. Ron Chan

    Nathan, what changes did you make to the page?  Was it screenshots for new functionality or just documentation cleanup?

    By the way, the deployment variables still doesn't work for me, BAM-13730.  So JIRA is used to trigger release builds, values are not being passed to the bamboo deployment projects.  Has anyone encountered this or has any workaround???

     

     

     

     

    1. Ron Chan

      I would really appreciate if someone from Atlassian could provide me with an update or at least a response to this?

      To sum up, here's the issue:

      1. Code commit to trigger bamboo 'build'
      2. Release project version (from JIRA) and trigger 'release' of above build
      3. Triggered project version x.x.x should be passed to the bamboo deployment project (configured as ${bamboo.jira.version})
      4. However, ${bamboo.jira.version} remains unchanged

      According to documentation, this should work but it has not.  I've tested 5.1, 5.2 and the latest 5.2.2.  Can someone help???

       

       

       

  12. user-055e6

    This is a more of a request than it is a bug I think. When overriding variables of type password, the input type is text and you are able to see the password as the user types. Can we change it so that any password variables that are overridden have an input of type password? Thanks

    1. user-055e6

      And to go along with that change can we add a flag to variables that marks them as required to be overridden? That way when a user clicks run they automatically get a modal that pops to override the required variables.

      1. ArmenA

        Patrick,

        Bamboo currently doesn't have a feature for flagging variables to be mandatory to override. We are tracking a similar request here -  BAM-12514 - Getting issue details... STATUS .

        Can we change it so that any password variables that are overridden have an input of type password?

        I raised an improvement - BAM-14050 - Getting issue details... STATUS .

        Armen

  13. Ladislav Gatial

    is it possible to use bamboo.repository.revision.number variable in release name in deployment projects feature? it is not working in my Version of bamboo 5.2. 

    bamboo.buildNumber variable is resolved fine, but the revision variable is not working...

     

     

    1. ArmenA

      Hi Ladislav,

      The bamboo.repository.revision.number variable is missing from the list of variables on the current page. Hence it's not available. You might be interested in trying the method described on this page - Resetting Variables via a REST API call and Dynamic Release versioning.

      Armen

  14. Andrew Heald

    It doesn't seem to be possible to set up deploy variables that can be overridden at deploy time. Have I missed something?

    The scenario here is that we have a deployment that needs an optional database drop. Some deploys will, some won't. I could do with having the deployment person be prompted. Any ideas, please?

    Thanks,
    Andrew.

    1. James Dumay

      It can't be done today. For the moment I would suggest making your deployment script intelligent enough to know if it needs to drop the db or not during the deployment process.

      We have an open ticket for parameterised deployments but it is not on our roadmap:

      BAM-13707 - Getting issue details... STATUS

  15. John Sposato

    In Bamboo 5.4.2 build 4208, it seems these variables for scripts (SSH task anyway) aren't referenced as the documentation mentions.  You can't use $BAMBOO_VARIABLE, you have to use ${bamboo.variable}.  Some examples in some of the tasks might help.  By that, I mean an example SSH/SCP task with a plan variable that was defined...

  16. Bastien THORAL

    Hello, I have also a need to use autogenerated variables in a powershell deployment script. I easily used $Env:bamboo_XXXX for my variables but it doesn't seem to work for autogenerated. I add them to the command line with a "-D" but I would be so better to access them directly. Any idea

    Thank you.