From 75202095b4c0e96103e491411ba67c7f558eb17f Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Wed, 26 Feb 2025 15:20:57 +0530 Subject: [PATCH 1/6] deploy directly to staging --- .gitlab-ci.yml | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 08326169..9d9d34e7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,6 +7,12 @@ stages: variables: TO_PACKAGE: 'appinfo l10n lib templates js img css' + CONTAINER_IMAGE: ubuntu + CONTAINER_TAG: focal + CONTAINER_NAME: nextcloud + APP_NAME: $CI_PROJECT_NAME + OCC_ENABLE_AFTER_DEPLOY: 'true' + APP_PATH: '' include: - project: "e/infra/ecloud/nextcloud-apps/ci-templates" ref: main @@ -23,6 +29,58 @@ include: - project: "e/infra/ecloud/nextcloud-apps/ci-templates" ref: main file: "populate-code-climate-default-config.yml" + .deploy:nextcloud-app-by-checkout: + 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: + # print var to confirm + - echo "Deploying $APP_NAME to $CI_ENVIRONMENT_NAME ($DEPLOYMENT_HOST)" + # clone repo to /tmp + - | + ssh $SSH_USER@$DEPLOYMENT_HOST /bin/bash -s << EOT + git clone --depth 1 $CI_REPOSITORY_URL --branch $CI_COMMIT_REF_NAME --single-branch /tmp/${CI_JOB_ID}/${APP_NAME} + if $OCC_ENABLE_AFTER_DEPLOY = 'true' + then + sudo docker exec -u www-data $CONTAINER_NAME /usr/local/bin/php /var/www/html/occ app:disable ${APP_NAME} + fi + sudo rsync -avzh --chown www-data:www-data --delete --exclude '.git*' /tmp/${CI_JOB_ID}/${APP_NAME} ${DEPLOYMENT_PATH}/html/custom_apps/${APP_PATH} + if $OCC_ENABLE_AFTER_DEPLOY = 'true' + then + sudo docker exec -u www-data $CONTAINER_NAME /usr/local/bin/php /var/www/html/occ app:enable ${APP_NAME} + fi + EOT + - 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-by-checkout + when: manual + only: + - main + - murena-main + - production + - tags + - dev/account-delete-changes + environment: + name: staging/01 + url: https://eeo.one build-vendor: stage: build -- GitLab From 35e258257e9f977666b7ea2b08e6828f460ae2d7 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Wed, 26 Feb 2025 15:26:40 +0530 Subject: [PATCH 2/6] fix loader issue --- .gitlab-ci.yml | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9d9d34e7..2ce2c693 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ stages: - performance - dast - deploy - + variables: TO_PACKAGE: 'appinfo l10n lib templates js img css' CONTAINER_IMAGE: ubuntu @@ -29,7 +29,7 @@ include: - project: "e/infra/ecloud/nextcloud-apps/ci-templates" ref: main file: "populate-code-climate-default-config.yml" - .deploy:nextcloud-app-by-checkout: +.deploy:nextcloud-app-by-checkout: stage: deploy # assuming all deployment will happen with sames image image: $CONTAINER_IMAGE:$CONTAINER_TAG @@ -68,30 +68,19 @@ include: - ssh $SSH_USER@$DEPLOYMENT_HOST "rm -rf /tmp/${CI_JOB_ID}" - deploy:staging: - extends: .deploy:nextcloud-app-by-checkout - when: manual - only: - - main - - murena-main - - production - - tags - - dev/account-delete-changes + extends: .deploy:nextcloud-app + rules: + - if: $CI_COMMIT_BRANCH == "main" + when: manual + - if: $CI_COMMIT_BRANCH == "murena-main" + when: manual + - if: $CI_COMMIT_BRANCH == "production" + when: manual + - if: $CI_COMMIT_TAG + when: manual + - if: $CI_COMMIT_BRANCH == "dev/fix-loader-issue" + when: manual environment: name: staging/01 - url: https://eeo.one - -build-vendor: - stage: build - extends: .composer:base - needs: ["build-frontend"] - before_script: - - composer install --no-dev - script: - - cp -a vendor dist/${APP_NAME} - - find dist/${APP_NAME} -type d -exec chmod 755 {} \; - - find dist/${APP_NAME} -type f -exec chmod 644 {} \; - artifacts: - paths: - - dist/ + url: $ENV_URL \ No newline at end of file -- GitLab From d19a7a3dc60386cc3461188b54e5490ed70aed0f Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Thu, 27 Feb 2025 12:20:25 +0530 Subject: [PATCH 3/6] fix loading icon --- src/DeleteShopAccountSetting.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/DeleteShopAccountSetting.vue b/src/DeleteShopAccountSetting.vue index 7c28a59c..2960b387 100644 --- a/src/DeleteShopAccountSetting.vue +++ b/src/DeleteShopAccountSetting.vue @@ -59,7 +59,7 @@ -
+
@@ -93,6 +93,7 @@ export default { showError: false, allowDelete: true, ordersDescription: '', + loading: true, } }, computed: { @@ -179,6 +180,7 @@ export default { this.allowDelete = false } } + this.loading = false this.disableOrEnableDeleteAccount() }, async updateDeleteShopPreference() { -- GitLab From be9afa3557c9f2e4f643b2c3f3cb961a9ab929d8 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Fri, 28 Feb 2025 14:45:53 +0530 Subject: [PATCH 4/6] pipeline fix --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2ce2c693..35d3efa6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,7 +43,7 @@ include: - 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 + - apk-get update && apt-get install -y openssh-client rsync script: # print var to confirm - echo "Deploying $APP_NAME to $CI_ENVIRONMENT_NAME ($DEPLOYMENT_HOST)" -- GitLab From 00ac9d5d85034c4fa2fcdc5a7664f11d70590d8b Mon Sep 17 00:00:00 2001 From: Fazle Rabbi Date: Fri, 28 Feb 2025 15:55:59 +0600 Subject: [PATCH 5/6] add workflow to disable merge_request pipelines --- .gitlab-ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 35d3efa6..5c34fa33 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,13 @@ stages: - performance - dast - deploy - + +workflow: + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_OPEN_MERGE_REQUESTS + when: never + - if: $CI_COMMIT_BRANCH + variables: TO_PACKAGE: 'appinfo l10n lib templates js img css' CONTAINER_IMAGE: ubuntu -- GitLab From 163aae1d4689bd76f1a3b392795304fc1e008662 Mon Sep 17 00:00:00 2001 From: Fazle Rabbi Date: Fri, 28 Feb 2025 16:02:38 +0600 Subject: [PATCH 6/6] add deploy staging for this branch --- .gitlab-ci.yml | 44 +++----------------------------------------- 1 file changed, 3 insertions(+), 41 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5c34fa33..f06a6667 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,44 +35,6 @@ include: - project: "e/infra/ecloud/nextcloud-apps/ci-templates" ref: main file: "populate-code-climate-default-config.yml" -.deploy:nextcloud-app-by-checkout: - 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 - - apk-get update && apt-get install -y openssh-client rsync - script: - # print var to confirm - - echo "Deploying $APP_NAME to $CI_ENVIRONMENT_NAME ($DEPLOYMENT_HOST)" - # clone repo to /tmp - - | - ssh $SSH_USER@$DEPLOYMENT_HOST /bin/bash -s << EOT - git clone --depth 1 $CI_REPOSITORY_URL --branch $CI_COMMIT_REF_NAME --single-branch /tmp/${CI_JOB_ID}/${APP_NAME} - if $OCC_ENABLE_AFTER_DEPLOY = 'true' - then - sudo docker exec -u www-data $CONTAINER_NAME /usr/local/bin/php /var/www/html/occ app:disable ${APP_NAME} - fi - sudo rsync -avzh --chown www-data:www-data --delete --exclude '.git*' /tmp/${CI_JOB_ID}/${APP_NAME} ${DEPLOYMENT_PATH}/html/custom_apps/${APP_PATH} - if $OCC_ENABLE_AFTER_DEPLOY = 'true' - then - sudo docker exec -u www-data $CONTAINER_NAME /usr/local/bin/php /var/www/html/occ app:enable ${APP_NAME} - fi - EOT - - 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 @@ -83,10 +45,10 @@ deploy:staging: when: manual - if: $CI_COMMIT_BRANCH == "production" when: manual - - if: $CI_COMMIT_TAG - when: manual - if: $CI_COMMIT_BRANCH == "dev/fix-loader-issue" when: manual + - if: $CI_COMMIT_TAG + when: manual environment: name: staging/01 - url: $ENV_URL \ No newline at end of file + url: $ENV_URL -- GitLab