deployer: Branch settings in hosts.yml are ignored
Hi,
I have the following setup with Deployer v6.5.0: hosts.yml:
typo3.example.com:
hostname: example.com
user: typo3
stage: production
roles: app
branch: master
deploy_path: "~/"
typo3-staging.example.com:
hostname: example.com
user: typo3-staging
stage: staging
roles: app
branch: develop
deploy_path: "~/"
deploy.php:
<?php
namespace Deployer;
require_once 'recipe/common.php';
/**
* Setup
*/
inventory('hosts.yml');
set('allow_anonymous_stats', false);
set('typo3_webroot', 'public');
set('deploy_path_local', '/tmp');
set('release_name', date('Y-m-d_H-i-s'));
/*
* Repository
*/
set('repository', 'git@some.com/location.git');
// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true);
/*
* Shared files / directories
*/
set('shared_files', [
'{{typo3_webroot}}/typo3conf/LocalConfiguration.php',
'{{typo3_webroot}}/.htaccess',
'.env',
]);
set('shared_dirs', [
'{{typo3_webroot}}/fileadmin',
'{{typo3_webroot}}/typo3temp',
'{{typo3_webroot}}/typo3conf/l10n',
'var',
]);
/*
* Cleanup
*/
set('clear_paths', [
'.git/',
'build/',
'.editorconfig',
'.env.example',
'.gitignore',
'.gitattributes',
'composer.json',
'composer.lock',
'deploy.php',
'hosts.yml',
'*.md',
]);
/*
* Helper
*/
set('copy_dirs', [
'.',
]);
set('writable_dirs', [
'{{typo3_webroot}}/fileadmin',
'{{typo3_webroot}}/typo3temp',
'{{typo3_webroot}}/typo3conf',
]);
/**
* Custom Tasks
*/
/*
* Local build
*/
task('deploy:build', function () {
set('deploy_path', get('deploy_path_local'));
invoke('deploy:prepare');
invoke('deploy:release');
invoke('deploy:update_code');
invoke('deploy:vendors');
invoke('deploy:clear_paths');
})->local();
/*
* Upload local => external
*/
task('deploy:upload', function () {
upload(
'{{deploy_path_local}}/release/',
'{{release_path}}',
[
'options' => [
'--delete'
]
]
);
});
/*
* Updates
*/
task('deploy:cli_scripts', function () {
run('{{release_path}}/vendor/bin/typo3cms install:fixfolderstructure');
run('{{release_path}}/vendor/bin/typo3cms install:generatepackagestates');
run('{{release_path}}/vendor/bin/typo3cms database:updateschema');
});
/**
* Deployment
*/
task('deploy', [
'deploy:info',
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:build',
'deploy:copy_dirs',
'deploy:upload',
'deploy:shared',
'deploy:writable',
'deploy:cli_scripts',
'deploy:symlink',
'deploy:unlock',
'cleanup',
])->desc('Deploy your project');
after('deploy', 'success');
after('deploy:failed', 'deploy:unlock');
What happens:
If I deploy the staging stage with vendor/bin/dep deploy staging
it deploys a version on the correct host, but always the master-Branch.
It works only, if a explicitly add the --branch
-option to the deploy
-command.
Result on the command line:
user@host:~$ vendor/bin/dep deploy staging
✈︎ Deploying develop on example.com
➤ Executing task deploy:prepare
✔ Executing task deploy:lock
✔ Executing task deploy:release
➤ Executing task deploy:build
✔ Executing task deploy:prepare
✔ Executing task deploy:release
➤ Executing task deploy:update_code
Klone nach '/tmp/releases/2019-10-28_09-23-36' ...
remote: Enumerating objects: 4188, done.
remote: Counting objects: 100% (4188/4188), done.
remote: Compressing objects: 100% (2072/2072), done.
remote: Total 4188 (delta 1820), reused 4147 (delta 1786)
Empfange Objekte: 100% (4188/4188), 6.26 MiB | 0 bytes/s, Fertig.
Löse Unterschiede auf: 100% (1820/1820), Fertig.
✔rüfe Konnektivität ... Fertig.
✔ Executing task deploy:vendors
✔ Executing task deploy:clear_paths
✔ Ok
✔ Executing task deploy:copy_dirs
➤ Executing task deploy:upload
✔ Executing task deploy:shared
✔ Executing task deploy:writable
✔ Executing task deploy:cli_scripts
✔ Executing task deploy:symlink
✔ Executing task deploy:unlock
✔ Executing task cleanup
Successfully deployed!
What should happen: Deployer should respect the branch-setting in the hosts.yml.
What I know so far: This condition isn’t resolved to true in my case: https://github.com/deployphp/deployer/blob/861f1a34bb72c762422856b5281ac7a9975b20aa/recipe/deploy/update_code.php#L61-L64
How to resolve this issue? Do I missed something?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (8 by maintainers)
Commits related to this issue
- Update params avalaible in hosts.yml Add `branch` param after issue #1946 FIXED — committed to cavasinf/deployer by cavasinf 4 years ago
- Update params avalaible in hosts.yml (#2162) Add `branch` param after issue #1946 FIXED — committed to deployphp/deployer by cavasinf 4 years ago
I already fixed it in master. For bookkeeping I’d like to mark it as closed to not popup in search when I’m working on other issues.
Note, what master isn’t finished yet. A lot of new and awesome stuff going on right now there.
It’s should be fixed in master. Now all settings live in configuration and globally/per host overrateable.