Files
IronFox/scripts/ci-upload-artifacts.sh
celenity 31cfc61fa2 feat: Set env vars for additional utilities + do not use the system PATH (in favor of our own custom PATH)
This should improve security (by ensuring we always specify the full paths to executables, and preventing use of unintended/undesired system executables), control (by allowing users to specify where these executables should be located), and consistency/reproducability

Signed-off-by: celenity <celenity@celenity.dev>
2026-07-17 02:46:08 +00:00

44 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
if [[ "${CI_COMMIT_REF_NAME}" == "${PRODUCTION_BRANCH}" ]]; then
# Target release
export IRONFOX_RELEASE=1
fi
# Set-up our environment
if [[ -z "${IRONFOX_CI+x}" ]]; then
export IRONFOX_CI=1
fi
if [[ -z "${IRONFOX_SET_ENVS+x}" ]]; then
/bin/bash -x $(dirname $0)/env.sh
fi
source $(dirname $0)/env.sh
# Include utilities
source "${IRONFOX_UTILS}"
# Set-up target parameters
readonly target_artifact=$(echo "${1}" | "${IRONFOX_AWK}" '{print tolower($0)}')
readonly target_arch=$(echo "${2}" | "${IRONFOX_AWK}" '{print tolower($0)}')
# Upload our artifacts
readonly IRONFOX_FROM_AR_UP=1
export IRONFOX_FROM_AR_UP
if [[ "${IRONFOX_LOG_AR_UP}" == 1 ]]; then
readonly AR_UP_LOG_FILE="${IRONFOX_LOG_DIR}/upload-artifacts-${CI_PIPELINE_ID}-${target_artifact}.log"
# If the log file already exists, remove it
if [[ -f "${AR_UP_LOG_FILE}" ]]; then
"${IRONFOX_RM}" "${AR_UP_LOG_FILE}"
fi
# Ensure our log directory exists
"${IRONFOX_MKDIR}" -vp "${IRONFOX_LOG_DIR}"
/bin/bash "${IRONFOX_SCRIPTS}/ci-upload-artifacts-if.sh" "${target_artifact}" "${target_arch}" > >("${IRONFOX_TEE}" -a "${AR_UP_LOG_FILE}") 2>&1
else
/bin/bash "${IRONFOX_SCRIPTS}/ci-upload-artifacts-if.sh" "${target_artifact}" "${target_arch}"
fi