<commit_before>version: 2
jobs:
  deploy:
    docker:
      # Upgrade the Dockerfile and push image when the hub az cluster tiller
      # version upgrades.
      - image: quay.io/helmpack/kubectl-helm-az:0.1.0
        # Don't automatically upgrade the Hub monocular chart version for each
        # new helm/monocular release. Instead assume we'll need testing, and
        # set the version manually here.
        environment:
          CHART_VERSION: 1.4.4
    steps:
      - run:
          name: Authenticate to cluster
          command: |
            az login --service-principal -u $SERVICE_PRINCIPAL_ID -p $SERVICE_PRINCIPAL_PASS -t $SERVICE_TENANT_ID
            az aks get-credentials -n $CLUSTER_NAME -g $RESOURCE_GROUP
      - checkout
      - run:
          name: Upgrade/install Monocular Helm chart with any Hub changed values
          command: |
            export MONGODB_ROOT_PASSWORD=$(kubectl get secret --namespace helm-hub helm-hub-mongodb -o jsonpath="{.data.mongodb-root-password}" | base64 -d)
            helm init --client-only
            helm repo add monocular https://helm.github.io/monocular
            helm repo update
            helm upgrade --install helm-hub monocular/monocular --version $CHART_VERSION --namespace helm-hub --set mongodb.mongodbRootPassword=$MONGODB_ROOT_PASSWORD -f config/helm-hub-values.yaml -f config/repo-values.yaml

workflows:
  version: 2
  merge-master:
    jobs:
      - deploy:
          filters:
            branches:
              only: master<commit_msg>Only upgrade Hub if config file changes are pushed to master<commit_after>version: 2
jobs:
  deploy:
    docker:
      # Upgrade the Dockerfile and push image when the hub az cluster tiller
      # version upgrades.
      - image: quay.io/helmpack/kubectl-helm-az:0.1.0
        # Don't automatically upgrade the Hub monocular chart version for each
        # new helm/monocular release. Instead assume we'll need testing, and
        # set the version manually here.
        environment:
          CHART_VERSION: 1.4.4
    steps:
      - run:
          name: Authenticate to cluster
          shell: /bin/sh -eo pipefail
          command: |
            az login --service-principal -u $SERVICE_PRINCIPAL_ID -p $SERVICE_PRINCIPAL_PASS -t $SERVICE_TENANT_ID
            az aks get-credentials -n $CLUSTER_NAME -g $RESOURCE_GROUP
      - checkout
      - compare-url/reconstruct
      - run:
          name: Upgrade/install Monocular Helm chart with any Hub changed values
          shell: /bin/sh -eo pipefail
          command: |
            CIRCLE_COMPARE_URL=$(cat CIRCLE_COMPARE_URL.txt)
            COMMIT_RANGE=$(echo $CIRCLE_COMPARE_URL | sed 's:^.*/compare/::g')
            echo "Commit range: $COMMIT_RANGE"

            for config in config/helm-hub-values.yaml config/repo-values.yaml repos.yaml; do
              if [[ $(git diff $COMMIT_RANGE --name-status | grep "$config") ]]; then
                export CONFIG_UPDATED="$config $CONFIG_UPDATED"
              fi
            done

            if [ -n "$CONFIG_UPDATED" ]; then
              echo "Config changes detected: $CONFIG_UPDATED"
              export MONGODB_ROOT_PASSWORD=$(kubectl get secret --namespace helm-hub helm-hub-mongodb -o jsonpath="{.data.mongodb-root-password}" | base64 -d)
              helm init --client-only
              helm repo add monocular https://helm.github.io/monocular
              helm repo update
              helm upgrade --install helm-hub monocular/monocular --version $CHART_VERSION --namespace helm-hub --set mongodb.mongodbRootPassword=$<PASSWORD> -f config/helm-hub-values.yaml -f config/repo-values.yaml
            else
              echo "No upgrade necessary. No config changes detected"
            fi

orbs:
  compare-url: iynere/compare-url@0.4.10
version: 2.1
workflows:
  version: 2
  merge-master:
    jobs:
      - deploy:
          filters:
            branches:
              only: master
{'fraction_non_alphanumeric': 0.08629441624365482, 'fraction_numerical': 0.006598984771573604, 'mean_word_length': 2.100708103855232, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 2, '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': '7421257', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1142, 'n_words': 334}