renamed environment to target

This commit is contained in:
Sebastian Frank 2019-03-05 15:52:53 +01:00
parent bfec51aee2
commit c8467208ac
Signed by: apairon
GPG Key ID: 7270D06DDA7FE8C3
2 changed files with 7 additions and 7 deletions

View File

@ -22,7 +22,7 @@ drone:
owner: <the owner of the git repository>
project: <the git project>
branch: <the branch in your git repository for the deployment>
environment: <the environment used in your drone pipeline>
target: <the target condition used in your drone pipeline>
build: <the build number used as base for deployment> # leave empty and the addon will use the latest successfull build based on a push event
```
@ -51,7 +51,7 @@ steps:
- echo Hello World
when:
event: [ promote ]
environment: [ website ]
target: [ website ]
```
- **config.yml** in your Cockpit config folder for an example project *myorganization/myproject*
@ -64,7 +64,7 @@ drone:
owner: myorganization
project: myproject
branch: master
environment: website
target: website
token: XXXXXXXXXXXXXXXXXXXXX
```

View File

@ -15,7 +15,7 @@ if (COCKPIT_ADMIN && !COCKPIT_API_REQUEST) {
if (!$settings || !isset($settings['url'],
$settings['owner'],
$settings['project'],
$settings['environment'],
$settings['target'],
$settings['token'])) {
return [];
}
@ -45,7 +45,7 @@ if (COCKPIT_ADMIN && !COCKPIT_API_REQUEST) {
$build = $settings['build'];
if ($unfiltered_deploys && is_array($unfiltered_deploys)) {
foreach($unfiltered_deploys as $deploy) {
if ($deploy->{target} == $branch && ($deploy->event == 'push' || ($deploy->event == 'promote' && $deploy->deploy_to == $settings['environment']))) {
if ($deploy->{target} == $branch && ($deploy->event == 'push' || ($deploy->event == 'promote' && $deploy->deploy_to == $settings['target']))) {
// find latest successful build
if (!$build) {
if ($deploy->event == 'push' && $deploy->status == 'success') {
@ -90,7 +90,7 @@ if (COCKPIT_ADMIN && !COCKPIT_API_REQUEST) {
if (!$fromBuild || !$settings || !isset($settings['url'],
$settings['owner'],
$settings['project'],
$settings['environment'],
$settings['target'],
$settings['token'])) {
return array(
@ -98,7 +98,7 @@ if (COCKPIT_ADMIN && !COCKPIT_API_REQUEST) {
);
}
$url = trim($settings['url'], "/") . '/api/repos/' . $settings['owner'] . '/' . $settings['project'] . '/builds/' . $fromBuild . '/promote?target=' . $settings['environment'];
$url = trim($settings['url'], "/") . '/api/repos/' . $settings['owner'] . '/' . $settings['project'] . '/builds/' . $fromBuild . '/promote?target=' . $settings['target'];
$headers = [
'Content-Type: application/json',