cki_utils.sh
Common utility functions for CKI shell scripts
The cki_utils.sh
file provides a collection of utility functions used across
CKI shell scripts. It should be sourced at the beginning of shell scripts that
need these utilities.
Usage
# shellcheck source-path=SCRIPTDIR
. cki_utils.sh
Key Functions
Output Functions
cki_say
: Write stylized headers with toilet/lolcat fallbackcki_echo_green
: Write bold green messages (GitLab-runner style)cki_echo_red
: Write bold red messagescki_echo_yellow
: Write bold yellow messages
Configuration Functions
cki_parse_bucket_spec
: Parse deployment-all-style bucket specificationscki_openssl_enc
: Call openssl enc with reasonable defaultscki_is_true
: Check if a variable has a truthy value
Git Functions
cki_git_clean_url
: Canonicalize git repository URLscki_update_repo
: Clone and update GitLab repositories
Script Management
cki_prepare
: Unified preparation function for CKI scripts - see cki_prepare documentationmaybe_run_linter
: Conditionally run linters based on skip listscki_contained_in_array
: Check if an array contains an element
Key Features
Script Preparation
The most important function is cki_prepare
, which handles:
- Dependency installation
- Package version management
- Override handling
- Script restart logic
For detailed information about cki_prepare
and its environment variables, see the cki_prepare documentation.
Linter Management
Functions like maybe_run_linter
provide consistent handling of linter execution
with skip/ignore capabilities across different scripts.
Repository Management
Git-related functions help with repository URL normalization and automated repository updates with caching.