gitlab.com/flarenetwork/coreth@v0.1.1/.github/workflows/run_e2e_tests.sh (about)

     1  set -o errexit
     2  set -o nounset
     3  set -o pipefail
     4  
     5  # If Docker Credentials are not available fail
     6  if [[ -z ${DOCKER_USERNAME} ]]; then
     7      echo "Skipping Tests because Docker Credentials were not present."
     8      exit 1
     9  fi
    10  
    11  # Testing specific variables
    12  avalanche_testing_repo="avaplatform/avalanche-testing"
    13  avalanchego_repo="avaplatform/avalanchego"
    14  # Define default avalanche testing version to use
    15  avalanche_testing_image="${avalanche_testing_repo}:master"
    16  
    17  # Avalanche root directory
    18  CORETH_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd ../.. && pwd )
    19  
    20  # Load the versions
    21  source "$CORETH_PATH"/scripts/versions.sh
    22  
    23  # Load the constants
    24  source "$CORETH_PATH"/scripts/constants.sh
    25  
    26  # Login to docker
    27  echo "$DOCKER_PASS" | docker login --username "$DOCKER_USERNAME" --password-stdin
    28  
    29  # Checks available docker tags exist
    30  function docker_tag_exists() {
    31      TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${DOCKER_USERNAME}'", "password": "'${DOCKER_PASS}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
    32      curl --silent -H "Authorization: JWT ${TOKEN}" -f --head -lL https://hub.docker.com/v2/repositories/$1/tags/$2/ > /dev/null
    33  }
    34  
    35  # Defines the avalanche-testing tag to use
    36  # Either uses the same tag as the current branch or uses the default
    37  if docker_tag_exists $avalanche_testing_repo $current_branch; then
    38      echo "$avalanche_testing_repo:$current_branch exists; using this image to run e2e tests"
    39      avalanche_testing_image="$avalanche_testing_repo:$current_branch"
    40  else
    41      echo "$avalanche_testing_repo $current_branch does NOT exist; using the default image to run e2e tests"
    42  fi
    43  
    44  echo "Using $avalanche_testing_image for e2e tests"
    45  
    46  # Defines the avalanchego tag to use
    47  # Either uses the same tag as the current branch or uses the default
    48  # Disable matchup in favor of explicit tag
    49  # TODO re-enable matchup when our workflow better supports it.
    50  # if docker_tag_exists $avalanchego_repo $current_branch; then
    51  #     echo "$avalanchego_repo:$current_branch exists; using this avalanchego image to run e2e tests"
    52  #     AVALANCHE_VERSION=$current_branch
    53  # else
    54  #     echo "$avalanchego_repo $current_branch does NOT exist; using the default image to run e2e tests"
    55  # fi
    56  
    57  # pulling the avalanche-testing image
    58  docker pull $avalanche_testing_image
    59  
    60  # Setting the build ID
    61  git_commit_id=$( git rev-list -1 HEAD )
    62  
    63  # Build current avalanchego
    64  source "$CORETH_PATH"/scripts/build_image.sh
    65  
    66  # Target built version to use in avalanche-testing
    67  avalanche_image="avaplatform/avalanchego:$build_image_id"
    68  
    69  echo "Running Avalanche Image: ${avalanche_image}"
    70  echo "Running Avalanche Testing Image: ${avalanche_testing_image}"
    71  echo "Git Commit ID : ${git_commit_id}"
    72  
    73  
    74  # >>>>>>>> avalanche-testing custom parameters <<<<<<<<<<<<<
    75  custom_params_json="{
    76      \"isKurtosisCoreDevMode\": false,
    77      \"avalanchegoImage\":\"${avalanche_image}\",
    78      \"testBatch\":\"avalanchego\"
    79  }"
    80  # >>>>>>>> avalanche-testing custom parameters <<<<<<<<<<<<<
    81  
    82  bash "$CORETH_PATH/.kurtosis/kurtosis.sh" \
    83      --tests "C-Chain Bombard WorkFlow" \
    84      --custom-params "${custom_params_json}" \
    85      "${avalanche_testing_image}" \
    86      $@