Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix codeready pv archive fn #43

Merged
merged 1 commit into from
May 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions image/tools/lib/component/codeready_pv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@ function dump_pod_data {
}

function component_dump_data {
local pods="$(oc get pods -n ${PRODUCT_NAMESPACE_PREFIX}codeready | grep workspace)"
local pods="$(oc get pods -n ${PRODUCT_NAMESPACE_PREFIX}codeready | grep workspace | awk '{print $1}')"
if [ "${#pods}" -eq "0" ]; then
echo "=>> No workspaces found to backup"
exit 0
fi

local workspace_pods="$(echo $pods | awk '{print $1}')"
local archive_path="$1/archives"
local dump_dest="/tmp/codeready-data"
mkdir -p $dump_dest
for i in $workspace_pods; do dump_pod_data $i $dump_dest; done
for pod in $pods; do dump_pod_data $pod $dump_dest; done
local ts=$(date '+%H_%M_%S')
tar -zcvf "$archive_path/codeready-pv-data-${ts}.tar.gz" -C $dump_dest .
rm -rf $dump_dest
tar -zcvf "$archive_path/codeready-pv-data-${ts}.tar.gz" -C "${dump_dest}" .
}