Answers: <p>Currently, the only option when your container doesn't have bash is to add it. With Alpine you can do that with <code>apk add bash</code>. You can do that with <a href="https://docs.gitlab.com/ee/ci/yaml/#before_script" rel="nofollow noreferrer"><code>before_script</code></a> like this,</p>
  <pre class="lang-yaml prettyprint-override"><code>test:
    variables:
      SECURE_FILES_DOWNLOAD_PATH: './where/files/should/go/'
    before_script:
      - apk add bash
    script:
      - curl --silent &quot;https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer&quot; | bash
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2023-04-11T16:47:13.593Z
Answers: 2023-04-11T16:47:13.593Z
Answers: Evan Carroll
Body: <p>GitLab offers a <a href="https://docs.gitlab.com/ee/ci/secure_files/" rel="nofollow noreferrer">Project-level Secure Files</a>, the API has you add this to your <code>.gitlab-ci.yml</code>,</p>
  <pre class="lang-yaml prettyprint-override"><code>test:
    variables:
      SECURE_FILES_DOWNLOAD_PATH: './where/files/should/go/'
    script:
      - curl --silent &quot;https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer&quot; | bash
  </code></pre>
  <p>However, I'm using the <a href="https://gitlab.com/gitlab-org/terraform-images/-/blob/master/Dockerfile" rel="nofollow noreferrer">Terraform image which is Alpine without bash</a> which the <a href="https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" rel="nofollow noreferrer">installer script requires</a>.</p>
  <p>How can you use Secure File API if your container doesn't have bash?</p>
  
Tags: <gitlab><bash><alpine>
Title: Can you use the Secure File API if the container doesn't have bash? Like Alpine?
UserDisplayName: Evan Carroll
ThreadText: # Can you use the Secure File API if the container doesn't have bash? Like Alpine?
  
  (Asked by: username_0 on 2023-04-10)
  
  GitLab offers a [Project-level Secure Files](https://docs.gitlab.com/ee/ci/secure_files/), the API has you add this to your `.gitlab-ci.yml`,
  
  ```yaml
  test:
    variables:
      SECURE_FILES_DOWNLOAD_PATH: './where/files/should/go/'
    script:
      - curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | bash
  
  ```
  
  However, I'm using the [Terraform image which is Alpine without bash](https://gitlab.com/gitlab-org/terraform-images/-/blob/master/Dockerfile) which the [installer script requires](https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer).
  
  How can you use Secure File API if your container doesn't have bash?
  
  **Tags:** gitlab, bash, alpine
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-04-11. Score: 0 | Accepted answer
  
  Currently, the only option when your container doesn't have bash is to add it. With Alpine you can do that with `apk add bash`. You can do that with [`before_script`](https://docs.gitlab.com/ee/ci/yaml/#before_script) like this,
  
  ```yaml
  test:
    variables:
      SECURE_FILES_DOWNLOAD_PATH: './where/files/should/go/'
    before_script:
      - apk add bash
    script:
      - curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | bash
  
  ```
  
  
  ---
  
  