github.com/cloudberrydb/gpbackup@v1.0.3-0.20240118031043-5410fd45eed6/ci/scripts/ic_gpdb4_backup.bash (about)

     1  #!/bin/bash -l
     2  
     3  # This file was copied and modified from ic_gpdb.bash
     4  
     5  set -eox pipefail
     6  
     7  source gpdb_src/ci/concourse/scripts/common.bash
     8  
     9  function gen_env(){
    10    cat > /opt/run_test.sh <<-EOF
    11  		trap look4diffs ERR
    12  
    13  		function look4diffs() {
    14  
    15  		    diff_files="../src/test/regress/regression.diffs
    16  				../src/test/regress/bugbuster/regression.diffs"
    17  
    18  		    for diff_file in \${diff_files}; do
    19  			if [ -f "\${diff_file}" ]; then
    20  			    cat <<-FEOF
    21  
    22  						======================================================================
    23  						DIFF FILE: \${diff_file}
    24  						----------------------------------------------------------------------
    25  
    26  						\$(cat "\${diff_file}")
    27  
    28  					FEOF
    29  			fi
    30  		    done
    31  		    exit 1
    32  		}
    33  		source /usr/local/greenplum-db-devel/greenplum_path.sh
    34  		source /opt/gcc_env.sh
    35  		cd "\${1}/gpdb_src/gpAux"
    36  		source gpdemo/gpdemo-env.sh
    37  		make ${MAKE_TEST_COMMAND}
    38  	EOF
    39  
    40  	chmod a+x /opt/run_test.sh
    41  }
    42  
    43  function setup_gpadmin_user() {
    44      ./gpdb_src/ci/concourse/scripts/setup_gpadmin_user.bash "${TEST_OS}"
    45  }
    46  
    47  function run_gpbackup() {
    48      tar xvzf github_release_components/*.gz -C github_release_components
    49      tar xvzf github_release_components/bin_gpbackup.tar.gz -C /usr/local/greenplum-db-devel
    50      su - gpadmin -c "source /usr/local/greenplum-db-devel/greenplum_path.sh; PGPORT=15432 gpbackup --dbname regression --backup-dir /tmp/gpdb43_regression --single-data-file"
    51      tar -czvf gpdb4_backup_artifacts/gpdb43_regression.tar.gz /tmp/gpdb43_regression
    52  }
    53  
    54  function _main() {
    55      if [[ -z "${MAKE_TEST_COMMAND}" ]]; then
    56          echo "FATAL: MAKE_TEST_COMMAND is not set"
    57          exit 1
    58      fi
    59  
    60      if [[ -z "${TEST_OS}" ]]; then
    61          echo "FATAL: TEST_OS is not set"
    62          exit 1
    63      fi
    64  
    65      if [[ "${TEST_OS}" != "centos" && "${TEST_OS}" != "sles" ]]; then
    66          echo "FATAL: TEST_OS is set to an invalid value: ${TEST_OS}"
    67  	echo "Configure TEST_OS to be centos or sles"
    68          exit 1
    69      fi
    70  
    71      time install_sync_tools
    72      time configure
    73      time install_gpdb
    74      time setup_gpadmin_user
    75      time make_cluster
    76      time gen_env
    77      time run_test
    78      time run_gpbackup
    79  }
    80  
    81  _main "$@"