How to use the Bash component to upload a file to a compute

Step 1. Upload a file

  1. Click on the Bash component, go to the Artifacts section.

Fig. upload a file

  1. Click upload and select a file (e.g., readme.txt) from the local archieve content. This file will be uploaded to the compute node.

Fig. upload a local file

(Alternative) Step 2. Upload a remote file

Under Remote, you can specify a remote URL to upload a file from github or gitlab.

Fig. upload a remote file

For examples:

  • URL: https://raw.githubusercontent.com/opentelekomcloud-blueprints/tosca-tutorials/master
  • File: README.md

In this example, the file README.md from the given github will be uploaded to the compute node.

note

We allow to upload files from the following domains: .gitlab.com, .github.com, .githubusercontent.com, .t-systems.com, .rubygems.org, .treasuredata.com, .letsencrypt.org, .galaxy.ansible.com, .googleapis.com.

Step 3. Use the uploaded file

  • Write a configure artifact for the Bash component (e.g., configure.sh) as follows:
#!/bin/bash
# the environment variable $upload holds the path to the upload file
echo "Path to upload file: $upload"
cat $upload

Expected result

When the Bash component is executed on the compute, the deployment logs will print out the path to the uploaded file (e.g., /home/ubuntu/.yorc.../readme.txt) and its content.

Fig. Result upload a local file