REST API to disable/enable elastic image configurations

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Unresolved
    • None
    • Component/s: Elastic Bamboo, REST API
    • None
    • 0
    • 1

      Summary

      Currently, the Bamboo REST API does not offer an endpoint to manage (enable/disable) elastic image configurations. The endpoint to update an image does not include a property to enable/disable it.

      Suggestion

      Add a property to enable/disable an image to the existing PUT endpoint, or create a new endpoint to enable/disable the images through the REST API.

      Workaround

      While there's no REST API endpoint available, you can still automate User Interface operations using cURL/wget. Please note the workaround provided below is not officially supported. The solution might not be applicable to future versions of Bamboo due to changes, and has been validated on Bamboo 9.2.17.

      The scripts below simulate the actions you'd take on the User Interface to enable and disable a given Elastic Image configuration. Please replace:

      1. IMAGE_ID: the ID of the elastic image you want to manage
      2. BAMBOO_BASE_URL: the base URL of your Bamboo instance
      3. ADMIN & PASSWORD: administrator credentials to Bamboo

      Disable an image configuration

      export ELASTIC_IMAGE_ID=IMAGE_ID; \
      export BAMBOO_URL=BAMBOO_BASE_URL; \
      export USER=ADMIN; \
      export PASSWORD=PASSWORD; \
      curl  \-u ${USER}:${PASSWORD} \--cookie-jar cookies.txt "${BAMBOO_URL}"'/userlogin!doDefault.action?os_authType=basic' \--head
      curl "${BAMBOO_URL}/admin/elastic/image/configuration/disableElasticImageConfiguration.action?confirmDisable=true&configurationId=${ELASTIC_IMAGE_ID}" -H 'X-Atlassian-Token: no-check' --cookie cookies.txt
      

      Enable an image configuration

      export ELASTIC_IMAGE_ID=IMAGE_ID; \
      export BAMBOO_URL=BAMBOO_BASE_URL; \
      export USER=ADMIN; \
      export PASSWORD=PASSWORD; \
      curl  \-u ${USER}:${PASSWORD} \--cookie-jar cookies.txt "${BAMBOO_URL}"'/userlogin!doDefault.action?os_authType=basic' \--head
      curl "${BAMBOO_URL}/admin/elastic/image/configuration/enableElasticImageConfiguration.action?configurationId=${ELASTIC_IMAGE_ID}" -H 'X-Atlassian-Token: no-check' --cookie cookies.txt
      

      This has been tested using cURL on a Unix environment. For any systems or tools, you'll need to perform adjustments to simulate the User Interface operations.

      For more information on how the steps were automated, please see Automating Bamboo operations using wget or Curl

            Assignee:
            Unassigned
            Reporter:
            Eduardo Collaziol
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: