From df8236d943cbe1c522c9358eac07df1b02f39df1 Mon Sep 17 00:00:00 2001 From: Badrikesh Prusty Date: Thu, 14 Mar 2024 23:45:22 +0530 Subject: [PATCH] kas-container: update kas-container to 4.3.1 - update kas container to latest release version 4.3.1 - update header version 16 Signed-off-by: Badrikesh Prusty --- kas-container | 94 +++++++++++++++------------- kas/ci/fast.yml | 2 +- kas/ci/full.yml | 2 +- kas/common/base.yml | 2 +- kas/debian/bookworm-base.yml | 2 +- kas/debian/mtda-beaglebone-black.yml | 2 +- kas/debian/mtda-nanopi-all.yml | 2 +- kas/debian/mtda-nanopi-neo.yml | 2 +- kas/debian/mtda-nanopi-r1.yml | 2 +- kas/debian/mtda-qemu-amd64.yml | 2 +- kas/debian/mtda-rpi4b.yml | 2 +- kas/opt/lava.yml | 2 +- kas/ubuntu/mtda-qemu-amd64.yml | 2 +- 13 files changed, 64 insertions(+), 54 deletions(-) diff --git a/kas-container b/kas-container index dcaefcb5..af938285 100755 --- a/kas-container +++ b/kas-container @@ -29,11 +29,12 @@ set -e usage() { - printf "%b" "Usage: $0 [OPTIONS] { build | shell } [KASOPTIONS] [KASFILE]\n" - printf "%b" " $0 [OPTIONS] { checkout | dump } [KASOPTIONS] [KASFILE]\n" - printf "%b" " $0 [OPTIONS] for-all-repos [KASOPTIONS] [KASFILE] COMMAND\n" - printf "%b" " $0 [OPTIONS] { clean | cleansstate | cleanall} [KASFILE]\n" - printf "%b" " $0 [OPTIONS] menu [KCONFIG]\n" + SELF="${KAS_CONTAINER_SELF_NAME}" + printf "%b" "Usage: ${SELF} [OPTIONS] { build | shell } [KASOPTIONS] [KASFILE]\n" + printf "%b" " ${SELF} [OPTIONS] { checkout | dump } [KASOPTIONS] [KASFILE]\n" + printf "%b" " ${SELF} [OPTIONS] for-all-repos [KASOPTIONS] [KASFILE] COMMAND\n" + printf "%b" " ${SELF} [OPTIONS] { clean | cleansstate | cleanall} [KASFILE]\n" + printf "%b" " ${SELF} [OPTIONS] menu [KCONFIG]\n" printf "%b" "\nPositional arguments:\n" printf "%b" "build\t\t\tCheck out repositories and build target.\n" printf "%b" "checkout\t\tCheck out repositories but do not build.\n" @@ -80,6 +81,15 @@ usage() exit 1 } +fatal_error(){ + echo "${KAS_CONTAINER_SELF_NAME}: Error: $*" >&2 + exit 1 +} + +warning(){ + echo "${KAS_CONTAINER_SELF_NAME}: Warning: $*" >&2 +} + trace() { [ -n "${KAS_VERBOSE}" ] && echo "+ $*" >&2 @@ -134,9 +144,10 @@ run_clean() { fi } -KAS_IMAGE_VERSION_DEFAULT="4.1" +KAS_IMAGE_VERSION_DEFAULT="4.3.1" KAS_CONTAINER_IMAGE_PATH_DEFAULT="ghcr.io/siemens/kas" KAS_CONTAINER_IMAGE_NAME_DEFAULT="kas" +KAS_CONTAINER_SELF_NAME="$(basename "$0")" set_container_image_var() { KAS_IMAGE_VERSION="${KAS_IMAGE_VERSION:-${KAS_IMAGE_VERSION_DEFAULT}}" @@ -167,14 +178,12 @@ if [ -z "${KAS_CONTAINER_ENGINE}" ]; then ;; *) # The docker command is an unknown engine - echo "$0: docker command found, but unknown engine detected" >&2 - exit 1 + fatal_error "docker command found, but unknown engine detected" esac elif command -v podman >/dev/null; then KAS_CONTAINER_ENGINE=podman else - echo "$0: no container engine found, need docker or podman" >&2 - exit 1 + fatal_error "no container engine found, need docker or podman" fi fi @@ -189,8 +198,7 @@ podman) KAS_RUNTIME_ARGS="${KAS_RUNTIME_ARGS} --security-opt label=disable" ;; *) - echo "$0: unknown container engine '${KAS_CONTAINER_ENGINE}'" >&2 - exit 1 + fatal_error "unknown container engine '${KAS_CONTAINER_ENGINE}'" ;; esac @@ -204,8 +212,7 @@ while [ $# -gt 0 ]; do --with-loop-dev) if ! KAS_LOOP_DEV=$(/sbin/losetup -f 2>/dev/null); then if [ "$(id -u)" -eq 0 ]; then - echo "Error: loop device not available!" - exit 1 + fatal_error "loop device not available!" fi sudo_command="/sbin/losetup -f" sudo_message="[sudo] enter password to setup loop" @@ -215,10 +222,9 @@ while [ $# -gt 0 ]; do # shellcheck disable=2086 if ! KAS_LOOP_DEV=$(sudo -p "$sudo_message" $sudo_command \ 2>/dev/null); then - echo "Error: loop device setup unsuccessful!" - echo "try calling '$sudo_command' with root" \ - "permissions manually." - exit 1 + fatal_error "loop device setup unsuccessful!" \ + "try calling '$sudo_command' with root" \ + "permissions manually." fi fi KAS_WITH_LOOP_DEV="--device ${KAS_LOOP_DEV}" @@ -236,8 +242,7 @@ while [ $# -gt 0 ]; do ;; --ssh-agent) if [ -z "${SSH_AUTH_SOCK}" ]; then - echo "Error: no SSH agent running" - exit 1 + fatal_error "no SSH agent running" fi KAS_SSH_AUTH_SOCK=$(readlink -fv "$SSH_AUTH_SOCK") shift 1 @@ -277,7 +282,7 @@ while [ $# -gt 0 ]; do shift 2 ;; --version) - echo "$(basename "$0") $KAS_IMAGE_VERSION_DEFAULT" + echo "${KAS_CONTAINER_SELF_NAME} $KAS_IMAGE_VERSION_DEFAULT" exit 0 ;; --*) @@ -332,8 +337,7 @@ while [ $# -gt 0 ] && [ $KAS_EXTRA_BITBAKE_ARGS -eq 0 ]; do shift 2 ;; -E|--preserve-env) - echo "$1 is not supported with kas-container" - exit 1 + fatal_error "$1 is not supported with ${KAS_CONTAINER_SELF_NAME}" ;; --) KAS_EXTRA_BITBAKE_ARGS=$# @@ -348,8 +352,7 @@ while [ $# -gt 0 ] && [ $KAS_EXTRA_BITBAKE_ARGS -eq 0 ]; do # shellcheck disable=2086 for FILE in $(IFS=':'; echo $1); do if ! KAS_REAL_FILE="$(realpath -qe "$FILE")"; then - echo "Error: configuration file '${FILE}' not found" - exit 1 + fatal_error "configuration file '${FILE}' not found" fi if [ -z "${KAS_FILES}" ]; then KAS_FIRST_FILE="${KAS_REAL_FILE}" @@ -431,10 +434,9 @@ KAS_REPO_MOUNT_OPT="${KAS_REPO_MOUNT_OPT:-${KAS_REPO_MOUNT_OPT_DEFAULT}}" KAS_FILES="$(echo "${KAS_FILES}" | sed 's|'"${KAS_REPO_DIR}"'/|/repo/|g')" if [ "$(id -u)" -eq 0 ] && [ "${KAS_ALLOW_ROOT}" != "yes" ] ; then - echo "Error: Running as root - may break certain recipes." - echo "Better give a regular user docker access. Set" \ - "KAS_ALLOW_ROOT=yes to override." - exit 1 + fatal_error "Running as root - may break certain recipes." \ + "Better give a regular user docker access. Set" \ + "KAS_ALLOW_ROOT=yes to override." fi set -- "$@" -v "${KAS_REPO_DIR}":/repo:${KAS_REPO_MOUNT_OPT} \ @@ -446,16 +448,14 @@ set -- "$@" -v "${KAS_REPO_DIR}":/repo:${KAS_REPO_MOUNT_OPT} \ if [ -n "${KAS_SSH_DIR}" ] ; then if [ ! -d "${KAS_SSH_DIR}" ]; then - echo "Passed KAS_SSH_DIR '${KAS_SSH_DIR}' is not a directory" - exit 1 + fatal_error "passed KAS_SSH_DIR '${KAS_SSH_DIR}' is not a directory" fi set -- "$@" -v "$(readlink -fv "${KAS_SSH_DIR}")":/var/kas/userdata/.ssh:ro fi if [ -n "${KAS_SSH_AUTH_SOCK}" ]; then if [ ! -S "${KAS_SSH_AUTH_SOCK}" ]; then - echo "Passed SSH_AUTH_SOCK '${KAS_SSH_AUTH_SOCK}' is not a socket" - exit 1 + fatal_error "passed SSH_AUTH_SOCK '${KAS_SSH_AUTH_SOCK}' is not a socket" fi set -- "$@" -v "${KAS_SSH_AUTH_SOCK}":/ssh-agent/ssh-auth-sock \ -e SSH_AUTH_SOCK=/ssh-agent/ssh-auth-sock @@ -463,20 +463,27 @@ fi if [ -n "${KAS_AWS_DIR}" ] ; then if [ ! -d "${KAS_AWS_DIR}" ]; then - echo "Passed KAS_AWS_DIR '${KAS_AWS_DIR}' is not a directory" - exit 1 + fatal_error "passed KAS_AWS_DIR '${KAS_AWS_DIR}' is not a directory" fi set -- "$@" -v "$(readlink -fv "${KAS_AWS_DIR}")":/var/kas/userdata/.aws:ro \ -e AWS_CONFIG_FILE="${AWS_CONFIG_FILE:-/var/kas/userdata/.aws/config}" \ -e AWS_SHARED_CREDENTIALS_FILE="${AWS_SHARED_CREDENTIALS_FILE:-/var/kas/userdata/.aws/credentials}" fi +if [ -n "${AWS_WEB_IDENTITY_TOKEN_FILE}" ] ; then + if [ ! -f "${AWS_WEB_IDENTITY_TOKEN_FILE}" ]; then + echo "Passed AWS_WEB_IDENTITY_TOKEN_FILE '${AWS_WEB_IDENTITY_TOKEN_FILE}' is not a directory" + exit 1 + fi + set -- "$@" -v "$(readlink -fv "${AWS_WEB_IDENTITY_TOKEN_FILE}")":/var/kas/userdata/.aws/web_identity_token:ro \ + -e AWS_WEB_IDENTITY_TOKEN_FILE="${AWS_CONFIG_FILE:-/var/kas/userdata/.aws/web_identity_token}" \ + -e AWS_ROLE_ARN="${AWS_ROLE_ARN}" +fi KAS_GIT_CREDENTIAL_HELPER_DEFAULT="" if [ -n "${KAS_GIT_CREDENTIAL_STORE}" ] ; then if [ ! -f "${KAS_GIT_CREDENTIAL_STORE}" ]; then - echo "Passed KAS_GIT_CREDENTIAL_STORE '${KAS_GIT_CREDENTIAL_STORE}' is not a file" - exit 1 + fatal_error "passed KAS_GIT_CREDENTIAL_STORE '${KAS_GIT_CREDENTIAL_STORE}' is not a file" fi KAS_GIT_CREDENTIAL_HELPER_DEFAULT="store --file=/var/kas/userdata/.git-credentials" set -- "$@" -v "$(readlink -fv "${KAS_GIT_CREDENTIAL_STORE}")":/var/kas/userdata/.git-credentials:ro @@ -493,6 +500,11 @@ if [ -f "${NETRC_FILE}" ]; then -e NETRC_FILE="/var/kas/userdata/.netrc" fi +if [ -f "${GITCONFIG_FILE}" ]; then + set -- "$@" -v "$(readlink -fv "${GITCONFIG_FILE}")":/var/kas/userdata/.gitconfig:ro \ + -e GITCONFIG_FILE="/var/kas/userdata/.gitconfig" +fi + if [ -t 1 ]; then set -- "$@" -t -i fi @@ -512,17 +524,15 @@ if [ -n "${SSTATE_DIR}" ]; then fi if [ -n "${SSTATE_MIRRORS}" ]; then if echo "${SSTATE_MIRRORS}" | grep -q "file:///"; then - echo "Warning: SSTATE_MIRRORS contains a local path." \ - "Make sure to make this path available inside the container." \ - >&2 + warning "SSTATE_MIRRORS contains a local path." \ + "Make sure to make this path available inside the container." fi set -- "$@" -e "SSTATE_MIRRORS=${SSTATE_MIRRORS}" fi if [ -n "${KAS_REPO_REF_DIR}" ]; then if [ ! -d "${KAS_REPO_REF_DIR}" ]; then - echo "Passed KAS_REPO_REF_DIR '${KAS_REPO_REF_DIR}' is not a directory" - exit 1 + fatal_error "Passed KAS_REPO_REF_DIR '${KAS_REPO_REF_DIR}' is not a directory" fi set -- "$@" \ -v "$(readlink -fv "${KAS_REPO_REF_DIR}")":/repo-ref:rw \ diff --git a/kas/ci/fast.yml b/kas/ci/fast.yml index 23884e29..f262b142 100644 --- a/kas/ci/fast.yml +++ b/kas/ci/fast.yml @@ -12,7 +12,7 @@ build_system: isar header: - version: 10 + version: 16 includes: - kas/debian/bookworm-base.yml diff --git a/kas/ci/full.yml b/kas/ci/full.yml index f359b2f9..4a49bebe 100644 --- a/kas/ci/full.yml +++ b/kas/ci/full.yml @@ -12,7 +12,7 @@ build_system: isar header: - version: 10 + version: 16 includes: - kas/debian/bookworm-base.yml diff --git a/kas/common/base.yml b/kas/common/base.yml index ed0565fe..cbab1099 100644 --- a/kas/common/base.yml +++ b/kas/common/base.yml @@ -10,7 +10,7 @@ # --------------------------------------------------------------------------- header: - version: 10 + version: 16 machine: qemuamd64 target: mtda-image diff --git a/kas/debian/bookworm-base.yml b/kas/debian/bookworm-base.yml index c3568435..5b1a2ed7 100644 --- a/kas/debian/bookworm-base.yml +++ b/kas/debian/bookworm-base.yml @@ -10,7 +10,7 @@ # --------------------------------------------------------------------------- header: - version: 10 + version: 16 includes: - kas/common/base.yml diff --git a/kas/debian/mtda-beaglebone-black.yml b/kas/debian/mtda-beaglebone-black.yml index 8b869d91..18f77a65 100644 --- a/kas/debian/mtda-beaglebone-black.yml +++ b/kas/debian/mtda-beaglebone-black.yml @@ -13,6 +13,6 @@ build_system: isar machine: beaglebone-black header: - version: 10 + version: 16 includes: - kas/debian/bookworm-base.yml diff --git a/kas/debian/mtda-nanopi-all.yml b/kas/debian/mtda-nanopi-all.yml index ccaee589..df469daa 100644 --- a/kas/debian/mtda-nanopi-all.yml +++ b/kas/debian/mtda-nanopi-all.yml @@ -12,7 +12,7 @@ build_system: isar header: - version: 10 + version: 16 includes: - kas/debian/bookworm-base.yml diff --git a/kas/debian/mtda-nanopi-neo.yml b/kas/debian/mtda-nanopi-neo.yml index 1ec254fb..5ba00e3a 100644 --- a/kas/debian/mtda-nanopi-neo.yml +++ b/kas/debian/mtda-nanopi-neo.yml @@ -13,6 +13,6 @@ build_system: isar machine: nanopi-neo header: - version: 10 + version: 16 includes: - kas/debian/bookworm-base.yml diff --git a/kas/debian/mtda-nanopi-r1.yml b/kas/debian/mtda-nanopi-r1.yml index efcdf46f..895d5989 100644 --- a/kas/debian/mtda-nanopi-r1.yml +++ b/kas/debian/mtda-nanopi-r1.yml @@ -13,6 +13,6 @@ build_system: isar machine: nanopi-r1 header: - version: 10 + version: 16 includes: - kas/debian/bookworm-base.yml diff --git a/kas/debian/mtda-qemu-amd64.yml b/kas/debian/mtda-qemu-amd64.yml index 5c9e5496..91b4d2c6 100644 --- a/kas/debian/mtda-qemu-amd64.yml +++ b/kas/debian/mtda-qemu-amd64.yml @@ -13,6 +13,6 @@ build_system: isar machine: qemuamd64 header: - version: 10 + version: 16 includes: - kas/debian/bookworm-base.yml diff --git a/kas/debian/mtda-rpi4b.yml b/kas/debian/mtda-rpi4b.yml index f05ecf76..5864ccdd 100644 --- a/kas/debian/mtda-rpi4b.yml +++ b/kas/debian/mtda-rpi4b.yml @@ -13,6 +13,6 @@ build_system: isar machine: rpi4b header: - version: 10 + version: 16 includes: - kas/debian/bookworm-base.yml diff --git a/kas/opt/lava.yml b/kas/opt/lava.yml index 94a39447..e7aaae63 100644 --- a/kas/opt/lava.yml +++ b/kas/opt/lava.yml @@ -10,7 +10,7 @@ # --------------------------------------------------------------------------- header: - version: 10 + version: 16 local_conf_header: lava_override: | diff --git a/kas/ubuntu/mtda-qemu-amd64.yml b/kas/ubuntu/mtda-qemu-amd64.yml index 30f9312d..067472bc 100644 --- a/kas/ubuntu/mtda-qemu-amd64.yml +++ b/kas/ubuntu/mtda-qemu-amd64.yml @@ -12,7 +12,7 @@ build_system: isar header: - version: 10 + version: 16 includes: - kas/common/base.yml