Deployer: почему развертыватель выпускает в предыдущей папке вместо следующей версии, например: папка 1 вместо папки 2 - PullRequest
0 голосов
/ 24 января 2020

Поэтому, когда я пытаюсь запустить средство развертывания, сборка завершается с ошибкой в ​​выпуске. Ошибка говорит, что папка "1" уже существует и не пуста, но не должна ли она быть освобождена в папке 2?

task('deploy', function () {

    // Deployment info
    invoke('deploy:info');

    // Prepare for deployment
    invoke('deploy:prepare');

    $branch = 'master';
    if (input()->hasOption('branch') && !empty(input()->getOption('branch'))) {
        $branch = input()->getOption('branch');
    }

    $isLocal = (get('hostname') == 'localhost');

    $hostBranch = run('cd {{deploy_path}}/current && git rev-parse --abbrev-ref HEAD');
    writeln("Branch on host is <fg=magenta>$hostBranch</fg=magenta>");

    // Only deploy if deploying locally or host is on the same branch as the commit(s) being pushed.
    if ($isLocal || $branch == $hostBranch) {

        if ($branch != $hostBranch) {
            writeln("Switching branches (allowed on local host)");
        }

        // Lockfile for deployer
        invoke('deploy:lock');

        // Setup working directory for release
        invoke('deploy:release');

        // Update code from git repository
        invoke('deploy:update_code');

        // NPM package installation (using `npm ci`)
        invoke('npm:install');

        // Run npm (for compiling assets)
        invoke('npm:run');

        // Set symlinks to shared directories across releases
        invoke('deploy:shared');

        // Composer install
        invoke('deploy:vendors');

        // Change permissions on directories that need to be writable by the web server
        invoke('deploy:writable');

        // Create a symbolic link from "public/storage" to "storage/app/public"
        invoke('artisan:storage:link');

        // Cache template views
        invoke('artisan:view:cache');

        // Cache config, routes and files
        invoke('artisan:optimize');

        // Database migrations
        invoke('artisan:migrate');

        // Restart queues (to prevent using stale code)
        invoke('deploy:queues');

        // Symlink release directory
        invoke('deploy:symlink');

        // Clear deployer lockfile
        invoke('deploy:unlock');

        // Auto cleanup of old releases
        invoke('cleanup');

Вот вывод после выполнения команды на многословном:

➤ Executing task deploy:release                                                                                                                                 
[localhost] > cd /var/www && (if [ -h release ]; then echo 'true'; fi)                                                                                          
[localhost] > cd /var/www && (if [ -d releases ] && [ "$(ls -A releases)" ]; then echo 'true'; fi)                                                              
[localhost] > cd /var/www && (cd releases && ls -t -1 -d */)                                                                                                    
[localhost] > cd /var/www && (if [ -f .dep/releases ]; then echo 'true'; fi)                                                                                    
[localhost] > cd /var/www && (tail -n 15 .dep/releases)                                                                                                         
[localhost] > cd /var/www && (if [ -d /var/www/releases/5 ]; then echo 'true'; fi)                                                                              
[localhost] > cd /var/www && (date +"%Y%m%d%H%M%S")                                                                                                             
[localhost] > cd /var/www && (echo '20200124040912,5' >> .dep/releases)                                                                                         
[localhost] > cd /var/www && (mkdir /var/www/releases/5)
[localhost] > cd /var/www && (if [[ $(man ln 2>&1 || ln -h 2>&1 || ln --help 2>&1) =~ '--relative' ]]; then echo 'true'; fi)
[localhost] > cd /var/www && (ln -nfs /var/www/releases/5 /var/www/release)
• done on [localhost]
✔ Ok [221ms]
➤ Executing task deploy:update_code
[localhost] > command -v 'git' || which 'git' || type -p 'git'
[localhost] > /usr/bin/git version
[localhost] > cd /var/www && (if [ -h /var/www/release ]; then echo 'true'; fi)
[localhost] > cd /var/www && (readlink /var/www/current)
[localhost] > cd /var/www && (/usr/bin/git clone -b feat/reviewer --recursive  --reference /var/www/releases/4 --dissociate git@github.com:reviewer/penguin.git  /var/www/releases/1/ 2>&1)
fatal: destination path '/var/www/releases/1' already exists and is not an empty directory.
[localhost] > cd /var/www && (/usr/bin/git clone -b feat/financier --recursive  git@github.com:solarisfinance/flamingo.git /var/www/releases/1/ 2>&1)
fatal: destination path '/var/www/releases/1' already exists and is not an empty directory.
➤ Executing task deploy:failed
• done on [localhost]
✔ Ok [0ms]
➤ Executing task deploy:unlock
[localhost] > rm -f /var/www/.dep/deploy.lock
• done on [localhost]
✔ Ok [3ms]

он создает новую папку с именем "2", но выпускает в папку "1". В чем может быть проблема, что-то не так с конфигурацией? Или я что-то пропустил ..

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...