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 fallback
  • cki_echo_green: Write bold green messages (GitLab-runner style)
  • cki_echo_red: Write bold red messages
  • cki_echo_yellow: Write bold yellow messages

Configuration Functions

  • cki_parse_bucket_spec: Parse deployment-all-style bucket specifications
  • cki_openssl_enc: Call openssl enc with reasonable defaults
  • cki_is_true: Check if a variable has a truthy value

Git Functions

  • cki_git_clean_url: Canonicalize git repository URLs
  • cki_update_repo: Clone and update GitLab repositories

Script Management

  • cki_contained_in_array: Check if an array contains an element

Repository Management

Git-related functions help with repository URL normalization and automated repository updates with caching.

Others

  • cki_contained_in_array: Check if an array contains an element