Skip to content
Snippets Groups Projects
Commit 42913580 authored by jurgenhaas's avatar jurgenhaas
Browse files
- Copy docker-compose.yml into l3drun if it exists
- Only write to files that are writable
- Update to v2.2.17 of upstream image
parent c517f382
No related branches found
Tags test2
1 merge request!39Merging develop into main
...@@ -5,7 +5,7 @@ include: ...@@ -5,7 +5,7 @@ include:
variables: variables:
VERSION: ${CI_COMMIT_TAG} VERSION: ${CI_COMMIT_TAG}
CI_VERSION: v2.2.16 CI_VERSION: v2.2.17
before_script: before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
......
#!/bin/bash #!/bin/bash
function getConfig() { function getConfig() {
if [[ -f "docker-compose.yml" ]]; then if [[ "$L3D_COMPOSE" != "[]" ]]; then
COMPOSE_PROJECT_NAME=$(yq .name docker-compose.yml) COMPOSE_PROJECT_NAME=$(yq .name $L3D_COMPOSE)
PHP_VERSION=$(yq .services.php.image docker-compose.yml | cut -d':' -f 2) PHP_VERSION=$(yq .services.php.image $L3D_COMPOSE | cut -d':' -f 2)
rm "$L3D_COMPOSE"
fi fi
if [[ ! -n ${PHP_VERSION} ]]; then if [[ ! -n ${PHP_VERSION} ]]; then
while true; do while true; do
......
...@@ -99,6 +99,11 @@ if [[ -f ".lakedrops.yml" ]]; then ...@@ -99,6 +99,11 @@ if [[ -f ".lakedrops.yml" ]]; then
L3D_CONFIG=/tmp/${RANDOM}.lakedrops.yml L3D_CONFIG=/tmp/${RANDOM}.lakedrops.yml
docker cp .lakedrops.yml l3drun:$L3D_CONFIG >/dev/null 2>&1 docker cp .lakedrops.yml l3drun:$L3D_CONFIG >/dev/null 2>&1
fi fi
L3D_COMPOSE=[]
if [[ -f "docker-compose.yml" ]]; then
L3D_COMPOSE=/tmp/${RANDOM}-docker-compose.yml
docker cp docker-compose.yml l3drun:$L3D_COMPOSE >/dev/null 2>&1
fi
# Create project container parameters # Create project container parameters
project_params=( project_params=(
...@@ -110,6 +115,7 @@ project_params=( ...@@ -110,6 +115,7 @@ project_params=(
--env L3DSHELL=${L3DSHELL} --env L3DSHELL=${L3DSHELL}
--env L3D_ALWAYS_CLEANUP=${L3D_ALWAYS_CLEANUP} --env L3D_ALWAYS_CLEANUP=${L3D_ALWAYS_CLEANUP}
--env L3D_CONFIG=${L3D_CONFIG} --env L3D_CONFIG=${L3D_CONFIG}
--env L3D_COMPOSE=${L3D_COMPOSE}
--env WORKDIR=${PWD} --env WORKDIR=${PWD}
--env PHP_VERSION=${PHP_VERSION} --env PHP_VERSION=${PHP_VERSION}
--env COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME} --env COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME}
......
...@@ -32,23 +32,22 @@ function restoreEnvFile { ...@@ -32,23 +32,22 @@ function restoreEnvFile {
if [[ "${COMPOSE_PROJECT_NAME}" == "." ]]; then if [[ "${COMPOSE_PROJECT_NAME}" == "." ]]; then
return return
fi fi
if [[ ! -w ".env" ]]; then if [[ -f ".env" && -w ".env" ]] || [[ ! -f ".env" && -w . ]]; then
return if [[ -n ${PHP_VERSION} ]]; then
fi echo "PHP_VERSION=${PHP_VERSION}" >>.env
if [[ -n ${PHP_VERSION} ]]; then fi
echo "PHP_VERSION=${PHP_VERSION}" >>.env if [[ -n ${COMPOSE_PROJECT_NAME} ]]; then
fi echo "COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME}" >>.env
if [[ -n ${COMPOSE_PROJECT_NAME} ]]; then fi
echo "COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME}" >>.env if [[ -n ${COMPOSER_DOWNGRADE} ]]; then
fi echo "COMPOSER_DOWNGRADE=${COMPOSER_DOWNGRADE}" >>.env
if [[ -n ${COMPOSER_DOWNGRADE} ]]; then fi
echo "COMPOSER_DOWNGRADE=${COMPOSER_DOWNGRADE}" >>.env if [[ -f ".env" ]]; then
fi # shellcheck disable=SC2046
if [[ -f ".env" ]]; then # shellcheck disable=SC2094
# shellcheck disable=SC2046 # shellcheck disable=SC2002
# shellcheck disable=SC2094 env -i $(cat .env | xargs) >.env
# shellcheck disable=SC2002 fi
env -i $(cat .env | xargs) >.env
fi fi
} }
...@@ -210,7 +209,7 @@ function initialSetup { ...@@ -210,7 +209,7 @@ function initialSetup {
} }
function setupAhoy { function setupAhoy {
if [[ ! -f .ahoy.yml ]]; then if [[ ! -f .ahoy.yml && -w . ]]; then
echo "ahoyapi: v2" >.ahoy.yml echo "ahoyapi: v2" >.ahoy.yml
echo "commands:" >>.ahoy.yml echo "commands:" >>.ahoy.yml
fi fi
...@@ -220,20 +219,24 @@ function setupAhoy { ...@@ -220,20 +219,24 @@ function setupAhoy {
if [[ -f .gitignore ]]; then if [[ -f .gitignore ]]; then
EXISTING=$(cat .gitignore | grep "^/.ahoy.l3d$") EXISTING=$(cat .gitignore | grep "^/.ahoy.l3d$")
if [[ -z ${EXISTING} ]]; then if [[ -z ${EXISTING} ]]; then
echo "/.ahoy.l3d" >>.gitignore if [[ -f ".gitignore" && -w ".gitignore" ]] || [[ ! -f ".gitignore" && -w . ]]; then
echo "/.ahoy.l3d" >>.gitignore
fi
fi fi
fi fi
EXISTING=$(cat .ahoy.yml | grep "^ changelog:") if [[ -f ".ahoy.yml" && -w ".ahoy.yml" ]] || [[ ! -f ".ahoy.yml" && -w . ]]; then
if [[ -z ${EXISTING} ]]; then EXISTING=$(cat .ahoy.yml | grep "^ changelog:")
echo " changelog:" >>.ahoy.yml if [[ -z ${EXISTING} ]]; then
echo " imports:" >>.ahoy.yml echo " changelog:" >>.ahoy.yml
echo " - ./.ahoy.l3d/changelog.yml" >>.ahoy.yml echo " imports:" >>.ahoy.yml
echo " usage: Changelog tools." >>.ahoy.yml echo " - ./.ahoy.l3d/changelog.yml" >>.ahoy.yml
echo " usage: Changelog tools." >>.ahoy.yml
fi
fi fi
} }
if [[ -n ${PHP_VERSION} ]]; then if [[ -n ${PHP_VERSION} ]]; then
if [[ -w ".env" ]]; then if [[ -f ".env" && -w ".env" ]] || [[ ! -f ".env" && -w . ]]; then
echo "PHP_VERSION=${PHP_VERSION}" >>.env echo "PHP_VERSION=${PHP_VERSION}" >>.env
fi fi
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment