Skip to content

Commit

Permalink
PRODUCT_NAME var
Browse files Browse the repository at this point in the history
  • Loading branch information
odra committed Mar 8, 2019
1 parent 95ceaca commit 761a5e6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion image/tools/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ if [[ "$encryption_engine" ]]; then
else
encrypted_files="$ARCHIVES_DEST/*"
fi
upload_archive "${encrypted_files}" $DATESTAMP backups/$component
upload_archive "${encrypted_files}" $DATESTAMP backups/$PRODUCT_NAME/$component
echo '==> Archive upload completed'

echo "[$DATESTAMP] Backup completed"
Expand Down
7 changes: 1 addition & 6 deletions image/tools/lib/backend/s3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,13 @@ function upload_archive {

local file_list=$1
local datestamp=$2
local bucket_folder=$3

local AWS_S3_BUCKET_NAME=$(get_s3_bucket_name)
local AWS_S3_BUCKET_SUFFIX="$(get_s3_bucket_suffix)"
local AWS_ACCESS_KEY_ID="$(get_s3_key_id)"
local AWS_SECRET_ACCESS_KEY="$(get_s3_access_key)"

if [[ "$AWS_S3_BUCKET_SUFFIX" ]]; then
bucket_folder="$3/$AWS_S3_BUCKET_SUFFIX"
else
bucket_folder=$3
fi

for fname in ${file_list}; do
s3cmd put --access_key ${AWS_ACCESS_KEY_ID} --secret_key ${AWS_SECRET_ACCESS_KEY} --progress ${fname} "s3://$AWS_S3_BUCKET_NAME/$bucket_folder/$datestamp/$(basename ${fname})"
rc=$?
Expand Down
3 changes: 3 additions & 0 deletions templates/openshift/backup-cronjob-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ parameters:
- name: NAME
description: Unique job name to be used in several resource name(s)
value: integreatly-cronjob-backup
- name: PRODUCT_NAME
description: Middleware product name to have its data archived
required: true
- name: COMPONENT
description: Component name to run the backup
required: true
Expand Down
5 changes: 5 additions & 0 deletions templates/openshift/backup-job-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,16 @@ objects:
value: "${ENCRYPTION_SECRET_NAME}"
- name: COMPONENT_SECRET_NAME
value: "${COMPONENT_SECRET_NAME}"
- name: PRODUCT_NAME
value: "${PRODUCT_NAME}"
restartPolicy: Never
parameters:
- name: NAME
description: Unique job name to be used in several resource name(s)
value: integreatly-job-backup
- name: PRODUCT_NAME
description: Middleware product name to have its data archived
required: true
- name: COMPONENT
description: Component name to run the backup
required: true
Expand Down

0 comments on commit 761a5e6

Please sign in to comment.