mirror of
https://github.com/deployphp/deployer.git
synced 2025-01-17 05:28:15 +01:00
Automatic CI user recognition (#3936)
Co-authored-by: Daniel Farkas <daniel.farkas@csretail.cz>
This commit is contained in:
parent
e9d99ca7da
commit
549e865e0a
@ -44,7 +44,7 @@ The value of this configuration is autogenerated on access.
|
||||
|
||||
|
||||
### keep_releases
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L48)
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L54)
|
||||
|
||||
Number of releases to preserve in releases folder.
|
||||
|
||||
@ -54,14 +54,14 @@ Number of releases to preserve in releases folder.
|
||||
|
||||
|
||||
### repository
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L51)
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L57)
|
||||
|
||||
Repository to deploy.
|
||||
|
||||
|
||||
|
||||
### default_timeout
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L56)
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L62)
|
||||
|
||||
Default timeout for `run()` and `runLocally()` functions.
|
||||
|
||||
@ -73,7 +73,7 @@ Set to `null` to disable timeout.
|
||||
|
||||
|
||||
### env
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L72)
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L78)
|
||||
|
||||
Remote environment variables.
|
||||
```php
|
||||
@ -91,7 +91,7 @@ run('echo $KEY', env: ['KEY' => 'over']);
|
||||
|
||||
|
||||
### dotenv
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L81)
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L87)
|
||||
|
||||
Path to `.env` file which will be used as environment variables for each command per `run()`.
|
||||
|
||||
@ -105,7 +105,7 @@ false
|
||||
|
||||
|
||||
### deploy_path
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L91)
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L97)
|
||||
|
||||
The deploy path.
|
||||
|
||||
@ -121,7 +121,7 @@ Throws exception if not set.
|
||||
|
||||
|
||||
### current_path
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L101)
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L107)
|
||||
|
||||
Return current release path. Default to [deploy_path](/docs/recipe/common.md#deploy_path)/`current`.
|
||||
```php
|
||||
@ -134,7 +134,7 @@ set('current_path', '/var/public_html');
|
||||
|
||||
|
||||
### bin/php
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L104)
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L110)
|
||||
|
||||
Path to the `php` bin.
|
||||
|
||||
@ -147,7 +147,7 @@ return which('php');
|
||||
|
||||
|
||||
### bin/git
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L112)
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L118)
|
||||
|
||||
Path to the `git` bin.
|
||||
|
||||
@ -157,7 +157,7 @@ return which('git');
|
||||
|
||||
|
||||
### use_relative_symlink
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L118)
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L124)
|
||||
|
||||
Should [bin/symlink](/docs/recipe/common.md#bin/symlink) use `--relative` option or not. Will detect
|
||||
automatically.
|
||||
@ -168,7 +168,7 @@ return commandSupportsOption('ln', '--relative');
|
||||
|
||||
|
||||
### bin/symlink
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L123)
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L129)
|
||||
|
||||
Path to the `ln` bin. With predefined options `-nfs`.
|
||||
|
||||
@ -178,7 +178,7 @@ return get('use_relative_symlink') ? 'ln -nfs --relative' : 'ln -nfs';
|
||||
|
||||
|
||||
### sudo_askpass
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L130)
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L136)
|
||||
|
||||
Path to a file which will store temp script with sudo password.
|
||||
Defaults to `.dep/sudo_pass`. This script is only temporary and will be deleted after
|
||||
@ -194,7 +194,7 @@ The value of this configuration is autogenerated on access.
|
||||
## Tasks
|
||||
|
||||
### deploy\:prepare {#deploy-prepare}
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L139)
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L145)
|
||||
|
||||
Prepares a new release.
|
||||
|
||||
@ -213,7 +213,7 @@ This task is group task which contains next tasks:
|
||||
|
||||
|
||||
### deploy\:publish {#deploy-publish}
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L151)
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L157)
|
||||
|
||||
Publishes the release.
|
||||
|
||||
@ -228,7 +228,7 @@ This task is group task which contains next tasks:
|
||||
|
||||
|
||||
### deploy {#deploy}
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L159)
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L165)
|
||||
|
||||
Deploys your project.
|
||||
|
||||
@ -241,7 +241,7 @@ This task is group task which contains next tasks:
|
||||
|
||||
|
||||
### deploy\:success {#deploy-success}
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L168)
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L174)
|
||||
|
||||
Deploys your project.
|
||||
|
||||
@ -249,7 +249,7 @@ Prints success message
|
||||
|
||||
|
||||
### deploy\:failed {#deploy-failed}
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L177)
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L183)
|
||||
|
||||
|
||||
|
||||
@ -257,7 +257,7 @@ Hook on deploy failure.
|
||||
|
||||
|
||||
### logs\:app {#logs-app}
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L186)
|
||||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/common.php#L192)
|
||||
|
||||
Shows application logs.
|
||||
|
||||
|
@ -30,6 +30,12 @@ add('recipes', ['common']);
|
||||
// otherwise output of `whoami` command.
|
||||
set('user', function () {
|
||||
if (getenv('CI') !== false) {
|
||||
$ciUserVars = ['GITLAB_USER_NAME', 'GITHUB_ACTOR', 'CIRCLE_USERNAME', 'DRONE_BUILD_TRIGGER'];
|
||||
foreach ($ciUserVars as $var) {
|
||||
if (($ciUser = getenv($var)) !== false) {
|
||||
return $ciUser;
|
||||
}
|
||||
}
|
||||
return 'ci';
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user