dk: support ~/.dkbuild.env
This commit is contained in:
parent
b818e11c73
commit
0bf0f48ad0
79
dk
79
dk
|
@ -2062,7 +2062,16 @@ function auto_composer() {
|
||||||
local COMPOSER_MACHINE=-u
|
local COMPOSER_MACHINE=-u
|
||||||
local COMPOSER_CMD=
|
local COMPOSER_CMD=
|
||||||
local COMPOSER_SETUP=
|
local COMPOSER_SETUP=
|
||||||
[ -f .composer.conf ] && source ./.composer.conf
|
if [ -f .composer.yaml ]; then
|
||||||
|
local registry
|
||||||
|
eval "$(<.composer.yaml grep ^composer_ |
|
||||||
|
sed 's/^composer_php_min: /COMPOSER_PHP=/;
|
||||||
|
s/^composer_php_max: /COMPOSER_PHP_MAX=/;
|
||||||
|
s/^composer_registry: /registry=/;
|
||||||
|
s/^composer_image: \(.*\)/COMPOSER_IMAGE="${registry:-$REGISTRY}\/\1"/')"
|
||||||
|
elif [ -f .composer.conf ]; then
|
||||||
|
source ./.composer.conf
|
||||||
|
fi
|
||||||
# les premiers arguments peuvent servir à redéfinir les variables
|
# les premiers arguments peuvent servir à redéfinir les variables
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
@ -2413,21 +2422,6 @@ fi
|
||||||
|
|
||||||
[ -n "$COMPOSE_V1" ] && DOCKER_COMPOSE=(docker-compose) || DOCKER_COMPOSE=(docker compose)
|
[ -n "$COMPOSE_V1" ] && DOCKER_COMPOSE=(docker-compose) || DOCKER_COMPOSE=(docker compose)
|
||||||
|
|
||||||
DEFAULT_PROFILE=devel
|
|
||||||
case "$PROFILE" in
|
|
||||||
jclain)
|
|
||||||
REGISTRY=docker.jclain.fr
|
|
||||||
PRIVAREG=docker.jclain.fr
|
|
||||||
;;
|
|
||||||
devel)
|
|
||||||
REGISTRY=docker.devel.self
|
|
||||||
PRIVAREG=docker.devel.self
|
|
||||||
;;
|
|
||||||
prod|test|*)
|
|
||||||
REGISTRY=pubdocker.univ-reunion.fr
|
|
||||||
PRIVAREG=pridocker.univ-reunion.fr
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
PROFILE=
|
PROFILE=
|
||||||
DM_ALIASES=()
|
DM_ALIASES=()
|
||||||
DM_PROFILES=()
|
DM_PROFILES=()
|
||||||
|
@ -2435,20 +2429,55 @@ CLUSTERDIRS=()
|
||||||
DEFAULT_DEVEL_SRCDIR="$HOME/wop"
|
DEFAULT_DEVEL_SRCDIR="$HOME/wop"
|
||||||
COMPOSER_DEVEL_SRCDIR="$HOME/wop/php"
|
COMPOSER_DEVEL_SRCDIR="$HOME/wop/php"
|
||||||
MAVEN_DEVEL_SRCDIR="$HOME/wop/sn"
|
MAVEN_DEVEL_SRCDIR="$HOME/wop/sn"
|
||||||
DEFAULT_COMPOSER_IMAGE="$REGISTRY/image/phpbuilder:d11"
|
DEFAULT_COMPOSER_IMAGE=
|
||||||
DEFAULT_MAVEN_IMAGE="$REGISTRY/image/javabuilder:d11"
|
DEFAULT_MAVEN_IMAGE=
|
||||||
DEFAULT_HOST_MAPPINGS=()
|
DEFAULT_HOST_MAPPINGS=()
|
||||||
prod_HOST_MAPPINGS=(
|
|
||||||
pridocker.univ-reunion.fr:10.85.1.56
|
|
||||||
pubdocker.univ-reunion.fr:10.85.1.57
|
|
||||||
repos.univ-reunion.fr:10.85.1.57
|
|
||||||
git.univ-reunion.fr:10.85.1.55
|
|
||||||
)
|
|
||||||
test_HOST_MAPPINGS=("${prod_HOST_MAPPINGS[@]}")
|
|
||||||
set_defaults dk
|
set_defaults dk
|
||||||
export PROFILE
|
export PROFILE
|
||||||
|
|
||||||
|
DEFAULT_PROFILE=devel
|
||||||
|
REGISTRY=
|
||||||
HOST_MAPPINGS=()
|
HOST_MAPPINGS=()
|
||||||
|
if [ -f ~/.dkbuild.env ]; then
|
||||||
|
function default_profile() {
|
||||||
|
DEFAULT_PROFILE="$1"
|
||||||
|
}
|
||||||
|
function profile() {
|
||||||
|
local profile
|
||||||
|
for profile in "$@"; do
|
||||||
|
[ "$profile" == "$DEFAULT_PROFILE" ] && return 0
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
function setenv() {
|
||||||
|
eval "export $1"
|
||||||
|
}
|
||||||
|
function default() {
|
||||||
|
local command="$1"; shift
|
||||||
|
local nv n v
|
||||||
|
case "$command" in
|
||||||
|
docker)
|
||||||
|
for nv in "$@"; do
|
||||||
|
[[ "$nv" == *=* ]] || continue
|
||||||
|
n="${nv%%=*}"
|
||||||
|
v="${nv#*=}"
|
||||||
|
case "$n" in
|
||||||
|
host-mappings)
|
||||||
|
read -a nv <<<"$v"
|
||||||
|
for v in "${ns[@]}"; do
|
||||||
|
HOST_MAPPINGS+=("$v")
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
source ~/.dkbuild.env
|
||||||
|
fi
|
||||||
|
[ -n "$REGISTRY" ] || REGISTRY=pubdocker.univ-reunion.fr
|
||||||
|
[ -n "$DEFAULT_COMPOSER_IMAGE" ] || DEFAULT_COMPOSER_IMAGE="$REGISTRY/image/php:d11"
|
||||||
|
[ -n "$DEFAULT_MAVEN_IMAGE" ] || DEFAULT_MAVEN_IMAGE="$REGISTRY/image/javabuilder:d11"
|
||||||
|
|
||||||
chdir=
|
chdir=
|
||||||
CONFIG=
|
CONFIG=
|
||||||
|
|
|
@ -20,27 +20,5 @@
|
||||||
#MAVEN_DEVEL_SRCDIR="$HOME/wop/sn"
|
#MAVEN_DEVEL_SRCDIR="$HOME/wop/sn"
|
||||||
|
|
||||||
# Image à utiliser pour les builds
|
# Image à utiliser pour les builds
|
||||||
#DEFAULT_COMPOSER_IMAGE=pubdocker.univ-reunion.fr/image/phpbuilder:d11
|
#DEFAULT_COMPOSER_IMAGE=pubdocker.univ-reunion.fr/image/php:d11
|
||||||
#DEFAULT_MAVEN_IMAGE=pubdocker.univ-reunion.fr/image/javabuilder:d11
|
#DEFAULT_MAVEN_IMAGE=pubdocker.univ-reunion.fr/image/javabuilder:d11
|
||||||
|
|
||||||
# Mappings d'hôtes à activer pour les builds à base d'image
|
|
||||||
#DEFAULT_HOST_MAPPINGS=()
|
|
||||||
#prod_HOST_MAPPINGS=(pridocker.univ-reunion.fr:10.85.1.56 pubdocker.univ-reunion.fr:10.85.1.57 repos.univ-reunion.fr:10.85.1.57 git.univ-reunion.fr:10.85.1.55)
|
|
||||||
#test_HOST_MAPPINGS=("${prod_HOST_MAPPINGS}")
|
|
||||||
|
|
||||||
#case "$PROFILE" in
|
|
||||||
#jclain)
|
|
||||||
# REGISTRY=docker.jclain.fr
|
|
||||||
# PRIVAREG=docker.jclain.fr
|
|
||||||
# ;;
|
|
||||||
#devel)
|
|
||||||
# REGISTRY=docker.devel.self
|
|
||||||
# PRIVAREG=docker.devel.self
|
|
||||||
# ;;
|
|
||||||
#prod|test|*)
|
|
||||||
# REGISTRY=pubdocker.univ-reunion.fr
|
|
||||||
# PRIVAREG=pridocker.univ-reunion.fr
|
|
||||||
# ;;
|
|
||||||
#esac
|
|
||||||
#: ${DEFAULT_COMPOSER_IMAGE:=$REGISTRY/image/phpbuilder:d11}
|
|
||||||
#: ${DEFAULT_MAVEN_IMAGE:=$REGISTRY/image/javabuilder:d11}
|
|
||||||
|
|
|
@ -68,6 +68,9 @@ if [ "$UINST_LOCAL_PROFILES" != auto ]; then
|
||||||
export UTOOLS_LOCAL_PROFILES=$(qvalr "$UINST_LOCAL_PROFILES")" ~/.nutoolsrc
|
export UTOOLS_LOCAL_PROFILES=$(qvalr "$UINST_LOCAL_PROFILES")" ~/.nutoolsrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# copier .dkbuild.env
|
||||||
|
[ -f ~/.dkbuild.env ] || cp lib/dkbuild/dot-dkbuild.env ~/.dkbuild.env
|
||||||
|
|
||||||
# identification du système
|
# identification du système
|
||||||
echo "##@before *" >lib/profile.d/0nutools
|
echo "##@before *" >lib/profile.d/0nutools
|
||||||
echo_setv UNAME_SYSTEM "$UNAME_SYSTEM" >>lib/profile.d/0nutools
|
echo_setv UNAME_SYSTEM "$UNAME_SYSTEM" >>lib/profile.d/0nutools
|
||||||
|
|
Loading…
Reference in New Issue