Why is my init command beeing run when opening a snapshot

Hi,

when sharing a snapshot the init command in the start task “prepare webserver” is beeing run when opening it. According to the doc I think this shouldn’t be? The init command in the start task “setup” isn’t run as expected. Any ideas here?

.gitpod.yml

image:
  file: .gitpod.Dockerfile

tasks:
  - name: setup
    init: bash ./gitpod/init.sh 
    command: cd ./environment/ && docker-compose up

  - name: prepare webserver
    init: echo 'Waiting for webserver container to start...' &&
     until docker ps | grep -q "webserver"; do sleep 1; done &&
     docker exec -it $(docker ps | grep "webserver" | awk '{ print $1 }') 
     bash -c "/var/www/laravel/scripts/init_gitpod.sh"

    # to have its own terminal, npm is run from here, to guarantee its depencies are installed up to this moment, they're also installed from here
  - name: npm install/run
    openMode: split-right
    command: echo 'Waiting for webserver container to start...' &&
     until docker ps | grep -q "webserver"; do sleep 1; done &&
     docker exec -it $(docker ps | grep "webserver" | awk '{ print $1 }') 
     bash -c "cd /var/www/laravel && npm install && npm run watch"

init_gitpod.sh

#!/bin/bash

cd /var/www/
rm -R html
ln -s /var/www/laravel/public /var/www/html

# beautyful chat
cd /var/www/laravel
composer install
git submodule sync --recursive
git submodule update --init --recursive

cd ./resources/vue-beautiful-chat
#cd /var/www/laravel/resources/vue-beautiful-chat
npm install

cd /var/www/laravel/
composer install

# give file access
chmod 777 -R storage/


php artisan migrate
php artisan cache:clear
php artisan queue:restart
php artisan db:seed

#copy gitpod debugger config
cp -a ./gitpod/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/

exit

Thank you for your Help!

Hi @Pawluq ,

indeed this looks like a bug! Would you mind creating an issue for this on Issues · gitpod-io/gitpod · GitHub? Thx!

Sure!

*Init command beeing run when opening snapshot · Issue #4894 · gitpod-io/gitpod · GitHub

1 Like