armbian_build/lib/functions/cli/cli-artifact.sh
Ricardo Pardini 55b87180b5 rootfs: don't use the Armbian repo when building rootfs from both GHA pipelines and CLI; fixes #7123
- Fixes: 71296430fa9e849098baa5da2cb0734580b12be9 -- which only set `SKIP_ARMBIAN_REPO=yes` when `rootfs` cli shortcut used
  - GHA artifact pipelines are generic across all artifacts, and don't use the cli shortcuts
    - instead, they use the `artifact` shortcut, with the `WHAT=rootfs` parameter
    - so in GHA pipelines `SKIP_ARMBIAN_REPO=yes` was not taking effect
- rootfs artifact itself now enforces `SKIP_ARMBIAN_REPO` to be `yes` and makes it readonly
- also add `SKIP_ARMBIAN_REPO` to the general change-tracking for more clarity about configs and hooks etc
- add change tracking calls before/after generic artifact config adapter for even more clarity
2024-09-30 16:15:36 +02:00

75 lines
2.5 KiB
Bash

#!/usr/bin/env bash
#
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com
#
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
function cli_artifact_pre_run() {
case "${ARMBIAN_COMMAND}" in
download-artifact)
display_alert "download-only mode:" "won't build '${WHAT}'" "info"
declare -g DONT_BUILD_ARTIFACTS="${WHAT}"
declare -g KEEP_HASHED_DEB_ARTIFACTS="yes"
;;
esac
initialize_artifact "${WHAT}"
# Run the pre run adapter
artifact_cli_adapter_pre_run
}
function cli_artifact_run() {
: "${chosen_artifact:?chosen_artifact is not set}"
: "${chosen_artifact_impl:?chosen_artifact_impl is not set}"
if [[ "${CONFIG_DEFS_ONLY}" != "yes" ]]; then
# Make sure ORAS tooling is installed before starting.
run_tool_oras
fi
display_alert "artifact" "${chosen_artifact}" "debug"
display_alert "artifact" "${chosen_artifact} :: ${chosen_artifact_impl}()" "debug"
track_general_config_variables "in cli_artifact_run before artifact_cli_adapter_config_prep"
declare -g artifact_version_requires_aggregation="no" # marker
artifact_cli_adapter_config_prep # only if in cli.
track_general_config_variables "in cli_artifact_run after artifact_cli_adapter_config_prep"
# if asked by _config_prep to aggregate, and HOSTRELEASE is not set, obtain it.
if [[ "${artifact_version_requires_aggregation}" == "yes" ]] && [[ -z "${HOSTRELEASE}" ]]; then
obtain_hostrelease_only # Sets HOSTRELEASE
fi
declare deploy_to_remote="no"
case "${ARMBIAN_COMMAND}" in
download-artifact)
display_alert "Running in download-artifact mode" "download-artifact" "ext"
;;
*)
# Warn of deprecation...
if [[ "${ARTIFACT_USE_CACHE}" == "yes" ]]; then
display_alert "deprecated!" "ARTIFACT_USE_CACHE=yes is deprecated, its behaviour is now the default." "warn"
fi
# If UPLOAD_TO_OCI_ONLY=yes is explicitly set; deploy to remote.
if [[ "${UPLOAD_TO_OCI_ONLY}" == "yes" ]]; then
display_alert "UPLOAD_TO_OCI_ONLY=yes is set" "UPLOAD_TO_OCI_ONLY=yes; ignoring local cache and deploying to remote" "info"
deploy_to_remote="yes"
fi
;;
esac
if [[ "${ARTIFACT_BUILD_INTERACTIVE}" == "yes" ]]; then # Set by `kernel-config`, `kernel-patch`, `uboot-config`, `uboot-patch`, etc.
display_alert "Running artifact build in interactive mode" "log file will be incomplete" "info"
do_with_default_build obtain_complete_artifact
else
do_with_default_build obtain_complete_artifact < /dev/null
fi
}