/ docker / docker-entrypoint.sh
docker-entrypoint.sh
 1  #!/bin/bash
 2  
 3  # Variables
 4  ## Common
 5  SOURCE="${SOURCE:-https://github.com/codex-storage/cs-codex-dist-tests.git}"
 6  BRANCH="${BRANCH:-master}"
 7  FOLDER="${FOLDER:-/opt/cs-codex-dist-tests}"
 8  
 9  ## Tests specific
10  DEPLOYMENT_CODEXNETDEPLOYER_PATH="${DEPLOYMENT_CODEXNETDEPLOYER_PATH:-Tools/CodexNetDeployer}"
11  DEPLOYMENT_CODEXNETDEPLOYER_RUNNER="${DEPLOYMENT_CODEXNETDEPLOYER_RUNNER:-deploy-continuous-testnet.sh}"
12  CONTINUOUS_TESTS_FOLDER="${CONTINUOUS_TESTS_FOLDER:-Tests/CodexContinuousTests}"
13  CONTINUOUS_TESTS_RUNNER="${CONTINUOUS_TESTS_RUNNER:-run.sh}"
14  
15  # Get code
16  echo -e "Cloning ${SOURCE} to ${FOLDER}\n"
17  git clone -b "${BRANCH}" "${SOURCE}" "${FOLDER}"
18  echo -e "\nChanging folder to ${FOLDER}\n"
19  cd "${FOLDER}"
20  
21  # Run tests
22  echo -e "Running tests from branch '$(git branch --show-current) ($(git rev-parse --short HEAD))'\n"
23  
24  if [[ "${TESTS_TYPE}" == "continuous-tests" ]]; then
25    echo -e "Running CodexNetDeployer\n"
26    bash "${DEPLOYMENT_CODEXNETDEPLOYER_PATH}"/"${DEPLOYMENT_CODEXNETDEPLOYER_RUNNER}"
27    echo
28    echo -e "Running continuous-tests\n"
29    bash "${CONTINUOUS_TESTS_FOLDER}"/"${CONTINUOUS_TESTS_RUNNER}"
30  else
31    echo -e "Running ${TESTS_TYPE}\n"
32    exec "$@"
33  fi