diff --git a/legacy/build-deploy-docker-compose.sh b/legacy/build-deploy-docker-compose.sh index 60d88357..5e060f25 100755 --- a/legacy/build-deploy-docker-compose.sh +++ b/legacy/build-deploy-docker-compose.sh @@ -377,11 +377,8 @@ declare -A IMAGES_PROMOTE # this array stores the hashes of the built images declare -A IMAGE_HASHES -HELM_ARGUMENTS=() +# this sets CAPABILITIES which is used by some processes in this build . /kubectl-build-deploy/scripts/kubectl-get-cluster-capabilities.sh -for CAPABILITIES in "${CAPABILITIES[@]}"; do - HELM_ARGUMENTS+=(-a "${CAPABILITIES}") -done # Allow the servicetype be overridden by the lagoon API # This accepts colon separated values like so `SERVICE_NAME:SERVICE_TYPE_OVERRIDE`, and multiple overrides @@ -687,22 +684,6 @@ done currentStepEnd="$(date +"%Y-%m-%d %H:%M:%S")" patchBuildStep "${buildStartTime}" "${previousStepEnd}" "${currentStepEnd}" "${NAMESPACE}" "imageBuildComplete" "Image Builds" "false" previousStepEnd=${currentStepEnd} -beginBuildStep "Pre-Rollout Tasks" "runningPreRolloutTasks" - -############################################## -### RUN PRE-ROLLOUT tasks defined in .lagoon.yml -############################################## - -if [ "${LAGOON_PREROLLOUT_DISABLED}" != "true" ]; then - build-deploy-tool tasks pre-rollout -else - echo "pre-rollout tasks are currently disabled LAGOON_PREROLLOUT_DISABLED is set to true" - currentStepEnd="$(date +"%Y-%m-%d %H:%M:%S")" - patchBuildStep "${buildStartTime}" "${previousStepEnd}" "${currentStepEnd}" "${NAMESPACE}" "preRolloutsCompleted" "Pre-Rollout Tasks" "false" -fi - -currentStepEnd="$(date +"%Y-%m-%d %H:%M:%S")" -previousStepEnd=${currentStepEnd} beginBuildStep "Service Configuration Phase 1" "serviceConfigurationPhase1" ############################################## @@ -1391,6 +1372,22 @@ fi currentStepEnd="$(date +"%Y-%m-%d %H:%M:%S")" patchBuildStep "${buildStartTime}" "${previousStepEnd}" "${currentStepEnd}" "${NAMESPACE}" "backupConfigurationComplete" "Backup Configuration" "false" previousStepEnd=${currentStepEnd} +beginBuildStep "Pre-Rollout Tasks" "runningPreRolloutTasks" + +############################################## +### RUN PRE-ROLLOUT tasks defined in .lagoon.yml +############################################## + +if [ "${LAGOON_PREROLLOUT_DISABLED}" != "true" ]; then + build-deploy-tool tasks pre-rollout +else + echo "pre-rollout tasks are currently disabled LAGOON_PREROLLOUT_DISABLED is set to true" + currentStepEnd="$(date +"%Y-%m-%d %H:%M:%S")" + patchBuildStep "${buildStartTime}" "${previousStepEnd}" "${currentStepEnd}" "${NAMESPACE}" "preRolloutsCompleted" "Pre-Rollout Tasks" "false" +fi + +currentStepEnd="$(date +"%Y-%m-%d %H:%M:%S")" +previousStepEnd=${currentStepEnd} beginBuildStep "Deployment Templating" "templatingDeployments" ############################################## diff --git a/legacy/scripts/convert-crontab.sh b/legacy/scripts/convert-crontab.sh deleted file mode 100755 index cefcfad4..00000000 --- a/legacy/scripts/convert-crontab.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash -e - -# no globbing -set -f - -function join { local IFS="$1"; shift; echo "$*"; } - -index=0 - -# Seed is used to generate pseudo random numbers. The seed is based on the -# namespace, so will not change after a deployment for a given namespace. -SEED=$(echo "$1" | cksum | cut -f 1 -d " ") - -while read piece -do - - # Minutes - if [ "$index" = "0" ]; then - if [[ $piece =~ ^(M|H)$ ]]; then - # If just an `M` or `H` (for backwards compatibility) is defined, we - # generate a pseudo random minute. - MINUTES=$((SEED % 60)) - - elif [[ $piece =~ ^(M|H|\*)\/([0-5]?[0-9])$ ]]; then - # A Minute like M/15 (or H/15 or */15 for backwards compatibility) is defined, create a list of minutes with a random start - # like 4,19,34,49 or 6,21,36,51 - STEP=${BASH_REMATCH[2]} - # Generate a random start within the given step to prevent that all cronjobs start at the same time - # but still incorporate the wished step - COUNTER=$((SEED % $STEP)) - MINUTES_ARRAY=() - while [ $COUNTER -lt 60 ]; do - MINUTES_ARRAY+=($COUNTER) - let COUNTER=COUNTER+$STEP - done - MINUTES=$(join , ${MINUTES_ARRAY[@]}) - - elif [[ $piece =~ ^([0-5]?[0-9])(,[0-5]?[0-9])*$ ]]; then - MINUTES=$piece - - elif [[ $piece =~ ^\*$ ]]; then - MINUTES=$piece - - else - echo "error parsing cronjob minute: '$piece'"; exit 1 - - fi - - # Hours - elif [ "$index" = "1" ]; then - if [[ $piece =~ ^H$ ]]; then - # If just an `H` is defined, we generate a pseudo random hour. - HOURS=$((SEED % 24)) - elif [[ $piece =~ ^H\(([01]?[0-9]|2[0-3])-([01]?[0-9]|2[0-3])\)$ ]]; then - # If H is defined with a given range, example: H(2-4), we generate a random hour between 2-4 - HOUR_FROM=${BASH_REMATCH[1]} - HOUR_TO=${BASH_REMATCH[2]} - if (( HOUR_FROM < HOUR_TO )); then - # Example: HOUR_FROM: 2, HOUR_TO: 4 - # Calculate the difference between the two hours (in example will be 2) - MAX_DIFFERENCE=$((HOUR_TO - HOUR_FROM)) - # Generate a difference based on the SEED (in example will be 0, 1 or 2) - DIFFERENCE=$((SEED % MAX_DIFFERENCE)) - # Add the generated difference to the FROM hour (in example will be 2, 3 or 4) - HOURS=$((HOUR_FROM + DIFFERENCE)) - elif (( HOUR_FROM > HOUR_TO )); then - # If the FROM is larger than the TO, we have a range like 22-2 - # Calculate the difference between the two hours with a 24 hour jump (in example will be 4) - MAX_DIFFERENCE=$((24 - HOUR_FROM + HOUR_TO)) - # Generate a difference based on the SEED (in example will be 0, 1, 2, 3 or 4) - DIFFERENCE=$((SEED % MAX_DIFFERENCE)) - # Add the generated difference to the FROM hour (in example will be 22, 23, 24, 25 or 26) - HOURS=$((HOUR_FROM + DIFFERENCE)) - if (( HOURS >= 24 )); then - # If the hour is higher than 24, we subtract 24 to handle the midnight change - HOURS=$((HOURS - 24)) - fi - elif (( HOUR_FROM = HOUR_TO )); then - HOURS=$HOUR_FROM - fi - else - HOURS=$piece - fi - - # Days - elif [ "$index" = "2" ]; then - DAYS=$piece - - # Month - elif [ "$index" = "3" ]; then - MONTHS=$piece - - # Day of Week - elif [ "$index" = "4" ]; then - DAY_WEEK="$piece" - fi - - index=$((index+1)) - -done < <(echo $2 | tr " " "\n") - -echo "${MINUTES} ${HOURS} ${DAYS} ${MONTHS} ${DAY_WEEK}"