Commit 8f856828 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Reubica y refactoriza maintenance, retrocompatible

Aprovecha base común para plantillas de docker-deploy y maintenance, ya
que se basan en la misma imagen Docker base y tienen variables en común,
ambos procesos sin dependencias de otros jobs.
parent 3c912e8f
Loading
Loading
Loading
Loading
+4 −35
Original line number Diff line number Diff line
.scheduled-run:
  stage: maintenance
  dependencies: []
  needs: []
  image: ${DOCKER_DEPLOY_IMAGE_NAME}:${DOCKER_DEPLOY_IMAGE_TAG}
  variables:
    DOCKER_DEPLOY_IMAGE_NAME: redmic/docker-docker-deploy
    DOCKER_DEPLOY_IMAGE_TAG: latest
    STACK: ${CI_PROJECT_NAME}
    REGISTRY_URL: ${CI_REGISTRY}
    REGISTRY_USER: ${CI_DEPLOY_USER}
    REGISTRY_PASS: ${CI_DEPLOY_PASSWORD}
    SERVICE: ${CI_PROJECT_NAME}_${CI_PROJECT_NAME}
  script: relaunch
# Only for backward compatibility, migrate ASAP your project includes to templates included here!

.scheduled-run-development:
  extends: .scheduled-run
  variables:
    SSH_REMOTE: ${DEV_SSH_REMOTE}
    SSH_PORT: ${DEV_SSH_PORT}
    DEPLOY_KEY: ${DEV_DEPLOY_KEY}
  rules:
    - if: $DEVELOPMENT_MAINTENANCE_DISABLED
      when: never
    - if: $CI_PIPELINE_SOURCE == "schedule"

.scheduled-run-production:
  extends: .scheduled-run
  variables:
    SSH_REMOTE: ${PRO_SSH_REMOTE}
    SSH_PORT: ${PRO_SSH_PORT}
    DEPLOY_KEY: ${PRO_DEPLOY_KEY}
  rules:
    - if: $PRODUCTION_MAINTENANCE_DISABLED
      when: never
    - if: $CI_PIPELINE_SOURCE == "schedule"
include:
  - local: '/deployment-service/_maintenance.yml'
  - local: '/deprecation-warning.yml'
+10 −0
Original line number Diff line number Diff line
.docker-deploy-base:
  dependencies: []
  image: ${DOCKER_DEPLOY_IMAGE_NAME}:${DOCKER_DEPLOY_IMAGE_TAG}
  variables:
    DOCKER_DEPLOY_IMAGE_NAME: redmic/docker-docker-deploy
    DOCKER_DEPLOY_IMAGE_TAG: latest
    STACK: ${CI_PROJECT_NAME}
    REGISTRY_URL: ${CI_REGISTRY}
    REGISTRY_USER: ${CI_DEPLOY_USER}
    REGISTRY_PASS: ${CI_DEPLOY_PASSWORD}
+4 −8
Original line number Diff line number Diff line
include:
  - local: '/deployment-service/_base.yml'

.deploy:
  extends: .docker-deploy-base
  stage: deploy
  dependencies: []
  image: ${DOCKER_DEPLOY_IMAGE_NAME}:${DOCKER_DEPLOY_IMAGE_TAG}
  variables:
    DOCKER_DEPLOY_IMAGE_NAME: redmic/docker-docker-deploy
    DOCKER_DEPLOY_IMAGE_TAG: latest
    STACK: ${CI_PROJECT_NAME}
    DEPLOY_DIR_NAME: deploy
    REGISTRY_URL: ${CI_REGISTRY}
    REGISTRY_USER: ${CI_DEPLOY_USER}
    REGISTRY_PASS: ${CI_DEPLOY_PASSWORD}
  before_script:
    - >
      if [ -z ${COMPOSE_FILE} ];
+32 −0
Original line number Diff line number Diff line
include:
  - local: '/deployment-service/_base.yml'

.scheduled-run:
  extends: .docker-deploy-base
  stage: maintenance
  needs: []
  variables:
    SERVICE: ${CI_PROJECT_NAME}_${CI_PROJECT_NAME}
  script: relaunch

.scheduled-run-development:
  extends: .scheduled-run
  variables:
    SSH_REMOTE: ${DEV_SSH_REMOTE}
    SSH_PORT: ${DEV_SSH_PORT}
    DEPLOY_KEY: ${DEV_DEPLOY_KEY}
  rules:
    - if: $DEVELOPMENT_MAINTENANCE_DISABLED
      when: never
    - if: $CI_PIPELINE_SOURCE == "schedule"

.scheduled-run-production:
  extends: .scheduled-run
  variables:
    SSH_REMOTE: ${PRO_SSH_REMOTE}
    SSH_PORT: ${PRO_SSH_PORT}
    DEPLOY_KEY: ${PRO_DEPLOY_KEY}
  rules:
    - if: $PRODUCTION_MAINTENANCE_DISABLED
      when: never
    - if: $CI_PIPELINE_SOURCE == "schedule"
+8 −0
Original line number Diff line number Diff line
include:
  - local: '/deployment-service/_maintenance.yml'

scheduled-run-development:
  extends: .scheduled-run-development

scheduled-run-production:
  extends: .scheduled-run-production
Loading