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

REST API Support for Downloading Artifacts Stored via SFTP Handler in Bamboo Data Center

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • None
    • Artifacts, REST API
    • None
    • 2
    • 2
    • 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.

      Problem Definition

      Currently, Bamboo Data Center does not provide a REST API endpoint to download build artifacts when the SFTP artifact handler is enabled. While artifacts stored on local or S3 storage can be accessed via HTTP(S) URLs or REST endpoints, artifacts managed by the SFTP handler are only accessible directly from the SFTP server using SSH/SFTP credentials. This limitation prevents automation and integration workflows that rely on RESTful access to artifacts, and complicates artifact retrieval for users and scripts that lack direct SFTP access.

      Additional Details

      It is technically possible to construct a direct artifact download URL by using the Bamboo REST API to retrieve metadata (such as build number, artifact name, and file path). However, this process requires manual construction of the URL and is not fully automated or streamlined. Bamboo’s REST API does not currently proxy or stream artifacts from the SFTP server, and HTTP(S) download via Bamboo’s UI or API is not supported with the SFTP artifact handler. This gap makes it difficult to automate artifact retrieval and integrate with external tools or scripts.

      Suggested Solution

      Implement a REST API endpoint in Bamboo Data Center that allows users to securely download build artifacts stored via the SFTP handler, similar to the existing REST endpoints for local and S3 artifact storage. The API should:

      • Accept standard authentication (PAT, session, etc.)
      • Proxy or stream the artifact from the SFTP server to the client via Bamboo, without requiring direct SFTP access or SSH keys
      • Support both shared and non-shared artifacts
      • Allow artifact discovery and download via a consistent RESTful interface

      Examples / Current Workarounds

      Constructing the Artifact Download URL:

      Use the Bamboo REST API to retrieve build and artifact metadata:

      GET http://<bamboo-server>:8085/rest/api/latest/result/<PLAN_KEY>-<BUILD_NUMBER>?expand=artifacts
      GET http://<bamboo-server>:8085/rest/api/latest/plan/<PLAN_KEY>-<BUILD_NUMBER>/artifact/
      

      Manually construct the download URL:

      http://<bamboo-server>:8085/plugins/servlet/sftp-artifact/<PLAN_KEY>/plan-<PLAN_ID>/shared/build-<BUILD_NUMBER_PADDED>/<ARTIFACT_NAME>/<ARTIFACT_PATH>/<ARTIFACT_FILE>
      

      Downloading Artifacts via SFTP (with SSH Key):

      sftp -i /path/to/private_key <USER>@<SFTP-SERVER>:<SFTP-REMOTE-PATH>/plan-<plan_id>/shared/build-<build_number_padded>/<artifact_name>/<artifact_file> .
      

      Example:

      sftp -i /Users/adantas/Downloads/bamboo_sftp_prod_key ubuntu@linux-114362.prod.atl-cd.net:/home/ubuntu/artifacts/plan-884737/shared/build-00002/ArtifactTest/artifact-text.txt .
      

      Downloading Artifacts via curl with SFTP Support:

      Check for SFTP support:

      curl --version
      

      Download the artifact:

      curl --key /path/to/private_key --user <USER>: \
        sftp://<SFTP-SERVER>/<SFTP-REMOTE-PATH>/plan-<plan_id>/shared/build-<build_number_padded>/<artifact_name>/<artifact_file> \
        -o <artifact_file>
      

              Unassigned Unassigned
              bda18cee79a2 Arthur Dantas
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: