279 Commits

Author SHA1 Message Date
Jeffrey Cafferata
fa45c3276f
Boolean options should not go through the self::escape function. (#2402)
* Boolean options should not go through the `self::escape` function.

> Deployer\Support\Stringify::escape(): Argument #1 ($token) must be of type string, bool given

Fixes #2392.

* Update StringifyTest.php

* Update StringifyTest.php

Co-authored-by: Anton Medvedev <anton@medv.io>
2021-03-06 17:01:51 +01:00
Gabriel Ostrolucký
1669ffb11d
Make selector accept array values (#2444) 2021-03-05 20:47:40 +01:00
Anton Medvedev
b3e0e03d99
Add named arguments to run and runLocally (#2353)
* Add named arguments to run and runLocally

* Update docs
2020-12-18 19:40:09 +03:00
Anton Medvedev
7283848cc6 Remove provision 2020-12-18 17:19:19 +01:00
Anton Medvedev
12b99c6d0a Add Pimple as a component 2020-11-20 22:54:08 +01:00
Markus Staab
f0aeb8c83a
fix phpstan level 4 warnings (#2252)
* its invalid to combine `void` with another type

see https://github.com/phpstan/phpstan/issues/4014

* added explicit `return null`, to make phpstan happy and the code more obvious.

* increased phpstan level to 5

* fix: '$subject of function preg_match expects string, int given'
2020-11-02 09:19:08 +01:00
Markus Staab
1de4dbcab0
fix phpstan level 3 warnings (#2236) 2020-10-27 17:09:18 +01:00
Sacharski Bartłomiej
d4c1728646
Added nginx/php/php-fpm version checking to provision e2e test (#2235) 2020-10-26 23:55:08 +01:00
Markus Staab
c3bd2968cd
fix phpstan level 2 warnings (#2232)
* fix phpstan level 2 warnings

* Update CHANGELOG.md

* fix warnings

* fix types

* fix return type
2020-10-27 00:28:38 +03:00
Sacharski Bartłomiej
9d725ede63
Implemented E2E tests for provision recipe (#2228)
Created new container using Ubuntu 20.04 as a base, for a E2E test
environment for the provision recipe.

Due to container sharing a kernel with host os, the firewall provisioning
had to be turn off during the testing procedure.
2020-10-27 00:22:53 +03:00
Anton Medvedev
af68f672c6
Refactor ssh arguments (#2234)
* Refactor ssh arguments
* Use special control path for CI env
2020-10-27 00:22:23 +03:00
Markus Staab
de0813a5f9
fix phpstan level 1 warnings (#2230)
* fix phpstan level 1 warnings

* Update CHANGELOG.md

* composer update
2020-10-26 17:36:53 +01:00
Anton Medvedev
530353ee65 Fix e2e 2020-10-25 09:50:01 +01:00
Anton Medvedev
90ae26b5d8 Clean up configs 2020-10-25 09:46:47 +01:00
Sacharski Bartłomiej
67ed1a800b
[#2197] Created E2E testing environment (#2198)
* [#2197] Created E2E testing environment

Created docker-based end-to-end testing environment, which allows
for testing more complex scenarios.

Additionally added FunctionE2ETest class that contains test scenario
for `run` function with placeholders.

Closes #2197

* [#2197] Moved docker to test dir & separated e2e tests from unit-tests

The docker directory has been moved into test/ directory.
Additionally the e2e tests have been separated from the unit-test
files:
  * AbstractE2ETest class is directly inheriting from TestCase,
    dropping relation to the AbstractTest
  * Separate bootstrap.php file for e2e test was created
  * Separate phpunit-e2e.xml.dist file was created to configure
    PHPUnit for just the e2e tests
  * deployer docker service now runs only e2e tests by default

* [#2197] Added E2E tests to GH actions

Added E2E tests steps to GH actions:
* building the docker-compose stack (building images)
* starting the stack to run the tests

If E2E tests fail, then docker-compose up will end with non-zero
exit code, thus the workflow will be marked as failed.

* [#2197] Fixed no output when using run() with sudo

Fixed a discrepancy in the `run()` function, where there would be
no output when the command was being executed with a sudo.

* [#2197] Added testcases for running commands with sudo

Added two testcases for e2e tests, that verify:
* that sudo command can be ran with password provided interactively
* that sudo command can be ran with password passed via argument

To allow for these tests to happen, the Dockerfile for server
service had to be modified - the deployer user will require a
password, when running command with sudo.

* [#2197] Added Laravel-boilerplate deploy E2E test

Added a very simple E2E test that checks whether the Laravel-boilerplate
deploys successfully to the testing server.

The testing scenario will deploy the app, copy sample .env file,
generate the app key and finally try to get the main page contents
to verify that the expected string is visible in the page source.

* [#2197] Moved E2E tests to separate job

Moved E2E tests to separate job and added docker-compose cache
to slightly improve stack build times.

* [#2197] Using deployphp test-laravel repo for E2E tests

Updated the laravel-boilerplate deploy config to use the repository
that belongs to deployphp organization.

Co-authored-by: Bartlomiej Sacharski <beton@cementowina.org>
2020-10-19 23:38:15 +03:00
Anton Medvedev
9fdade7b90 Update changelog 2020-10-17 11:13:08 +02:00
Anton Medvedev
8e8c0bc2dc Add yaml syntax 2020-10-15 22:12:24 +02:00
Anton Medvedev
e58e3eabd6 Fix test 2020-10-12 22:24:36 +02:00
Anton Medvedev
18bdfc8bd9 Better options passing to worker and connect commands 2020-10-12 22:15:20 +02:00
Anton Medvedev
36596a618e Add dotenv support 2020-10-11 16:23:40 +02:00
Anton Medvedev
5bd53b8fc9 Added env test 2020-10-11 16:04:44 +02:00
Anton Medvedev
2a8844c377 Add select func 2020-10-10 23:13:43 +02:00
Anton Medvedev
040489d587 Update test 2020-10-10 10:50:45 +02:00
Sacharski Bartłomiej
357cfc04c8
[#2192] Support for placeholders in run and runLocally (#2193)
* [#2192] Support for placeholders in run and runLocally

Added support for placeholder in the `run` and `runLocally` functions.
By passing the `vars` key with an associative array to the second
argument of `run` and `runLocally`, it is possible to use placeholders
in the command, that will be used directly in the executed command.

The placeholders should be wrapped in the command with `%NAME%`, for
instance `%foo%`. The `vars` array could be `[ 'foo' => '{{bar}}']`.

Sample:

```php
runLocally("echo '%foo%'", ['vars' => ['foo' => '{{bar}}']]);
```

will output:

```plain
{{bar}}
```

* [#2192] Added missing implementation for placeholders in run()

Added missing implementation for placeholders support int the `run()`
function as it was missing in previous commit.

Co-authored-by: Bartlomiej Sacharski <beton@cementowina.org>
2020-10-10 00:16:55 +03:00
Anton Medvedev
f429c750bc Keep release on rollback and mark it as bad 2020-10-09 23:11:30 +02:00
Anton Medvedev
4493fe913a Fix test 2020-10-09 02:24:44 +02:00
Anton Medvedev
c88ebe275f Allow to change current_path 2020-10-09 01:35:42 +02:00
Anton Medvedev
112601294c Fix shared dir with trailing slash 2020-10-09 01:14:16 +02:00
Anton Medvedev
d688b5e7d0
Fix failing test (#2195)
(╯°□°)╯︵ ┻━┻
2020-10-09 01:42:43 +03:00
Anton Medvedev
54748566a9 Improve tests 2020-10-09 00:15:28 +02:00
Anton Medvedev
7434bb259a Add once() test 2020-10-08 01:04:25 +02:00
Anton Medvedev
744c56fc09 Refactor deploy:writable 2020-10-07 23:55:41 +02:00
Anton Medvedev
f5a7a7765a Add host selector 2020-10-07 22:13:50 +02:00
Sacharski Bartłomiej
bfb28df9a1
[issue-2178] within() passes through $callback return value (#2185)
The `within()` function has been modified to pass-through the
return value of the callback function.

It is now possible to write code like:

```php
$out = within('/foo', function () {
  return 'bar';
});
```

The `$out` variable will now contain the value `'bar'`.

If the callback function returns nothing, then the return of
`within()` call will be `null`.

Fixes #2178
2020-10-03 20:49:42 +02:00
Sacharski Bartłomiej
5808b2daaa
[issue-2181] Fix unit tests on non-master branches (#2182)
The unit tests would fail, when started on a non-master branch.
This was happening because the test repository has been initialized
with git default branch, whereas deploy configuration expects to
work with current git branch.

This has been fixed by adding `git checkout -B BRANCH_NAME`, right after
test repo initialization to the DeployTest setup procedure, to make sure
that the test repositoryis always in sync repo-wise with the Deployer
repository.

Fixes #2181
2020-10-03 10:41:07 +02:00
Anton Medvedev
fb66dc3dba Add test case for connection string 2020-09-30 15:29:48 +02:00
Anton Medvedev
35ced977f9 v7 2020-09-29 22:56:35 +02:00
Anton Medvedev
b633e98fd3 Add server test 2020-09-28 08:13:19 +02:00
Anton Medvedev
deffcbda99 Fix worker test 2020-09-28 00:23:23 +02:00
demokn
a55c14f820
Fix: merge $options env to context env config, with overwriting (#2165) (#2166) 2020-09-23 21:01:29 +03:00
Andreas Möller
96c739bd5b
Enhancement: Add deploy:is-unlocked (#2152) 2020-09-03 16:17:52 +03:00
Anton Medvedev
8293eb931e wip 2020-07-26 22:35:08 +03:00
Anton Medvedev
1b816a45f5 wip 2020-07-26 12:03:52 +03:00
Anton Medvedev
f512cfd420 wip 2020-07-22 19:17:25 +03:00
Anton Medvedev
29a643b623 v7 2020-05-16 18:02:17 +03:00
Anton Medvedev
d9c744808e Add checks for fromShellCommandline method 2019-12-15 21:51:28 +07:00
Anton Medvedev
86c7b3848f Fix incompatibility with Symfony 5 2019-12-15 21:11:39 +07:00
Anton Medvedev
4190e28fcb
Revert "Handle asterisk wildcard in shared files (#1895)" (#1897)
This reverts commit 6dd0a2c1f7eda33f9b5dbde287ffeda889e025de.
2019-08-08 11:26:20 +03:00
Vytautas Koryzna
6dd0a2c1f7 Handle asterisk wildcard in shared files (#1895) 2019-08-07 11:02:08 +03:00
extacy
756f121205 Fix crashes on including autoloader in recipe file (#1833)
* Fix crashes on including autoloader in recipe file

* Update CHANGELOG.md
2019-07-17 11:34:47 +03:00