Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-21573

Bamboo Specs & Global variables

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • None
    • Bamboo Specs, Variables
    • None
    • 3
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

    Description

      Issue description

      Bamboo does not pass its Global Variables as Environment Variables to Repository Stored Specs executions of Maven. This would be useful if we wanted to read the value from a Bamboo Global Variable and execute conditional code during Specs Scanning, for example. 

      Workaround

      Currently, the only workaround would be to set the variable outside Bamboo, as an Environment Variable, and read it in the Specs code:

          public static final String myVariable = System.getenv("MY_VARIABLE");
      

      However, reading environment variables during a Specs execution requires additional access that Bamboo's JVM doesn't have by default. You need to either:

      Option 1 (recommended)
      1. Locate the Java .policy file under ${JAVA_HOME}/jre/lib/security/. It might be called either default.policy or java.policy This needs to be done under the Java Home directory of the JDK your Bamboo uses.
      2. Locate the following section (usually it's the last one):
        // permissions needed by applications using java.desktop module
        grant {
        
      1. Add the following permission within the grant { section, replacing MY_VARIABLE with the variable you want to read:
            permission java.lang.RuntimePermission "getenv.MY_VARIABLE";
        

        If there are multiple variables, you can either specify all of them (new lines for each), or grant access to ALL env variables using getenv.*

      1. Save the file and run the Specs Scan.
      Option 2 (not recommended due to security risks)

      Add the following property to the <bamboo-install>/bin/setenv.sh file and restart Bamboo.

      JVM_SUPPORT_RECOMMENDED_ARGS:="-Dbamboo.repository.stored.specs.security.manager.enabled=false"
      

       Please see Configuring your system properties for detailed steps.
      Disabling the Specs Security Manager brings some security risks since this way you will allow execution of any code in Specs.

      Attachments

        Activity

          People

            Unassigned Unassigned
            7bef8aece2a3 Eduardo Collaziol
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: