From c8467208acfdbbf8716679332fdca4371deeaa03 Mon Sep 17 00:00:00 2001 From: Sebastian Frank Date: Tue, 5 Mar 2019 15:52:53 +0100 Subject: [PATCH] renamed environment to target --- README.md | 6 +++--- bootstrap.php | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 4175ece..9d7f77a 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ drone: owner: project: branch: - environment: + target: build: # 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 ``` diff --git a/bootstrap.php b/bootstrap.php index d27595d..6acc3be 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -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',