github.com/dcarley/cf-cli@v6.24.1-0.20170220111324-4225ff346898+incompatible/bin/cleanup-integration (about)

     1  #!/usr/bin/env bash
     2  
     3  set -e
     4  
     5  xargs_func () {
     6    if [[ $(uname) == "Darwin" ]]; then
     7      xargs -L 1 -P 7 $@
     8    else
     9      xargs -L 1 -P 7 -r $@
    10    fi
    11  }
    12  
    13  CF_API=${CF_API:-"api.bosh-lite.com"}
    14  CF_USERNAME=${CF_USERNAME:-"admin"}
    15  CF_PASSWORD=${CF_PASSWORD:-"admin"}
    16  
    17  export CF_CLI_EXPERIMENTAL=true
    18  export CF_DIAL_TIMEOUT=15
    19  
    20  if [[ -z $SKIP_SSL_VALIDATION || $SKIP_SSL_VALIDATION == "true" ]]; then
    21    cf api $CF_API --skip-ssl-validation
    22  else
    23    cf api $CF_API
    24  fi
    25  
    26  cf auth $CF_USERNAME $CF_PASSWORD
    27  
    28  # we don't want the pipeline job to fail because there's a high chance of
    29  # failure when running commands in parallel
    30  set +e
    31  
    32  cf orgs | grep -i ^integration-org | xargs_func cf delete-org -f
    33  cf orgs | grep -i ^integration-org | xargs_func cf delete-org -f
    34  
    35  cf quotas | grep -i ^integration-quota | cut -d " " -f1 | xargs_func cf delete-quota -f
    36  
    37  cf create-org temp-org
    38  cf target -o temp-org
    39  cf domains | grep -i ^integration- | cut -d " " -f1 | xargs_func cf delete-shared-domain -f
    40  
    41  cf delete-org -f temp-org
    42  
    43  cf curl /v2/users?results-per-page=100 | \
    44    jq -r .resources[].entity.username | \
    45    grep -i ^integration-user | \
    46    xargs_func cf delete-user -f