github.com/greenplum-db/gpbackup@v0.0.0-20240517212602-89daab1885b3/ci/scripts/test-gpbackup-manager.bash (about) 1 #!/bin/bash 2 3 set -ex 4 5 # setup cluster and install gpbackup tools using gppkg 6 ccp_src/scripts/setup_ssh_to_cluster.sh 7 out=$(ssh -t cdw 'source env.sh && psql postgres -c "select version();"') 8 TEST_GPDB_VERSION=$(echo ${out} | sed -n 's/.*Greenplum Database \([0-9].[0-9]\+.[0-9]\+\).*/\1/p') 9 GPDB_VERSION=$(echo ${TEST_GPDB_VERSION} | head -c 1) 10 mkdir -p /tmp/untarred 11 tar -xzf gppkgs/gpbackup-gppkgs.tar.gz -C /tmp/untarred 12 scp /tmp/untarred/gpbackup_tools*gp${GPDB_VERSION}*${OS}*.gppkg cdw:/home/gpadmin 13 ssh -t cdw "source env.sh; gppkg -q gpbackup*gp*.gppkg | grep 'is installed' || gppkg -i gpbackup_tools*.gppkg" 14 15 ssh cdw "mkdir -p /home/gpadmin/go/src/github.com/pivotal/gp-backup-manager" 16 pushd gpbackup_manager_src 17 tar -cvf concourse_sucks.tar . 18 scp concourse_sucks.tar cdw:/tmp 19 popd 20 21 22 cat <<SCRIPT > /tmp/run_tests.bash 23 #!/bin/bash 24 25 set -ex 26 source env.sh 27 28 tar -xf /tmp/concourse_sucks.tar -C /home/gpadmin/go/src/github.com/pivotal/gp-backup-manager 29 cd \${GOPATH}/src/github.com/pivotal/gp-backup-manager 30 31 export OLD_BACKUP_VERSION="${GPBACKUP_VERSION}" 32 33 # install pgcrypto; works for GPDB 5.22+ and 6+ 34 psql -d postgres -c "CREATE EXTENSION IF NOT EXISTS pgcrypto" 35 36 make unit integration 37 38 if [ -z "\${OLD_BACKUP_VERSION}" ] ; then 39 # Print the version to help distinguish between the "old version" and "current version" tests 40 gpbackup --version 41 gpssh -f /home/gpadmin/segment_host_list "source /usr/local/greenplum-db-devel/greenplum_path.sh; gpbackup_helper --version" 42 43 make end_to_end 44 else 45 # Print the version to help distinguish between the "old version" and "current version" tests 46 gpbackup --version 47 gpssh -f /home/gpadmin/segment_host_list "source /usr/local/greenplum-db-devel/greenplum_path.sh; gpbackup_helper --version" 48 49 # TODO: It might be nice to make this a tarfile, like with the backwards compatibility job, but this works fine as-is 50 pushd \${GOPATH}/src/github.com/greenplum-db/gpbackup 51 git checkout \${OLD_BACKUP_VERSION} 52 make build 53 54 cp \${GOPATH}/bin/gpbackup \${GPHOME}/bin/. 55 cp \${GOPATH}/bin/gpbackup_helper \${GPHOME}/bin/. 56 gpscp -f /home/gpadmin/segment_host_list \${GOPATH}/bin/gpbackup =:\${GPHOME}/bin/. 57 gpscp -f /home/gpadmin/segment_host_list \${GOPATH}/bin/gpbackup_helper =:\${GPHOME}/bin/. 58 popd 59 60 make end_to_end 61 fi 62 63 SCRIPT 64 65 chmod +x /tmp/run_tests.bash 66 scp /tmp/run_tests.bash cdw:/home/gpadmin/run_tests.bash 67 ssh -t cdw "/home/gpadmin/run_tests.bash"