<commit_before>sudo: required
dist: trusty
group: deprecated-2017Q4
language: go

os:
  - linux

go:
  - 1.8.7

go_import_path: github.com/kubeless/kubeless

services:
  - docker
env:
  matrix:
    - TEST_TARGET=unit
    - TEST_TARGET=minikube
    - TEST_TARGET=minikube_kafka
    - TEST_TARGET=GKE
  global:
    - CONTROLLER_IMAGE_NAME=bitnami/kubeless-controller
    - CONTROLLER_TAG=${TRAVIS_TAG:-build-$TRAVIS_BUILD_ID}
    - CONTROLLER_IMAGE=${CONTROLLER_IMAGE_NAME}:${CONTROLLER_TAG}
    - CGO_ENABLED=0
    - TEST_DEBUG=1
    - GKE_VERSION=1.7.11-gke.1
    - secure: <KEY>
    - secure: <KEY>
    - secure: <KEY>
    - secure: <KEY>
    - <KEY>
    - secure: tywTqujLrvN0xzjawWvNniav1c/FNcgI+A+u2IdbPxb4yeO5k2Sc71nN2kHYCdD1o3K8ehAUTPF4DlNiEWGlfMhqofciSDEsSUXKz39ndZng7RXIJU9u8PGFhGSHwoZOPvVTTABT8Fa+i+omgdUsQkJOAghw1AZUD+W0Tp88J/PEZcWLd0WuslKPAioUEsNqftPT7kWVc+4BoGnZ2ZejlKsNwYnGNPCIVoE7eMa1MQM6UqsMfTzln8dQO8Ab0qVNEcm5tkwDlYoEl4kF6smV/GpnUJvMnXJycTnCr9XB7/t4Hxr1GJlQm6dumsweXTFoZTXDZtCsRtXbaFrFg+pqRRs+9BqOIDFXO1PFLrf1eryaztiErysdr66LR4/9pS1IZ8I2wJGh3bXEWDSY4clc0syusuXOKSlNDHQsWbPMC2IDNygQr/DigQmtYrwLpdiiUsF1XPHMyQKGmop6ewTYzd7DrJWwDGPrkW2YIJQgvxpkX58/dKNp4BZQY5wuXKQLvUQjFOa3gelfsbFFuhQEEbcIfINBI9TuM5K0Q+HXPdlfef/0Cbp6pktIEUYErK46mf2iy+1phXDZ0UPz/ZXe2NmawEPQVMBJaCIkr/B75mn5p7oGSKdJ3NpN87Bbn+Pwpx3tKpuDpc9hOjlfAGo+dcU6BAYkcwUSBGInjUsRNf4=
before_install:
  - set -e
  # Decide if we should run the tests
  - |
    case $TEST_TARGET in
    # We will always build assets when doing unit tests or minikube end-2-end tests
    unit|minikube)
      export SHOULD_TEST=1
      ;;
    # In case of GKE we will only want to build if it is
    # a build of a branch in the kubeless/kubeless repository
    GKE)
      if [[ -n "$GKE_ADMIN" && "$TRAVIS_EVENT_TYPE" != "pull_request" ]]; then
        export SHOULD_TEST=1
        export SHOULD_INSTALL_GCLOUD=1
      fi
      ;;
    # In kase of minikube+kafka we want to test it if
    # it is a Pull Request related to Kafka (discovered from the PR title)
    # or if the build is from the "master" branch
    minikube_kafka)
      if [[ "$TRAVIS_PULL_REQUEST" != false ]]; then
        pr_kafka_title=$(curl "https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/${TRAVIS_PULL_REQUEST}" | grep title || true)
      fi
      if [[ "$TRAVIS_PULL_REQUEST" == false || "$pr_kafka_title" == "" || "$pr_kafka_title" =~ ^.*(Kafka|kafka|KAFKA).*$ ]]; then
        export SHOULD_TEST=1
      fi
      ;;
    esac
install:
  - |
    if [[ "$SHOULD_TEST" == "1" ]]; then
      make bootstrap
    fi
    if [[ "$SHOULD_INSTALL_GCLOUD" == "1" ]]; then
      export GOOGLE_APPLICATION_CREDENTIALS=$TRAVIS_BUILD_DIR/client_secrets.json
      openssl aes-256-cbc -K $encrypted_1dbafa65b3ad_key -iv $encrypted_1dbafa65b3ad_iv -in .github/gcloud.json.enc -out $GOOGLE_APPLICATION_CREDENTIALS -d
      if [ ! -d $HOME/gcloud/google-cloud-sdk ]; then
        mkdir -p $HOME/gcloud &&
        wget -q https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-187.0.0-linux-x86_64.tar.gz --directory-prefix=$HOME/gcloud &&
        cd $HOME/gcloud &&
        tar xzf google-cloud-sdk-187.0.0-linux-x86_64.tar.gz &&
        printf '\ny\n\ny\ny\n' | ./google-cloud-sdk/install.sh &&
        cd $TRAVIS_BUILD_DIR;
      fi
      gcloud -q config set project $GKE_PROJECT
      if [ -a $GOOGLE_APPLICATION_CREDENTIALS ]; then
        gcloud -q auth activate-service-account --key-file $GOOGLE_APPLICATION_CREDENTIALS;
      fi
      echo "Starting GKE cluster"
      ./script/start-gke-env.sh $GKE_CLUSTER $ZONE $GKE_VERSION $GKE_ADMIN > $TRAVIS_BUILD_DIR/gke-start.log 2>&1 &
      GKE_START_PID=$!
    fi

script:
  - |
    if [[ "$SHOULD_TEST" == "1" ]]; then
      make VERSION=${TRAVIS_TAG:-build-$TRAVIS_BUILD_ID} binary
      make controller-image CONTROLLER_IMAGE=$CONTROLLER_IMAGE
      make all-yaml
      sed -i.bak 's/'":latest"'/'":${CONTROLLER_TAG}"'/g' kubeless.yaml
      sed -i.bak 's/'":latest"'/'":${CONTROLLER_TAG}"'/g' kubeless-rbac.yaml
      sed -i.bak 's/'":latest"'/'":${CONTROLLER_TAG}"'/g' kubeless-openshift.yaml
      case $TEST_TARGET in
      unit)
        make test
        make validation
        ;;
      minikube)
        ./script/integration-tests minikube deployment
        ./script/integration-tests minikube basic
        ;;
      minikube_kafka)
        ./script/integration-tests minikube deployment
        ./script/integration-tests minikube kafka
        ;;
      GKE)
        docker login -u="$DOCKER_USERNAME" -p="$<PASSWORD>"
        docker push $CONTROLLER_IMAGE
        echo "Waiting for the GKE cluster to be ready"
        tail -f $TRAVIS_BUILD_DIR/gke-start.log &
        wait $GKE_START_PID
        if ! kubectl get pods -n kubeless 2>&1 | grep -q "No resources found"; then
          echo "Waiting for a previous installation to be cleaned"
          bash -c 'grep -q "No resources found" <(timeout 60 kubectl get pods -n kubeless -w 2>&1)'
        fi
        ./script/integration-tests gke_${GKE_PROJECT}_${ZONE}_${GKE_CLUSTER}
        ;;
      esac
    else
      echo "Skipping tests"
    fi

after_success:
  - |
    if [[ "$TRAVIS_BRANCH" == master && \
          "$TRAVIS_PULL_REQUEST" == false ]]; then
      docker login -u="$DOCKER_USERNAME" -p="<PASSWORD>"
      docker tag $CONTROLLER_IMAGE ${CONTROLLER_IMAGE_NAME}:latest
      docker push ${CONTROLLER_IMAGE_NAME}:latest
    fi

before_deploy:
  - |
    if [[ "$SHOULD_TEST" != "1" ]]; then
      echo "Unable to release a job that has not been tested!"
      return 1
    fi
  - |
    if [ "$TEST_TARGET" = minikube ]; then
      make VERSION=${TRAVIS_TAG:-build-$TRAVIS_BUILD_ID} binary-cross
      for d in bundles/kubeless_*; do zip -r9 $d.zip $d/; done
      docker login -u="$DOCKER_USERNAME" -p="<PASSWORD>"
      docker tag $CONTROLLER_IMAGE ${CONTROLLER_IMAGE_NAME}:latest
      docker push $CONTROLLER_IMAGE
      NEW_DIGEST=$(./script/find_digest.sh  ${CONTROLLER_IMAGE_NAME} ${TRAVIS_TAG} | cut -d " " -f 2)
      sed 's/'":${CONTROLLER_TAG}"'/'"@$NEW_DIGEST"'/g' kubeless.yaml > kubeless-${TRAVIS_TAG}.yaml
      sed 's/'":${CONTROLLER_TAG}"'/'"@$NEW_DIGEST"'/g' kubeless-rbac.yaml > kubeless-rbac-${TRAVIS_TAG}.yaml
      sed 's/'":${CONTROLLER_TAG}"'/'"@$NEW_DIGEST"'/g' kubeless-openshift.yaml > kubeless-openshift-${TRAVIS_TAG}.yaml<commit_msg>add kafka-zookeeper-.yaml to release (#592)<commit_after>sudo: required
dist: trusty
group: deprecated-2017Q4
language: go

os:
  - linux

go:
  - 1.8.7

go_import_path: github.com/kubeless/kubeless

services:
  - docker
env:
  matrix:
    - TEST_TARGET=unit
    - TEST_TARGET=minikube
    - TEST_TARGET=minikube_kafka
    - TEST_TARGET=GKE
  global:
    - CONTROLLER_IMAGE_NAME=bitnami/kubeless-controller
    - CONTROLLER_TAG=${TRAVIS_TAG:-build-$TRAVIS_BUILD_ID}
    - CONTROLLER_IMAGE=${CONTROLLER_IMAGE_NAME}:${CONTROLLER_TAG}
    - CGO_ENABLED=0
    - TEST_DEBUG=1
    - GKE_VERSION=1.7.11-gke.1
    - secure: <KEY>
    - secure: <KEY>
    - secure: <KEY>
    - secure: <KEY>
    - secure: <KEY>
    - secure: tywTqujLrvN0xzjawWvNniav1c/FNcgI+A+u2IdbPxb4yeO5k2Sc71nN2kHYCdD1o3K8ehAUTPF4DlNiEWGlfMhqofciSDEsSUXKz39ndZng7RXIJU9u8PGFhGSHwoZOPvVTTABT8Fa+i+omgdUsQkJOAghw1AZUD+W0Tp88J/PEZcWLd0WuslKPAioUEsNqftPT7kWVc+4BoGnZ2ZejlKsNwYnGNPCIVoE7eMa1MQM6UqsMfTzln8dQO8Ab0qVNEcm5tkwDlYoEl4kF6smV/GpnUJvMnXJycTnCr9XB7/t4Hxr1GJlQm6dumsweXTFoZTXDZtCsRtXbaFrFg+pqRRs+9BqOIDFXO1PFLrf1eryaztiErysdr66LR4/9pS1IZ8I2wJGh3bXEWDSY4clc0syusuXOKSlNDHQsWbPMC2IDNygQr/DigQmtYrwLpdiiUsF1XPHMyQKGmop6ewTYzd7DrJWwDGPrkW2YIJQgvxpkX58/dKNp4BZQY5wuXKQLvUQjFOa3gelfsbFFuhQEEbcIfINBI9TuM5K0Q+HXPdlfef/0Cbp6pktIEUYErK46mf2iy+1phXDZ0UPz/ZXe2NmawEPQVMBJaCIkr/B75mn5p7oGSKdJ3NpN87Bbn+Pwpx3tKpuDpc9hOjlfAGo+dcU6BAYkcwUSBGInjUsRNf4=
before_install:
  - set -e
  # Decide if we should run the tests
  - |
    case $TEST_TARGET in
    # We will always build assets when doing unit tests or minikube end-2-end tests
    unit|minikube)
      export SHOULD_TEST=1
      ;;
    # In case of GKE we will only want to build if it is
    # a build of a branch in the kubeless/kubeless repository
    GKE)
      if [[ -n "$GKE_ADMIN" && "$TRAVIS_EVENT_TYPE" != "pull_request" ]]; then
        export SHOULD_TEST=1
        export SHOULD_INSTALL_GCLOUD=1
      fi
      ;;
    # In kase of minikube+kafka we want to test it if
    # it is a Pull Request related to Kafka (discovered from the PR title)
    # or if the build is from the "master" branch
    minikube_kafka)
      if [[ "$TRAVIS_PULL_REQUEST" != false ]]; then
        pr_kafka_title=$(curl "https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/${TRAVIS_PULL_REQUEST}" | grep title || true)
      fi
      if [[ "$TRAVIS_PULL_REQUEST" == false || "$pr_kafka_title" == "" || "$pr_kafka_title" =~ ^.*(Kafka|kafka|KAFKA).*$ ]]; then
        export SHOULD_TEST=1
      fi
      ;;
    esac
install:
  - |
    if [[ "$SHOULD_TEST" == "1" ]]; then
      make bootstrap
    fi
    if [[ "$SHOULD_INSTALL_GCLOUD" == "1" ]]; then
      export GOOGLE_APPLICATION_CREDENTIALS=$TRAVIS_BUILD_DIR/client_secrets.json
      openssl aes-256-cbc -K $encrypted_1dbafa65b3ad_key -iv $encrypted_1dbafa65b3ad_iv -in .github/gcloud.json.enc -out $GOOGLE_APPLICATION_CREDENTIALS -d
      if [ ! -d $HOME/gcloud/google-cloud-sdk ]; then
        mkdir -p $HOME/gcloud &&
        wget -q https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-187.0.0-linux-x86_64.tar.gz --directory-prefix=$HOME/gcloud &&
        cd $HOME/gcloud &&
        tar xzf google-cloud-sdk-187.0.0-linux-x86_64.tar.gz &&
        printf '\ny\n\ny\ny\n' | ./google-cloud-sdk/install.sh &&
        cd $TRAVIS_BUILD_DIR;
      fi
      gcloud -q config set project $GKE_PROJECT
      if [ -a $GOOGLE_APPLICATION_CREDENTIALS ]; then
        gcloud -q auth activate-service-account --key-file $GOOGLE_APPLICATION_CREDENTIALS;
      fi
      echo "Starting GKE cluster"
      ./script/start-gke-env.sh $GKE_CLUSTER $ZONE $GKE_VERSION $GKE_ADMIN > $TRAVIS_BUILD_DIR/gke-start.log 2>&1 &
      GKE_START_PID=$!
    fi

script:
  - |
    if [[ "$SHOULD_TEST" == "1" ]]; then
      make VERSION=${TRAVIS_TAG:-build-$TRAVIS_BUILD_ID} binary
      make controller-image CONTROLLER_IMAGE=$CONTROLLER_IMAGE
      make all-yaml
      sed -i.bak 's/'":latest"'/'":${CONTROLLER_TAG}"'/g' kubeless.yaml
      sed -i.bak 's/'":latest"'/'":${CONTROLLER_TAG}"'/g' kubeless-rbac.yaml
      sed -i.bak 's/'":latest"'/'":${CONTROLLER_TAG}"'/g' kubeless-openshift.yaml
      case $TEST_TARGET in
      unit)
        make test
        make validation
        ;;
      minikube)
        ./script/integration-tests minikube deployment
        ./script/integration-tests minikube basic
        ;;
      minikube_kafka)
        ./script/integration-tests minikube deployment
        ./script/integration-tests minikube kafka
        ;;
      GKE)
        docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
        docker push $CONTROLLER_IMAGE
        echo "Waiting for the GKE cluster to be ready"
        tail -f $TRAVIS_BUILD_DIR/gke-start.log &
        wait $GKE_START_PID
        if ! kubectl get pods -n kubeless 2>&1 | grep -q "No resources found"; then
          echo "Waiting for a previous installation to be cleaned"
          bash -c 'grep -q "No resources found" <(timeout 60 kubectl get pods -n kubeless -w 2>&1)'
        fi
        ./script/integration-tests gke_${GKE_PROJECT}_${ZONE}_${GKE_CLUSTER}
        ;;
      esac
    else
      echo "Skipping tests"
    fi

after_success:
  - |
    if [[ "$TRAVIS_BRANCH" == master && \
          "$TRAVIS_PULL_REQUEST" == false ]]; then
      docker login -u="$DOCKER_USERNAME" -p="$<PASSWORD>"
      docker tag $CONTROLLER_IMAGE ${CONTROLLER_IMAGE_NAME}:latest
      docker push ${CONTROLLER_IMAGE_NAME}:latest
    fi

before_deploy:
  - |
    if [[ "$SHOULD_TEST" != "1" ]]; then
      echo "Unable to release a job that has not been tested!"
      return 1
    fi
  - |
    if [ "$TEST_TARGET" = minikube ]; then
      make VERSION=${TRAVIS_TAG:-build-$TRAVIS_BUILD_ID} binary-cross
      for d in bundles/kubeless_*; do zip -r9 $d.zip $d/; done
      docker login -u="$DOCKER_USERNAME" -p="$<PASSWORD>"
      docker tag $CONTROLLER_IMAGE ${CONTROLLER_IMAGE_NAME}:latest
      docker push $CONTROLLER_IMAGE
      NEW_DIGEST=$(./script/find_digest.sh  ${CONTROLLER_IMAGE_NAME} ${TRAVIS_TAG} | cut -d " " -f 2)
      sed 's/'":${CONTROLLER_TAG}"'/'"@$NEW_DIGEST"'/g' kubeless.yaml > kubeless-${TRAVIS_TAG}.yaml
      sed 's/'":${CONTROLLER_TAG}"'/'"@$NEW_DIGEST"'/g' kubeless-rbac.yaml > kubeless-rbac-${TRAVIS_TAG}.yaml
      sed 's/'":${CONTROLLER_TAG}"'/'"@$NEW_DIGEST"'/g' kubeless-openshift.yaml > kubeless-openshift-${TRAVIS_TAG}.yaml
      cp kafka-zookeeper.yaml kafka-zookeeper-${TRAVIS_TAG}.yaml
{'fraction_non_alphanumeric': 0.12254978830170926, 'fraction_numerical': 0.02375725262662694, 'mean_word_length': 3.156076898012382, 'pattern_counts': {'":': 18, '<': 20, '<?xml version=': 0, '>': 32, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3127547', 'n_tokens_mistral': 5488, 'n_tokens_neox': 5187, 'n_words': 877}