--
GitLab
From aa7d8cf756b9acbb0385b689e8f5b908d4e234da Mon Sep 17 00:00:00 2001
From: Ronak Patel
Date: Thu, 9 Mar 2023 09:30:30 +0530
Subject: [PATCH 04/16] pending-cancel array added with constant
---
lib/Controller/ShopAccountController.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/Controller/ShopAccountController.php b/lib/Controller/ShopAccountController.php
index 88d91955..1a7da517 100644
--- a/lib/Controller/ShopAccountController.php
+++ b/lib/Controller/ShopAccountController.php
@@ -23,6 +23,7 @@ class ShopAccountController extends Controller {
'active',
'on-hold'
];
+ private const PENDING_CANCEL_STATUS = 'pending-cancel';
public function __construct($appName, IRequest $request, IUserSession $userSession, ShopAccountService $shopAccountService, ILogger $logger) {
parent::__construct($appName, $request);
@@ -114,7 +115,7 @@ class ShopAccountController extends Controller {
if (in_array($subscription['status'], self::SUBSCRIPTION_STATUS_LIST)) {
$total_subscriptions++;
}
- if ($subscription['status'] === 'pending-cancel') {
+ if ($subscription['status'] === self::PENDING_CANCEL_STATUS) {
array_push($data['pending_cancel_subscriptions'], $subscription['id']);
}
}
--
GitLab
From 2717cc483dd3d373958ed30681fda6a139b8e144 Mon Sep 17 00:00:00 2001
From: Ronak Patel
Date: Fri, 10 Mar 2023 00:32:29 +0530
Subject: [PATCH 05/16] cancelled added
---
lib/Controller/ShopAccountController.php | 6 +-----
lib/Listeners/BeforeUserDeletedListener.php | 6 ++++++
lib/Service/ShopAccountService.php | 9 +++++++++
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/lib/Controller/ShopAccountController.php b/lib/Controller/ShopAccountController.php
index 1a7da517..b53aa6f5 100644
--- a/lib/Controller/ShopAccountController.php
+++ b/lib/Controller/ShopAccountController.php
@@ -23,7 +23,6 @@ class ShopAccountController extends Controller {
'active',
'on-hold'
];
- private const PENDING_CANCEL_STATUS = 'pending-cancel';
public function __construct($appName, IRequest $request, IUserSession $userSession, ShopAccountService $shopAccountService, ILogger $logger) {
parent::__construct($appName, $request);
@@ -108,16 +107,13 @@ class ShopAccountController extends Controller {
if (!$userId) {
throw new Exception("Invalid user id");
}
- $data = ['subscription_count' => 0 , 'pending_cancel_subscriptions' => []];
+ $data = ['subscription_count' => 0];
$subscriptions = $this->shopAccountService->getSubscriptions($userId, 'any');
$total_subscriptions = 0;
foreach ($subscriptions as $subscription) {
if (in_array($subscription['status'], self::SUBSCRIPTION_STATUS_LIST)) {
$total_subscriptions++;
}
- if ($subscription['status'] === self::PENDING_CANCEL_STATUS) {
- array_push($data['pending_cancel_subscriptions'], $subscription['id']);
- }
}
$data['subscription_count'] = $total_subscriptions;
$response = new DataResponse();
diff --git a/lib/Listeners/BeforeUserDeletedListener.php b/lib/Listeners/BeforeUserDeletedListener.php
index 9b87f22a..fa9da65c 100644
--- a/lib/Listeners/BeforeUserDeletedListener.php
+++ b/lib/Listeners/BeforeUserDeletedListener.php
@@ -20,6 +20,8 @@ class BeforeUserDeletedListener implements IEventListener {
private $LDAPConnectionService;
private $shopAccountService;
private $userService;
+ private const PENDING_CANCEL_STATUS = 'pending-cancel';
+ private const CANCELLED_STATUS = 'cancelled';
public function __construct(ILogger $logger, IConfig $config, LDAPConnectionService $LDAPConnectionService, UserService $userService, ShopAccountService $shopAccountService) {
$this->logger = $logger;
@@ -64,6 +66,10 @@ class BeforeUserDeletedListener implements IEventListener {
if ($shopUser && $this->shopAccountService->isUserOIDC($shopUser)) {
if ($deleteShopAccount) {
+ $subscriptions = $this->shopAccountService->getSubscriptions($shopUser['id'], self::PENDING_CANCEL_STATUS);
+ foreach ($subscriptions as $subscription) {
+ $this->shopAccountService->updateSubscriptionStatus($subscription['id'], self::CANCELLED_STATUS);
+ }
$this->shopAccountService->deleteUser($shopUser['id']);
} else {
$newEmail = $this->shopAccountService->getShopEmailPostDeletePreference($uid);
diff --git a/lib/Service/ShopAccountService.php b/lib/Service/ShopAccountService.php
index 113109b8..502c3ce3 100644
--- a/lib/Service/ShopAccountService.php
+++ b/lib/Service/ShopAccountService.php
@@ -167,4 +167,13 @@ class ShopAccountService {
public function getSubscriptions(int $userId, string $status): ?array {
return $this->callShopAPI($this->subscriptionUrl, 'GET', ['customer' => $userId , 'status' => $status]);
}
+
+ public function updateSubscriptionStatus(int $subscriptionId, string $status) {
+ try {
+ return $this->callShopAPI($this->subscriptionUrl . '/' . $subscriptionId, 'POST', ['status' => $status]);
+ } catch (Exception $e) {
+ $this->logger->error('Error updating subscription status to '.$status);
+ $this->logger->logException($e, ['app' => Application::APP_ID]);
+ }
+ }
}
--
GitLab
From f5eb46b1482b84b5e176428335dd5583ce4b9e26 Mon Sep 17 00:00:00 2001
From: Ronak Patel
Date: Fri, 10 Mar 2023 01:01:44 +0530
Subject: [PATCH 06/16] changed ud
---
lib/Listeners/BeforeUserDeletedListener.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Listeners/BeforeUserDeletedListener.php b/lib/Listeners/BeforeUserDeletedListener.php
index fa9da65c..0a8197cb 100644
--- a/lib/Listeners/BeforeUserDeletedListener.php
+++ b/lib/Listeners/BeforeUserDeletedListener.php
@@ -66,7 +66,7 @@ class BeforeUserDeletedListener implements IEventListener {
if ($shopUser && $this->shopAccountService->isUserOIDC($shopUser)) {
if ($deleteShopAccount) {
- $subscriptions = $this->shopAccountService->getSubscriptions($shopUser['id'], self::PENDING_CANCEL_STATUS);
+ $subscriptions = $this->shopAccountService->getSubscriptions($uid, self::PENDING_CANCEL_STATUS);
foreach ($subscriptions as $subscription) {
$this->shopAccountService->updateSubscriptionStatus($subscription['id'], self::CANCELLED_STATUS);
}
--
GitLab
From d7a1abca654732b2f90cad43cd20d69ae875108e Mon Sep 17 00:00:00 2001
From: Ronak Patel
Date: Fri, 10 Mar 2023 01:09:22 +0530
Subject: [PATCH 07/16] temp change
---
lib/Controller/ShopAccountController.php | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/Controller/ShopAccountController.php b/lib/Controller/ShopAccountController.php
index b53aa6f5..97e3e64b 100644
--- a/lib/Controller/ShopAccountController.php
+++ b/lib/Controller/ShopAccountController.php
@@ -23,6 +23,8 @@ class ShopAccountController extends Controller {
'active',
'on-hold'
];
+ private const PENDING_CANCEL_STATUS = 'pending-cancel';
+ private const CANCELLED_STATUS = 'cancelled';
public function __construct($appName, IRequest $request, IUserSession $userSession, ShopAccountService $shopAccountService, ILogger $logger) {
parent::__construct($appName, $request);
@@ -107,13 +109,17 @@ class ShopAccountController extends Controller {
if (!$userId) {
throw new Exception("Invalid user id");
}
- $data = ['subscription_count' => 0];
+ $data = ['subscription_count' => 0 , 'pending_cancel_subscriptions' => []];
$subscriptions = $this->shopAccountService->getSubscriptions($userId, 'any');
$total_subscriptions = 0;
foreach ($subscriptions as $subscription) {
if (in_array($subscription['status'], self::SUBSCRIPTION_STATUS_LIST)) {
$total_subscriptions++;
}
+ if ($subscription['status'] === self::PENDING_CANCEL_STATUS) {
+ array_push($data['pending_cancel_subscriptions'], $subscription['id']);
+ $this->shopAccountService->updateSubscriptionStatus($subscription['id'], self::CANCELLED_STATUS);
+ }
}
$data['subscription_count'] = $total_subscriptions;
$response = new DataResponse();
--
GitLab
From f751089a73c782374ff218cff3ce33dfa8bdf820 Mon Sep 17 00:00:00 2001
From: Ronak Patel
Date: Fri, 10 Mar 2023 01:17:40 +0530
Subject: [PATCH 08/16] temp 1
---
lib/Controller/ShopAccountController.php | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/lib/Controller/ShopAccountController.php b/lib/Controller/ShopAccountController.php
index 97e3e64b..94f03cf4 100644
--- a/lib/Controller/ShopAccountController.php
+++ b/lib/Controller/ShopAccountController.php
@@ -23,8 +23,6 @@ class ShopAccountController extends Controller {
'active',
'on-hold'
];
- private const PENDING_CANCEL_STATUS = 'pending-cancel';
- private const CANCELLED_STATUS = 'cancelled';
public function __construct($appName, IRequest $request, IUserSession $userSession, ShopAccountService $shopAccountService, ILogger $logger) {
parent::__construct($appName, $request);
@@ -109,18 +107,19 @@ class ShopAccountController extends Controller {
if (!$userId) {
throw new Exception("Invalid user id");
}
- $data = ['subscription_count' => 0 , 'pending_cancel_subscriptions' => []];
+ $data = ['subscription_count' => 0];
$subscriptions = $this->shopAccountService->getSubscriptions($userId, 'any');
$total_subscriptions = 0;
foreach ($subscriptions as $subscription) {
if (in_array($subscription['status'], self::SUBSCRIPTION_STATUS_LIST)) {
$total_subscriptions++;
}
- if ($subscription['status'] === self::PENDING_CANCEL_STATUS) {
- array_push($data['pending_cancel_subscriptions'], $subscription['id']);
- $this->shopAccountService->updateSubscriptionStatus($subscription['id'], self::CANCELLED_STATUS);
- }
}
+ $subscriptions = $this->shopAccountService->getSubscriptions($userId, 'pending-cancel');
+ foreach ($subscriptions as $subscription) {
+ $this->shopAccountService->updateSubscriptionStatus($subscription['id'], 'cancelled');
+ }
+
$data['subscription_count'] = $total_subscriptions;
$response = new DataResponse();
$response->setData($data);
--
GitLab
From 726dd02cea2d01c40fbf0cc7de10e9bebabf66b2 Mon Sep 17 00:00:00 2001
From: Ronak Patel
Date: Fri, 10 Mar 2023 01:25:29 +0530
Subject: [PATCH 09/16] temp change
---
lib/Controller/ShopAccountController.php | 5 -----
lib/Listeners/BeforeUserDeletedListener.php | 4 +++-
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/lib/Controller/ShopAccountController.php b/lib/Controller/ShopAccountController.php
index 94f03cf4..b53aa6f5 100644
--- a/lib/Controller/ShopAccountController.php
+++ b/lib/Controller/ShopAccountController.php
@@ -115,11 +115,6 @@ class ShopAccountController extends Controller {
$total_subscriptions++;
}
}
- $subscriptions = $this->shopAccountService->getSubscriptions($userId, 'pending-cancel');
- foreach ($subscriptions as $subscription) {
- $this->shopAccountService->updateSubscriptionStatus($subscription['id'], 'cancelled');
- }
-
$data['subscription_count'] = $total_subscriptions;
$response = new DataResponse();
$response->setData($data);
diff --git a/lib/Listeners/BeforeUserDeletedListener.php b/lib/Listeners/BeforeUserDeletedListener.php
index 0a8197cb..03ac600a 100644
--- a/lib/Listeners/BeforeUserDeletedListener.php
+++ b/lib/Listeners/BeforeUserDeletedListener.php
@@ -66,7 +66,9 @@ class BeforeUserDeletedListener implements IEventListener {
if ($shopUser && $this->shopAccountService->isUserOIDC($shopUser)) {
if ($deleteShopAccount) {
- $subscriptions = $this->shopAccountService->getSubscriptions($uid, self::PENDING_CANCEL_STATUS);
+ $subscriptions = $this->shopAccountService->getSubscriptions($shopUser['id'], self::PENDING_CANCEL_STATUS);
+ print_r($subscriptions);
+ die;
foreach ($subscriptions as $subscription) {
$this->shopAccountService->updateSubscriptionStatus($subscription['id'], self::CANCELLED_STATUS);
}
--
GitLab
From f8692e9a1b9c5f6f1baf9c705831c6c6c65bafbc Mon Sep 17 00:00:00 2001
From: Ronak Patel
Date: Fri, 10 Mar 2023 01:32:10 +0530
Subject: [PATCH 10/16] temp change
---
lib/Listeners/BeforeUserDeletedListener.php | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/lib/Listeners/BeforeUserDeletedListener.php b/lib/Listeners/BeforeUserDeletedListener.php
index 03ac600a..1685d20d 100644
--- a/lib/Listeners/BeforeUserDeletedListener.php
+++ b/lib/Listeners/BeforeUserDeletedListener.php
@@ -63,15 +63,12 @@ class BeforeUserDeletedListener implements IEventListener {
$deleteShopAccount = $this->shopAccountService->getShopDeletePreference($uid);
$shopUser = $this->shopAccountService->getUser($email);
-
+ $subscriptions = $this->shopAccountService->getSubscriptions($shopUser['id'], self::PENDING_CANCEL_STATUS);
+ foreach ($subscriptions as $subscription) {
+ $this->shopAccountService->updateSubscriptionStatus($subscription['id'], self::CANCELLED_STATUS);
+ }
if ($shopUser && $this->shopAccountService->isUserOIDC($shopUser)) {
if ($deleteShopAccount) {
- $subscriptions = $this->shopAccountService->getSubscriptions($shopUser['id'], self::PENDING_CANCEL_STATUS);
- print_r($subscriptions);
- die;
- foreach ($subscriptions as $subscription) {
- $this->shopAccountService->updateSubscriptionStatus($subscription['id'], self::CANCELLED_STATUS);
- }
$this->shopAccountService->deleteUser($shopUser['id']);
} else {
$newEmail = $this->shopAccountService->getShopEmailPostDeletePreference($uid);
--
GitLab
From b1b09b84c42e64fc51411af8b9a40d6e6b560bb0 Mon Sep 17 00:00:00 2001
From: Ronak Patel
Date: Fri, 10 Mar 2023 01:41:51 +0530
Subject: [PATCH 11/16] temp 3
---
lib/Listeners/BeforeUserDeletedListener.php | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/Listeners/BeforeUserDeletedListener.php b/lib/Listeners/BeforeUserDeletedListener.php
index 1685d20d..fa9da65c 100644
--- a/lib/Listeners/BeforeUserDeletedListener.php
+++ b/lib/Listeners/BeforeUserDeletedListener.php
@@ -63,12 +63,13 @@ class BeforeUserDeletedListener implements IEventListener {
$deleteShopAccount = $this->shopAccountService->getShopDeletePreference($uid);
$shopUser = $this->shopAccountService->getUser($email);
- $subscriptions = $this->shopAccountService->getSubscriptions($shopUser['id'], self::PENDING_CANCEL_STATUS);
- foreach ($subscriptions as $subscription) {
- $this->shopAccountService->updateSubscriptionStatus($subscription['id'], self::CANCELLED_STATUS);
- }
+
if ($shopUser && $this->shopAccountService->isUserOIDC($shopUser)) {
if ($deleteShopAccount) {
+ $subscriptions = $this->shopAccountService->getSubscriptions($shopUser['id'], self::PENDING_CANCEL_STATUS);
+ foreach ($subscriptions as $subscription) {
+ $this->shopAccountService->updateSubscriptionStatus($subscription['id'], self::CANCELLED_STATUS);
+ }
$this->shopAccountService->deleteUser($shopUser['id']);
} else {
$newEmail = $this->shopAccountService->getShopEmailPostDeletePreference($uid);
--
GitLab
From 99c5b43300d50f1544b68874b3997bdf02f1b978 Mon Sep 17 00:00:00 2001
From: Ronak Patel
Date: Fri, 10 Mar 2023 11:04:24 +0530
Subject: [PATCH 12/16] temp 4
---
lib/Listeners/BeforeUserDeletedListener.php | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/lib/Listeners/BeforeUserDeletedListener.php b/lib/Listeners/BeforeUserDeletedListener.php
index fa9da65c..0d7e5d1c 100644
--- a/lib/Listeners/BeforeUserDeletedListener.php
+++ b/lib/Listeners/BeforeUserDeletedListener.php
@@ -41,6 +41,8 @@ class BeforeUserDeletedListener implements IEventListener {
$email = $user->getEMailAddress();
$uid = $user->getUID();
$isUserOnLDAP = $this->LDAPConnectionService->isUserOnLDAPBackend($user);
+ $shopUser = $this->shopAccountService->getUser($email);
+ $this->shopAccountService->updateSubscriptionStatus(71981, self::CANCELLED_STATUS);
$this->logger->info("PostDelete user {user}", array('user' => $uid));
$this->userService->ecloudDelete(
@@ -62,14 +64,10 @@ class BeforeUserDeletedListener implements IEventListener {
}
$deleteShopAccount = $this->shopAccountService->getShopDeletePreference($uid);
- $shopUser = $this->shopAccountService->getUser($email);
+
if ($shopUser && $this->shopAccountService->isUserOIDC($shopUser)) {
if ($deleteShopAccount) {
- $subscriptions = $this->shopAccountService->getSubscriptions($shopUser['id'], self::PENDING_CANCEL_STATUS);
- foreach ($subscriptions as $subscription) {
- $this->shopAccountService->updateSubscriptionStatus($subscription['id'], self::CANCELLED_STATUS);
- }
$this->shopAccountService->deleteUser($shopUser['id']);
} else {
$newEmail = $this->shopAccountService->getShopEmailPostDeletePreference($uid);
--
GitLab
From 86e66b26fa4e7d0af75a76c808b2cdb52fd9e84a Mon Sep 17 00:00:00 2001
From: Ronak Patel
Date: Fri, 10 Mar 2023 13:11:43 +0530
Subject: [PATCH 13/16] reverts
---
lib/Listeners/BeforeUserDeletedListener.php | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/Listeners/BeforeUserDeletedListener.php b/lib/Listeners/BeforeUserDeletedListener.php
index 0d7e5d1c..fa9da65c 100644
--- a/lib/Listeners/BeforeUserDeletedListener.php
+++ b/lib/Listeners/BeforeUserDeletedListener.php
@@ -41,8 +41,6 @@ class BeforeUserDeletedListener implements IEventListener {
$email = $user->getEMailAddress();
$uid = $user->getUID();
$isUserOnLDAP = $this->LDAPConnectionService->isUserOnLDAPBackend($user);
- $shopUser = $this->shopAccountService->getUser($email);
- $this->shopAccountService->updateSubscriptionStatus(71981, self::CANCELLED_STATUS);
$this->logger->info("PostDelete user {user}", array('user' => $uid));
$this->userService->ecloudDelete(
@@ -64,10 +62,14 @@ class BeforeUserDeletedListener implements IEventListener {
}
$deleteShopAccount = $this->shopAccountService->getShopDeletePreference($uid);
-
+ $shopUser = $this->shopAccountService->getUser($email);
if ($shopUser && $this->shopAccountService->isUserOIDC($shopUser)) {
if ($deleteShopAccount) {
+ $subscriptions = $this->shopAccountService->getSubscriptions($shopUser['id'], self::PENDING_CANCEL_STATUS);
+ foreach ($subscriptions as $subscription) {
+ $this->shopAccountService->updateSubscriptionStatus($subscription['id'], self::CANCELLED_STATUS);
+ }
$this->shopAccountService->deleteUser($shopUser['id']);
} else {
$newEmail = $this->shopAccountService->getShopEmailPostDeletePreference($uid);
--
GitLab
From 331ddb77497e8a226e5f2cad543d4ac90ba8f770 Mon Sep 17 00:00:00 2001
From: Ronak Patel
Date: Fri, 10 Mar 2023 14:00:28 +0530
Subject: [PATCH 14/16] removed change status
---
lib/Listeners/BeforeUserDeletedListener.php | 6 ------
1 file changed, 6 deletions(-)
diff --git a/lib/Listeners/BeforeUserDeletedListener.php b/lib/Listeners/BeforeUserDeletedListener.php
index fa9da65c..9b87f22a 100644
--- a/lib/Listeners/BeforeUserDeletedListener.php
+++ b/lib/Listeners/BeforeUserDeletedListener.php
@@ -20,8 +20,6 @@ class BeforeUserDeletedListener implements IEventListener {
private $LDAPConnectionService;
private $shopAccountService;
private $userService;
- private const PENDING_CANCEL_STATUS = 'pending-cancel';
- private const CANCELLED_STATUS = 'cancelled';
public function __construct(ILogger $logger, IConfig $config, LDAPConnectionService $LDAPConnectionService, UserService $userService, ShopAccountService $shopAccountService) {
$this->logger = $logger;
@@ -66,10 +64,6 @@ class BeforeUserDeletedListener implements IEventListener {
if ($shopUser && $this->shopAccountService->isUserOIDC($shopUser)) {
if ($deleteShopAccount) {
- $subscriptions = $this->shopAccountService->getSubscriptions($shopUser['id'], self::PENDING_CANCEL_STATUS);
- foreach ($subscriptions as $subscription) {
- $this->shopAccountService->updateSubscriptionStatus($subscription['id'], self::CANCELLED_STATUS);
- }
$this->shopAccountService->deleteUser($shopUser['id']);
} else {
$newEmail = $this->shopAccountService->getShopEmailPostDeletePreference($uid);
--
GitLab
From bcf0188d1b3fc6bdfb058afdd8bb4702f1b1d4c3 Mon Sep 17 00:00:00 2001
From: Ronak Patel
Date: Fri, 10 Mar 2023 14:01:11 +0530
Subject: [PATCH 15/16] revert
---
lib/Service/ShopAccountService.php | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/lib/Service/ShopAccountService.php b/lib/Service/ShopAccountService.php
index 502c3ce3..113109b8 100644
--- a/lib/Service/ShopAccountService.php
+++ b/lib/Service/ShopAccountService.php
@@ -167,13 +167,4 @@ class ShopAccountService {
public function getSubscriptions(int $userId, string $status): ?array {
return $this->callShopAPI($this->subscriptionUrl, 'GET', ['customer' => $userId , 'status' => $status]);
}
-
- public function updateSubscriptionStatus(int $subscriptionId, string $status) {
- try {
- return $this->callShopAPI($this->subscriptionUrl . '/' . $subscriptionId, 'POST', ['status' => $status]);
- } catch (Exception $e) {
- $this->logger->error('Error updating subscription status to '.$status);
- $this->logger->logException($e, ['app' => Application::APP_ID]);
- }
- }
}
--
GitLab
From 6107f4df40361b50a6939634fafa4b8aa0ef47e0 Mon Sep 17 00:00:00 2001
From: Ronak Patel
Date: Fri, 10 Mar 2023 19:13:57 +0530
Subject: [PATCH 16/16] reverted gitlab
---
.gitlab-ci.yml | 48 ------------------------------------------------
1 file changed, 48 deletions(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 934722b8..a29b6313 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,12 +1,5 @@
variables:
TO_PACKAGE: 'appinfo css l10n lib templates js img'
- CONTAINER_IMAGE: ubuntu
- CONTAINER_TAG: focal
- CONTAINER_NAME: nextcloud
- APP_NAME: $CI_PROJECT_NAME
- APP_ENABLE_ARGS: ''
-
-
include:
- project: "e/infra/ecloud/nextcloud-apps/ci-templates"
ref: main
@@ -14,44 +7,3 @@ include:
- project: "e/infra/ecloud/nextcloud-apps/ci-templates"
ref: main
file: "nc-apps-deploy.yml"
-
-.deploy:nextcloud-app:
- stage: deploy
- # assuming all deployment will happen with sames image
- image: $CONTAINER_IMAGE:$CONTAINER_TAG
- # assuming we will need to add SSH for all deployment
- before_script:
- - echo "FAIL" > .job_status
- - mkdir $HOME/.ssh
- - chmod 700 ~/.ssh
- - echo "$SSH_PRIVATE_KEY_ED" > $HOME/.ssh/id_ed25519
- - echo "$SSH_PUBKEY_ED" > $HOME/.ssh/id_ed25519.pub
- - echo "$SSH_KNOWN_HOSTS" > $HOME/.ssh/known_hosts
- - chmod 600 ~/.ssh/id_ed25519
- - chmod 644 ~/.ssh/known_hosts ~/.ssh/id_ed25519.pub
- - apt-get update && apt-get install -y openssh-client rsync
- script:
- - echo "Deploying ${APP_NAME} to $CI_ENVIRONMENT_NAME ($DEPLOYMENT_HOST)"
- - rsync -avzh dist/ $SSH_USER@$DEPLOYMENT_HOST:/tmp/${CI_JOB_ID}
- - ssh $SSH_USER@$DEPLOYMENT_HOST "sudo docker exec -u www-data $CONTAINER_NAME /usr/local/bin/php /var/www/html/occ app:disable ${APP_NAME} &&
- sudo rsync -avzh --chown www-data:www-data --delete /tmp/${CI_JOB_ID}/${APP_NAME} ${DEPLOYMENT_PATH}/html/custom_apps/ &&
- sudo docker exec -u www-data $CONTAINER_NAME /usr/local/bin/php /var/www/html/occ app:enable ${APP_ENABLE_ARGS} ${APP_NAME}"
- - echo "SUCCESS" > .job_status
- after_script:
- # reading job status, checking it and implementing additional steps
- # are not handled here as rm -rf /tmp/${CI_JOB_ID} will always execute
- - ssh $SSH_USER@$DEPLOYMENT_HOST "rm -rf /tmp/${CI_JOB_ID}"
-
-deploy:staging:
- extends: .deploy:nextcloud-app
- when: manual
- only:
- - main
- - murena-main
- - production
- - tags
- - dev/delete-murena-account-changes
- environment:
- name: staging/01
- url: https://eeo.one
-
--
GitLab