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> owner: <the owner of the git repository>
project: <the git project> project: <the git project>
branch: <the branch in your git repository for the deployment> 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 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 - echo Hello World
when: when:
event: [ promote ] event: [ promote ]
environment: [ website ] target: [ website ]
``` ```
- **config.yml** in your Cockpit config folder for an example project *myorganization/myproject* - **config.yml** in your Cockpit config folder for an example project *myorganization/myproject*
@ -64,7 +64,7 @@ drone:
owner: myorganization owner: myorganization
project: myproject project: myproject
branch: master branch: master
environment: website target: website
token: XXXXXXXXXXXXXXXXXXXXX token: XXXXXXXXXXXXXXXXXXXXX
``` ```

View File

@ -15,7 +15,7 @@ if (COCKPIT_ADMIN && !COCKPIT_API_REQUEST) {
if (!$settings || !isset($settings['url'], if (!$settings || !isset($settings['url'],
$settings['owner'], $settings['owner'],
$settings['project'], $settings['project'],
$settings['environment'], $settings['target'],
$settings['token'])) { $settings['token'])) {
return []; return [];
} }
@ -45,7 +45,7 @@ if (COCKPIT_ADMIN && !COCKPIT_API_REQUEST) {
$build = $settings['build']; $build = $settings['build'];
if ($unfiltered_deploys && is_array($unfiltered_deploys)) { if ($unfiltered_deploys && is_array($unfiltered_deploys)) {
foreach($unfiltered_deploys as $deploy) { 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 // find latest successful build
if (!$build) { if (!$build) {
if ($deploy->event == 'push' && $deploy->status == 'success') { if ($deploy->event == 'push' && $deploy->status == 'success') {
@ -90,7 +90,7 @@ if (COCKPIT_ADMIN && !COCKPIT_API_REQUEST) {
if (!$fromBuild || !$settings || !isset($settings['url'], if (!$fromBuild || !$settings || !isset($settings['url'],
$settings['owner'], $settings['owner'],
$settings['project'], $settings['project'],
$settings['environment'], $settings['target'],
$settings['token'])) { $settings['token'])) {
return array( 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 = [ $headers = [
'Content-Type: application/json', 'Content-Type: application/json',