feat: install OCI CLI through Jeannie
This commit is contained in:
parent
1f1bcbff72
commit
9f42e29d02
|
|
@ -10,6 +10,11 @@ Credentials come from the standard OCI CLI configuration (`~/.oci/config`);
|
|||
private keys are not stored in the repository. Use `./jeannie oci-foundation
|
||||
plan` first, inspect the plan, then apply from the Debian pipeline host.
|
||||
|
||||
The foundation plan/apply path installs OCI CLI into
|
||||
`~/.local/share/homelab/venvs/oci-cli` on Debian by default. Set
|
||||
`LAB_OCI_CLI_AUTO_INSTALL=false` to disable that behavior, or install it
|
||||
explicitly with `./jeannie oci-auth install`.
|
||||
|
||||
Prepare the config with `./jeannie oci-auth init`. The command creates the
|
||||
private key locally, prints the public key for the one-time OCI user upload,
|
||||
and writes the config with restrictive permissions. It never sends the private
|
||||
|
|
|
|||
2
jeannie
2
jeannie
|
|
@ -125,7 +125,7 @@ Observability And GitOps
|
|||
email-vm {status|plan|apply|destroy --yes} Manage the independent OCI email learning VM.
|
||||
oci-foundation {status|plan|apply|destroy --yes}
|
||||
Create the opt-in OCI compartment, network, edge VM, and email VM.
|
||||
oci-auth {init [--force]|check} Prepare/check OCI API-key authentication on Debian.
|
||||
oci-auth {install|init [--force]|check} Install/check OCI CLI and API-key authentication on Debian.
|
||||
edge-cache-flush Clear Nginx, Varnish, and Squid edge caches.
|
||||
promote {plan|validate|rollback APP} Run canary promotion gates and rollback plan.
|
||||
cert-check Check public DNS, TLS, and edge URL health.
|
||||
|
|
|
|||
|
|
@ -3343,6 +3343,9 @@ oci_foundation_manage() {
|
|||
echo "OCI foundation is disabled. Set LAB_OCI_FOUNDATION_ENABLED=true and the required LAB_OCI_* inputs first." >&2
|
||||
return 2
|
||||
fi
|
||||
if [[ "${LAB_OCI_CLI_AUTO_INSTALL:-true}" == "true" ]]; then
|
||||
"${REPO_ROOT}/scripts/oci-auth" install
|
||||
fi
|
||||
tofu -chdir="${stack}" init
|
||||
if [[ "${action}" == "plan" ]]; then
|
||||
tofu -chdir="${stack}" plan "$@"
|
||||
|
|
|
|||
|
|
@ -11,6 +11,26 @@ profile="${OCI_CLI_PROFILE:-${OCI_CONFIG_PROFILE:-DEFAULT}}"
|
|||
config_file="${OCI_CONFIG_FILE:-${HOME}/.oci/config}"
|
||||
key_file="${OCI_PRIVATE_KEY_PATH:-${HOME}/.oci/oci_api_key.pem}"
|
||||
public_key_file="${key_file}.pub"
|
||||
cli_venv="${OCI_CLI_VENV:-${HOME}/.local/share/homelab/venvs/oci-cli}"
|
||||
oci_bin=""
|
||||
|
||||
resolve_oci_bin() {
|
||||
if command -v oci >/dev/null 2>&1; then
|
||||
oci_bin="$(command -v oci)"
|
||||
elif [[ -x "${cli_venv}/bin/oci" ]]; then
|
||||
oci_bin="${cli_venv}/bin/oci"
|
||||
fi
|
||||
}
|
||||
|
||||
install_cli() {
|
||||
command -v python3 >/dev/null 2>&1 || { echo "python3 is required to install OCI CLI." >&2; return 1; }
|
||||
mkdir -p "$(dirname "${cli_venv}")"
|
||||
if [[ ! -x "${cli_venv}/bin/python" ]]; then
|
||||
python3 -m venv "${cli_venv}"
|
||||
fi
|
||||
"${cli_venv}/bin/python" -m pip install --upgrade pip oci-cli
|
||||
echo "OCI CLI installed at ${cli_venv}/bin/oci"
|
||||
}
|
||||
|
||||
fingerprint_for_key() {
|
||||
openssl rsa -in "$1" -pubout -outform DER 2>/dev/null \
|
||||
|
|
@ -27,12 +47,13 @@ check_auth() {
|
|||
echo "OCI config: ${config_file}"
|
||||
echo "OCI profile: ${profile}"
|
||||
echo "Key fingerprint: ${fingerprint}"
|
||||
if command -v oci >/dev/null 2>&1; then
|
||||
OCI_CONFIG_FILE="${config_file}" OCI_CLI_PROFILE="${profile}" \
|
||||
oci iam region list --query 'data[0].name' --raw-output >/dev/null
|
||||
resolve_oci_bin
|
||||
if [[ -n "${oci_bin}" ]]; then
|
||||
"${oci_bin}" iam region list --config-file "${config_file}" --profile "${profile}" \
|
||||
--query 'data[0].name' --raw-output >/dev/null
|
||||
echo "OCI API authentication: OK"
|
||||
else
|
||||
echo "OCI CLI not installed; local config/key validation passed."
|
||||
echo "OCI CLI not installed; local config/key validation passed. Run ./jeannie oci-auth install."
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -93,7 +114,8 @@ PY
|
|||
}
|
||||
|
||||
case "${action}" in
|
||||
install) install_cli ;;
|
||||
init) init_auth "$@" ;;
|
||||
check) check_auth ;;
|
||||
*) echo "Usage: ./jeannie oci-auth {init [--force]|check}" >&2; exit 2 ;;
|
||||
*) echo "Usage: ./jeannie oci-auth {install|init [--force]|check}" >&2; exit 2 ;;
|
||||
esac
|
||||
|
|
|
|||
Loading…
Reference in New Issue