Files
kata-containers/tests/install_opa.sh
Fabiano Fidêncio 18c54060e4 tests: Fix shellcheck issues in install_opa.sh
Fix shellcheck warnings and notes identified by running
shellcheck --severity=style.

Signed-off-by: Fabiano Fidêncio <ffidencio@nvidia.com>
2026-04-24 08:14:07 +02:00

42 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Copyright (c) Edgeless Systems GmbH
#
# SPDX-License-Identifier: Apache-2.0
set -eou pipefail
[[ -n "${DEBUG:-}" ]] && set -o xtrace
test_dir=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
# shellcheck source=/dev/null
source "${test_dir}/common.bash"
install_opa()
{
local url
local version
url=$(get_test_version "externals.opa.url")
version=$(get_test_version "externals.opa.version")
if opa version 2>/dev/null | grep -q "${version}"; then
info "OPA version ${version} is already installed"
return 0
fi
info "Installing OPA version ${version} from ${url}"
curl -fsSL "${url}/releases/download/${version}/opa_linux_amd64_static" \
-o "/usr/local/bin/opa" \
|| die "Failed to download OPA binary"
chmod +x "/usr/local/bin/opa" \
|| die "Failed to make OPA binary executable"
command -v opa &>/dev/null \
|| die "OPA binary not found in PATH after installation"
info "Successfully installed OPA version ${version}"
}
install_opa