fix prepare script

This commit is contained in:
Kay0u 2023-05-16 18:11:52 +02:00
parent 9c23d090fb
commit e96a3cb528
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D
4 changed files with 9 additions and 3 deletions

View file

@ -30,7 +30,8 @@ start_container () {
chmod 777 $current_dir/cache chmod 777 $current_dir/cache
lxc config device add "$CONTAINER_IMAGE" cache-folder disk path=/cache source="$current_dir/cache" lxc config device add "$CONTAINER_IMAGE" cache-folder disk path=/cache source="$current_dir/cache"
lxc restart $CONTAINER_IMAGE lxc stop $CONTAINER_IMAGE || true
lxc start $CONTAINER_IMAGE
wait_container $CONTAINER_IMAGE wait_container $CONTAINER_IMAGE
} }

2
run.sh
View file

@ -36,7 +36,7 @@ case ${2} in
esac esac
lxc exec "$CONTAINER_ID" /bin/bash < "${1}" lxc exec "$CONTAINER_IMAGE" /bin/bash < "${1}"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
# Exit using the variable, to make the build as failure in GitLab # Exit using the variable, to make the build as failure in GitLab
# CI. # CI.

View file

@ -46,6 +46,11 @@ wait_container()
if [ "$j" == "10" ]; then if [ "$j" == "10" ]; then
error 'Failed to access the internet' error 'Failed to access the internet'
failstart=1 failstart=1
lxc exec "$1" -- /bin/bash -c "echo 'resolv-file=/etc/resolv.dnsmasq.conf' > /etc/dnsmasq.d/resolvconf"
lxc exec "$1" -- /bin/bash -c "echo 'nameserver 8.8.8.8' > /etc/resolv.dnsmasq.conf"
lxc exec "$1" -- /bin/bash -c "sed -i 's/#IGNORE/IGNORE/g' /etc/default/dnsmasq"
lxc exec "$1" -- /bin/bash -c "systemctl restart dnsmasq"
lxc exec "$1" -- /bin/bash -c "journalctl -u dnsmasq -n 100 --no-pager"
restart_container "$1" restart_container "$1"
fi fi

View file

@ -30,4 +30,4 @@ PROJECT_NAME="$CUSTOM_ENV_CI_PROJECT_NAME"
# For example yunohost-buster-unstable # For example yunohost-buster-unstable
BASE_IMAGE="yunohost-$DEBIAN_VERSION-$CURRENT_VERSION" BASE_IMAGE="yunohost-$DEBIAN_VERSION-$CURRENT_VERSION"
CONTAINER_IMAGE="$BASE_IMAGE-runner-$CUSTOM_ENV_CI_RUNNER_ID-project-$CUSTOM_ENV_CI_PROJECT_ID-concurrent-$CUSTOM_ENV_CI_CONCURRENT_PROJECT_ID" CONTAINER_IMAGE="$BASE_IMAGE-r-$CUSTOM_ENV_CI_RUNNER_ID-p-$CUSTOM_ENV_CI_PROJECT_ID-c-$CUSTOM_ENV_CI_CONCURRENT_PROJECT_ID"