Merge "Download IR workspace from a URL before importing it"

changes/81/712481/4
Zuul 3 years ago committed by Gerrit Code Review
commit f0abb26100

@ -16,7 +16,9 @@ IR_SOURCE_DIR=$(realpath "${IR_SOURCE_DIR:-${IR_VIRTUAL_ENV}/infrared}")
IR_EXECUTABLE=${IR_VIRTUAL_ENV}/bin/infrared
export IR_HOME=$(realpath ${IR_HOME:-$(pwd)/.infrared/})
IR_TOBIKO_PLUGIN=$(realpath ${IR_TOBIKO_PLUGIN:-$(pwd)/roles/infrared})
IR_WORKSPACE_FILE=${IR_WORKSPACE_FILE:-$(realpath ./workspace.tgz)}
IR_WORKSPACE_URL=${IR_WORKSPACE_URL:-}
function ir {
@ -38,12 +40,23 @@ function ir_setup {
pip install --upgrade "${package_name}"
done
# Cleanup IR workspaces
rm -fR "${IR_HOME}"
(
# IR requires to work from its source folder
cd "${IR_SOURCE_DIR}"
# Install IR plugins
"${IR_EXECUTABLE}" plugin list --available --versions || true
"${IR_EXECUTABLE}" plugin remove tobiko || true
"${IR_EXECUTABLE}" plugin add "${IR_TOBIKO_PLUGIN}"
# Import IR workspace
if [ "${IR_WORKSPACE_URL}" != "" ]; then
local temp_file=$(mktemp)
curl "${IR_WORKSPACE_URL}" -o "${temp_file}"
mkdir -p $(dirname "${IR_WORKSPACE_FILE}")
mv "${temp_file}" "${IR_WORKSPACE_FILE}"
fi
if [ -f "${IR_WORKSPACE_FILE}" ]; then
"${IR_EXECUTABLE}" workspace import "${IR_WORKSPACE_FILE}"
fi

Loading…
Cancel
Save