<commit_before>version: 2

# VM environment. Includes docker.
integrationDefaults: &integrationDefaults
  machine: true
  environment:
    - CHANGE_MINIKUBE_NONE_USER: true

# Environment:
#  by default runs in /home/circleci/project, and checkout is in current directory
#  ID is circleci(3434)

jobs:
  # TODO: add encrypted creds for real clusters, push to real clusters
  # TODO: add a Makefile to automate
  build:
    docker:
      - image: istio/ci:go1.11-k8s1.10.4-helm2.7.2-minikube0.25
        environment:
          GOPATH: /home/circleci/project/go
          KUBECONFIG: /home/circleci/project/.circleci/config

    # Can run multiple images, first is primary, all use localhost
    #resource_class: xlarge
    steps:
      - checkout
      - setup_remote_docker:
      #    docker_layer_caching: true
      - run:
          name: main
          command: |
            pwd
            id
            env
            mkdir -p out/tests
            echo "Hello" > out/tests/hello
            go get -u sigs.k8s.io/kind
            $GOPATH/bin/kind create cluster

            # Option 1: use the kind docker to install stuff.
            # We can copy our installer in the kind cluster
            docker cp $HOME/project kind-control-plane:/
            cat  $HOME/.kube/kind-config-kind | sed s/localhost:.*/localhost:6443/ > $HOME/.kube/config
            docker cp $HOME/.kube/config kind-control-plane:/

            # TODO: we can exec into the kind cluster and run 'stuff', but we don't have helm.
            # Will need to run a pod - so need to create a pod with the installer and helm and kubectl

            # TODO: for multi-cluster, we can create a second kind
            # docker run --volumes-from configs --network container:kind-control-plane istio/ci:go1.11-k8s1.10.4-helm2.7.2-minikube0.25 make control

            # TODO: option 3 is to run DIND as the main image - this is likely the fastest

      - store_test_results:
          path: out/tests
      - store_artifacts:
          path: out/tests

  install-minikube:
    <<: *integrationDefaults
    environment:
            - KUBECONFIG: /go/out/minikube.conf
            - TEST_ENV: minikube-none
            - GOPATH: /go
    steps:
      - checkout
      - run: bin/testEnvRootMinikube.sh start
      - run: bin/testEnvRootMinikube.sh wait
      - run:
          command: |
            source bin/env.sh
            iop_istio
      - run: docker images

  machine-kind:
    <<: *integrationDefaults
    environment:
      - TEST_ENV: minikube-none
      - GOPATH: /go
    steps:
      - checkout
      - run:
          command: |
            go get -u sigs.k8s.io/kind
            $GOPATH/bin/kind create cluster
            source bin/env.sh
            iop_istio
      - run: docker images


workflows:
  version: 2
  nightly:
    triggers:
       - schedule:
           cron: "0 0 * * *"<commit_msg>Attempt to use edge, maybe it has more recent golang<commit_after>version: 2

# VM environment. Includes docker.
integrationDefaults: &integrationDefaults
  machine: true
  environment:
    - CHANGE_MINIKUBE_NONE_USER: true

# Environment:
#  by default runs in /home/circleci/project, and checkout is in current directory
#  ID is circleci(3434)

jobs:
  # TODO: add encrypted creds for real clusters, push to real clusters
  # TODO: add a Makefile to automate
  build:
    docker:
      - image: istio/ci:go1.11-k8s1.10.4-helm2.7.2-minikube0.25
        environment:
          GOPATH: /home/circleci/project/go
          KUBECONFIG: /home/circleci/project/.circleci/config

    # Can run multiple images, first is primary, all use localhost
    #resource_class: xlarge
    steps:
      - checkout
      - setup_remote_docker:
      #    docker_layer_caching: true
      - run:
          name: main
          command: |
            pwd
            id
            env
            mkdir -p out/tests
            echo "Hello" > out/tests/hello
            go get -u sigs.k8s.io/kind
            $GOPATH/bin/kind create cluster

            # Option 1: use the kind docker to install stuff.
            # We can copy our installer in the kind cluster
            docker cp $HOME/project kind-control-plane:/
            cat  $HOME/.kube/kind-config-kind | sed s/localhost:.*/localhost:6443/ > $HOME/.kube/config
            docker cp $HOME/.kube/config kind-control-plane:/

            # TODO: we can exec into the kind cluster and run 'stuff', but we don't have helm.
            # Will need to run a pod - so need to create a pod with the installer and helm and kubectl

            # TODO: for multi-cluster, we can create a second kind
            # docker run --volumes-from configs --network container:kind-control-plane istio/ci:go1.11-k8s1.10.4-helm2.7.2-minikube0.25 make control

            # TODO: option 3 is to run DIND as the main image - this is likely the fastest

      - store_test_results:
          path: out/tests
      - store_artifacts:
          path: out/tests

  install-minikube:
    <<: *integrationDefaults
    environment:
            - KUBECONFIG: /go/out/minikube.conf
            - TEST_ENV: minikube-none
    steps:
      - checkout
      - run: bin/testEnvRootMinikube.sh start
      - run: bin/testEnvRootMinikube.sh wait
      - run:
          command: |
            source bin/env.sh
            iop_istio
      - run: docker images

  machine-kind:
    machine:
      enabled: true
      image: circleci/classic:edge
    environment:
      - TEST_ENV: minikube-none
    steps:
      - checkout
      - run:
          command: |
            go get -u sigs.k8s.io/kind
            $GOPATH/bin/kind create cluster
            source bin/env.sh
            iop_istio
      - run: docker images


workflows:
  version: 2
  nightly:
    triggers:
       - schedule:
           cron: "0 0 * * *"
{'fraction_non_alphanumeric': 0.08422138191818494, 'fraction_numerical': 0.015125472671020969, 'mean_word_length': 1.8138297872340425, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5859171', 'n_tokens_mistral': 1870, 'n_tokens_neox': 1748, 'n_words': 521}