repo: gitea: workflows: dfi: add tests for custom compose merge file

This commit is contained in:
2026-03-03 10:06:36 -08:00
parent 7111df14d3
commit ef6dac4f47

View File

@@ -85,7 +85,7 @@ function client::install()
function client::finance::gen()
{
local -r _tags=("micro" "tiny" "slim" "default")
local -r _types=("env" "build" "superscript" "env,build,superscript")
local -r _types=("env" "build" "compose" "superscript" "env,build,compose,superscript")
for _tag in "${_tags[@]}"; do
for _type in "${_types[@]}"; do
@@ -112,10 +112,16 @@ function client::finance::edit()
types+=("env")
types+=("shell" "superscript")
types+=("build" "dockerfile")
types+=("compose")
types+=("env,shell,build")
types+=("env,superscript,dockerfile")
types+=("env,superscript,dockerfile,compose")
declare -r types
# The expected default path for default finance image
local _path
_path="${HOME:?}/docker-finance/conf.d/client/$(uname -s)-$(uname -m)/archlinux/default"
declare -r _path
for _tag in "${tags[@]}"; do
for _type in "${types[@]}"; do
local _edit="dfi archlinux/${USER}:${_tag} edit"
@@ -127,12 +133,25 @@ function client::finance::edit()
# Valid
"${ci_shell[@]}" "$_edit type=${_type} & wait ; kill -9 %1"
done
# Build: uncomment all optional packages and plugin dependencies
if [[ "$_tag" == "default" ]]; then
local _file
_file="${HOME:?}/docker-finance/conf.d/client/$(uname -s)-$(uname -m)/archlinux/default/Dockerfiles/${USER:?}@$(uname -n)"
# Build: uncomment all optional packages and plugin dependencies from custom build file
_file="${_path}/Dockerfiles/${USER:?}@$(uname -n)"
[ ! -f "$_file" ] && exit 1
sed -i '18,56s/#//' "$_file"
# Build: uncomment custom compose merge file
_file+=".yml"
[ ! -f "$_file" ] && exit 1
sed -i '8,13s/#//' "$_file"
# env: add variables used in custom compose merge file
_file="${_path}/env/${USER:?}@$(uname -n)"
[ ! -f "$_file" ] && exit 1
echo "DOCKER_FINANCE_CLIENT_TESTING=/tmp/testing" >>$_file
echo "DOCKER_FINANCE_CONTAINER_TESTING=/tmp/testing" >>$_file
fi
done
}
@@ -722,7 +741,7 @@ function container::finance::root()
function client::dev-tools::gen()
{
local -r _tags=("micro" "tiny" "slim" "default")
local -r _types=("env" "build" "superscript" "env,build,superscript")
local -r _types=("env" "build" "compose" "superscript" "env,build,compose,superscript")
# TODO: 'default' should only be supported
for _tag in "${_tags[@]}"; do
@@ -747,7 +766,8 @@ function client::dev-tools::edit()
_types+=("env")
_types+=("shell" "superscript")
_types+=("build" "dockerfile")
_types+=("env,shell,build")
_types+=("compose")
_types+=("env,shell,build,compose")
_types+=("env,superscript,dockerfile")
declare -r _types