Merged in feature/schedule (pull request #43)

Add schedule

* Add schedule

* Merged develop into feature/schedule

Approved-by: Rachit Bhargava
This commit is contained in:
Jay Sharma
2024-03-06 20:42:13 +00:00
committed by Rachit Bhargava
parent f02b01d1af
commit ff5b56dc44
3 changed files with 210 additions and 6 deletions

View File

@@ -3,7 +3,38 @@ definitions:
- variables:
- name: VERSION
default: "latest"
# --------------------------------------------------------
set-variables-jobs: &set-variables-schedule-pipelines
- variables:
- name: ACTION
default: "create-schedule-pipelines"
allowed-values: # Optionally restrict variable values
- "create-schedule-pipelines"
- "delete-schedule-pipelines"
- "list-schedule-pipelines"
- name: PIPELINE_NAME
default: "common-jobs-dev"
allowed-values: # Optionally restrict variable values
- "backup-mysql-monthly-prod"
- "backup-static-monthly-prod"
- "cleanup-backup-monthly-prod"
- "common-jobs-dev" # for patch with default values
- name: BRANCH_NAME
default: "feature/backups"
allowed-values: # Optionally restrict variable values
- "develop"
- "feature/backups"
- "feature/backup"
- name: CRONTIME
default: ENTER_CRON_SCHEDULE
# -------------------------------------------------------
# allowed-values: # Optionally restrict variable values
# - "0 * * * 1 ? *" # On 1st every month
# - "0 * * * * 7 *" # Every sunday
# - ""
# - "ENTER_CRON_SCHEDULE"
# ----------------------------------------------------
set-variables-jobs: &set-variables-jobs-dev
- variables:
- name: ENV
@@ -11,7 +42,7 @@ definitions:
allowed-values: # Optionally restrict variable values
- "dev"
- name: JOBNAME
default: "mysql-backup"
default: "wp-auto-patch"
allowed-values: # Optionally restrict variable values
- "wp-auto-patch"
- "mysql-backup"
@@ -41,7 +72,6 @@ definitions:
- name: JOBNAME
default: "mysql-backup"
allowed-values: # Optionally restrict variable values
- "wp-auto-patch"
- "mysql-backup"
- "wp-data-backup"
- "mysql-restore"
@@ -111,6 +141,90 @@ definitions:
pipelines:
# our custom pipeline, what shows up Bitbucket web app
custom:
# -------------------------------------------
schedule-pipelines:
- <<: *set-variables-schedule-pipelines
- step:
name: vars for schedule-pipelines
script:
- echo "export BITBUCKET_REPO_SLUG=$BITBUCKET_REPO_SLUG" >> schedule-setenv.sh
- echo "export BITBUCKET_WORKSPACE=$BITBUCKET_WORKSPACE" >> schedule-setenv.sh
- echo "export TOKEN=$TOKEN" >> schedule-setenv.sh
- echo "export ACTION=$ACTION" >> schedule-setenv.sh
- echo "export PIPELINE_NAME=$PIPELINE_NAME" >> schedule-setenv.sh
- echo "export BRANCH_NAME=$BRANCH_NAME" >> schedule-setenv.sh
- echo "export CRONTIME=\"$CRONTIME\"" >> schedule-setenv.sh
artifacts: # define the artifacts to be passed to each future step
- schedule-setenv.sh
- step:
name: Actions for schedule-pipelines
image: atlassian/pipelines-awscli
script:
- cat schedule-setenv.sh && chmod 755 ./schedule-pipeline.sh && ./schedule-pipeline.sh $ACTION
# -------------------------------------------------
backup-mysql-monthly-prod:
- step:
name: vars for common-jobs-prod
script:
- echo "export JOBNAME=mysql-backup" >> setenv.sh
- echo "export ENV=prod" >> setenv.sh
- echo "export CLUSTER=caresage-eks-cluster-prod" >> setenv.sh
- echo "export VERSION=$BITBUCKET_BUILD_NUMBER" >> setenv.sh
- echo "export SUBDOMAIN=www" >> setenv.sh
- echo "export BITBUCKET_REPO_SLUG=$BITBUCKET_REPO_SLUG" >> setenv.sh
- echo "export TOKEN=$TOKEN" >> setenv.sh
artifacts: # define the artifacts to be passed to each future step
- setenv.sh
- step:
name: common jobs for SQL and WWW backup and restore DEV
image: atlassian/pipelines-awscli
script:
- source setenv.sh && chmod 755 ./common-jobs-bitbucket.sh
- ./common-jobs-bitbucket.sh $JOBNAME
backup-static-monthly-prod:
- step:
name: vars for common-jobs-prod
script:
- echo "export JOBNAME=wp-data-backup" >> setenv.sh
- echo "export ENV=prod" >> setenv.sh
- echo "export CLUSTER=caresage-eks-cluster-prod" >> setenv.sh
- echo "export VERSION=$BITBUCKET_BUILD_NUMBER" >> setenv.sh
- echo "export SUBDOMAIN=www" >> setenv.sh
- echo "export BITBUCKET_REPO_SLUG=$BITBUCKET_REPO_SLUG" >> setenv.sh
- echo "export TOKEN=$TOKEN" >> setenv.sh
artifacts: # define the artifacts to be passed to each future step
- setenv.sh
- step:
name: common jobs for SQL and WWW backup and restore DEV
image: atlassian/pipelines-awscli
script:
- source setenv.sh && chmod 755 ./common-jobs-bitbucket.sh && ./common-jobs-bitbucket.sh $JOBNAME
cleanup-backup-monthly-prod:
- step:
name: vars for common-jobs-prod
script:
- echo "export JOBNAME=cleanup-backup" >> setenv.sh
- echo "export ENV=prod" >> setenv.sh
- echo "export CLUSTER=caresage-eks-cluster-prod" >> setenv.sh
- echo "export VERSION=$BITBUCKET_BUILD_NUMBER" >> setenv.sh
- echo "export SUBDOMAIN=www" >> setenv.sh
- echo "export BITBUCKET_REPO_SLUG=$BITBUCKET_REPO_SLUG" >> setenv.sh
- echo "export TOKEN=$TOKEN" >> setenv.sh
artifacts: # define the artifacts to be passed to each future step
- setenv.sh
- step:
name: common jobs for SQL and WWW backup and restore DEV
image: atlassian/pipelines-awscli
script:
- source setenv.sh && chmod 755 ./common-jobs-bitbucket.sh && ./common-jobs-bitbucket.sh $JOBNAME
deploy-dev:
- <<: *set-variables
- step: