From 48be209c64d0825d9b087f3ced264263eaa54b19 Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Mon, 13 Nov 2023 13:21:58 -0700 Subject: [PATCH] add rsync that does not sync repodata --- sync/common | 7 +++++++ sync/sync-to-vault.sh | 23 +++++++++++++++++++++++ sync/vault-release-no-repodata.sh | 24 ++++++++++++++++++++++++ sync/vault-release.sh | 2 +- 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 sync/sync-to-vault.sh create mode 100644 sync/vault-release-no-repodata.sh diff --git a/sync/common b/sync/common index da23ca9..d0bdf4d 100644 --- a/sync/common +++ b/sync/common @@ -159,6 +159,12 @@ function rsync_no_delete_prod() { sudo -l && rsync -vrlptDSHog --chown=10004:10005 --progress --human-readable "${REV}/" "${TARGET}" } +function rsync_no_delete_prod_no_repodata() { + local REV="${1}" + local TARGET="${2}" + sudo -l && rsync -vrlptDSHog --chown=10004:10005 --progress --human-readable --exclude repodata "${REV}/" "${TARGET}" +} + function rsync_delete_staging() { local TARGET="${1}" sudo -l && rsync -vrlptDSHog --chown=10004:10005 --progress --human-readable --delete compose/ "${TARGET}" @@ -303,6 +309,7 @@ export -f parallel_rsync_delete_prod export -f rsync_no_delete_staging export -f rsync_no_delete_staging_with_excludes export -f rsync_no_delete_prod +export -f rsync_no_delete_prod_no_repodata export -f rsync_delete_staging export -f rsync_delete_staging_with_excludes export -f rsync_delete_prod diff --git a/sync/sync-to-vault.sh b/sync/sync-to-vault.sh new file mode 100644 index 0000000..2324a35 --- /dev/null +++ b/sync/sync-to-vault.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Syncs everything from staging to production + +if [[ "$RLREL" == "lh" ]] || [[ "$RLREL" == "beta" ]]; then + exit 1 +fi + +# Source common variables +# shellcheck disable=SC2046,1091,1090 +source "$(dirname "$0")/common" + +REV=${REVISION}${APPEND_TO_DIR} + +cd "${STAGING_ROOT}/${CATEGORY_STUB}" || { echo "Failed to change directory"; ret_val=1; exit 1; } +ret_val=$? + +if [ $ret_val -eq "0" ]; then + TARGET="${PRODUCTION_ROOT}/${CATEGORY_STUB}/${REV/-*/}" + mkdir -p "${TARGET}" + rsync_delete_prod "${REV}" "${TARGET}" + echo "Syncing to prod completed. Please run the file list script." +fi + diff --git a/sync/vault-release-no-repodata.sh b/sync/vault-release-no-repodata.sh new file mode 100644 index 0000000..3baf9e0 --- /dev/null +++ b/sync/vault-release-no-repodata.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Syncs everything from production to vault + +if [[ "$RLREL" == "lh" ]] || [[ "$RLREL" == "beta" ]]; then + echo "Lookahead nor Beta should be vaulted" + exit 1 +fi + +# Source common variables +# shellcheck disable=SC2046,1091,1090 +source "$(dirname "$0")/common" + +REV=${REVISION} + +cd "${PRODUCTION_ROOT}/${CATEGORY_STUB}" || { echo "Failed to change directory"; ret_val=1; exit 1; } +ret_val=$? + +if [ $ret_val -eq "0" ]; then + TARGET="${PRODUCTION_ROOT}/${VAULT_STUB}/${REV}" + mkdir -p "${TARGET}" + rsync_no_delete_prod_no_repodata "${REV}" "${TARGET}" + echo "Syncing to the vault completed. Please run the file list script." +fi + diff --git a/sync/vault-release.sh b/sync/vault-release.sh index 2048103..aed8078 100644 --- a/sync/vault-release.sh +++ b/sync/vault-release.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Syncs everything from staging to production +# Syncs everything from production to vault if [[ "$RLREL" == "lh" ]] || [[ "$RLREL" == "beta" ]]; then echo "Lookahead nor Beta should be vaulted"