Add Woodpecker Debian package pipeline
Some checks failed
ci/woodpecker/manual/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/manual/woodpecker Pipeline failed
This commit is contained in:
44
scripts/lib/common.sh
Executable file
44
scripts/lib/common.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
readonly REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
readonly BUILD_CONFIG_FILE="${BUILD_CONFIG_FILE:-$REPO_ROOT/build.config}"
|
||||
readonly DEFAULT_GITEA_BASE_URL="https://git.cyber.gent"
|
||||
readonly DEFAULT_DEBIAN_DISTRIBUTION="noble"
|
||||
readonly DEFAULT_DEBIAN_COMPONENT="main"
|
||||
readonly DEFAULT_CI_WORK_ROOT="$REPO_ROOT/.ci-work"
|
||||
|
||||
log() {
|
||||
printf '[%s] %s\n' "$(basename "$0")" "$*"
|
||||
}
|
||||
|
||||
die() {
|
||||
printf '[%s] %s\n' "$(basename "$0")" "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
require_cmd() {
|
||||
command -v "$1" >/dev/null 2>&1 || die "Required command not found: $1"
|
||||
}
|
||||
|
||||
require_env() {
|
||||
local name="$1"
|
||||
[[ -n "${!name:-}" ]] || die "Required environment variable is missing: $name"
|
||||
}
|
||||
|
||||
load_build_config() {
|
||||
[[ -f "$BUILD_CONFIG_FILE" ]] || die "Build config not found: $BUILD_CONFIG_FILE"
|
||||
|
||||
set -a
|
||||
# shellcheck disable=SC1090
|
||||
. "$BUILD_CONFIG_FILE"
|
||||
set +a
|
||||
|
||||
[[ -n "${REPO:-}" ]] || die "REPO is missing in $BUILD_CONFIG_FILE"
|
||||
[[ -n "${BRANCH:-}" ]] || die "BRANCH is missing in $BUILD_CONFIG_FILE"
|
||||
}
|
||||
|
||||
ci_work_root() {
|
||||
printf '%s\n' "${CI_WORK_ROOT:-$DEFAULT_CI_WORK_ROOT}"
|
||||
}
|
||||
Reference in New Issue
Block a user