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

Disabling auto-capability detection for the remote agent is not working for new agent

    XMLWordPrintable

Details

    Description

      Summary

      1. Source-code

      ./components/bamboo-api/src/main/java/com/atlassian/bamboo/utils/SystemProperty.java:195
          /**
           *  Prevents agents from automatically overriding remote agent capabilities on new startup
           * <p>
           * <ul>
           * <li>Default    : false
           * <li>Usage: <ul><li>env : DISABLE_AGENT_AUTO_CAPABILITY_DETECTION="true"
           *                  <li>java: -DDISABLE_AGENT_AUTO_CAPABILITY_DETECTION=true
           *              </ul>
           * </ul>
           */
          public static final SystemProperty DISABLE_AGENT_AUTO_CAPABILITY_DETECTION = new SystemProperty(false, "DISABLE_AGENT_AUTO_CAPABILITY_DETECTION");
      

      2. Steps to Reproduce

      1. stop Bamboo (server)
      2. add property to prevent agents from automatically overriding remote agent capabilities on new startup
        <bamboo-install>/bin/setenv.sh, Windows (setenv.bat) - Linux/MacOSX (setenv.sh)
        JVM_SUPPORT_RECOMMENDED_ARGS="-DDISABLE_AGENT_AUTO_CAPABILITY_DETECTION=true"
        
      3. start Bamboo server
      4. install Bamboo remote agent
        java -Dbamboo.home=/path/to/remote-agent-home -jar atlassian-bamboo-agent-installer-5.9.x.jar http://BAMBOO_BASE_URL/agentServer/
        

      3. Expected Results

      According to Bamboo's documentation - Disabling auto-capability detection for the remote agent the remote agent should not automatically detect and add capabilities.

      There may be situations where you want to prevent Bamboo from automatically detecting and adding capabilities (such as JDKs) to the remote agent, or where you don't want to run the remote agent with default capabilities.

      4. Actual Results

      By going to "Bamboo administration >> Overview >> Build resources >> Agents" and selecting the "Remote Agent", under "Capabilities" tab we can find a few capabilities listed. The same can be reviewed by running the following SQL query against Bamboo's database:

      /* 1507331 is the remote agent id */
      select *
        from queue as AGENT
        join capability as CAPABILITY
              on AGENT.capability_set = CAPABILITY.capability_set
       where AGENT.capability_set = 1507331;
      

      As a response from the query above, you can find the following:

      queue_id agent_type title agent_description created_date updated_date enabled capability_set last_start_time last_stop_time elastic_instance_id elastic_image capability_id key_identifier value capability_set
      1474563 REMOTE 192.168.10.80 Remote agent on host 192.168.10.80 2015-10-20 12:19:49 2015-10-20 12:19:49 true 1507331 2015-10-20 12:19:49 (null) (null) (null) 1540115 system.builder.mvn3.Maven 3 /opt/maven/apache-maven-3.3.3 1507331
      1474563 REMOTE 192.168.10.80 Remote agent on host 192.168.10.80 2015-10-20 12:19:49 2015-10-20 12:19:49 true 1507331 2015-10-20 12:19:49 (null) (null) (null) 1540114 system.jdk.JDK /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home 1507331
      1474563 REMOTE 192.168.10.80 Remote agent on host 192.168.10.80 2015-10-20 12:19:49 2015-10-20 12:19:49 true 1507331 2015-10-20 12:19:49 (null) (null) (null) 1540113 system.jdk.JDK 1.7 /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home 1507331
      1474563 REMOTE 192.168.10.80 Remote agent on host 192.168.10.80 2015-10-20 12:19:49 2015-10-20 12:19:49 true 1507331 2015-10-20 12:19:49 (null) (null) (null) 1540112 system.hg.executable /usr/local/bin/hg 1507331
      1474563 REMOTE 192.168.10.80 Remote agent on host 192.168.10.80 2015-10-20 12:19:49 2015-10-20 12:19:49 true 1507331 2015-10-20 12:19:49 (null) (null) (null) 1540111 system.git.executable /usr/local/bin/git 1507331
      1474563 REMOTE 192.168.10.80 Remote agent on host 192.168.10.80 2015-10-20 12:19:49 2015-10-20 12:19:49 true 1507331 2015-10-20 12:19:49 (null) (null) (null) 1540110 system.jdk.JDK 1.7.0_79 /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home 1507331
      1474563 REMOTE 192.168.10.80 Remote agent on host 192.168.10.80 2015-10-20 12:19:49 2015-10-20 12:19:49 true 1507331 2015-10-20 12:19:49 (null) (null) (null) 1540109 foo bar 1507331

      5. Notes

      In the above example, it was created "<bamboo-agent-home>/bin/bamboo-capabilities.properties"with the following content:

      <bamboo-agent-home>/bin/bamboo-capabilities.properties
      foo=bar
      

      And we can notice the capability was added to the remote agent.

      queue_id agent_type title agent_description created_date updated_date enabled capability_set last_start_time last_stop_time elastic_instance_id elastic_image capability_id key_identifier value capability_set
      1474563 REMOTE 192.168.10.80 Remote agent on host 192.168.10.80 2015-10-20 12:19:49 2015-10-20 12:19:49 true 1507331 2015-10-20 12:19:49 (null) (null) (null) 1540109 foo bar 1507331

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rsperafico Rafael Sperafico (Inactive)
              Votes:
              15 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: