<commit_before>version: 0.2

env:
  variables:
    IMAGE_NAME: sso-dashboard
    DOCKER_REGISTRY: 320464205386.dkr.ecr.us-west-2.amazonaws.com

phases:
  install:
    commands:
      - apt update && apt install -y apt-transport-https curl
      - curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
      - echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list
      - apt update && apt install -y kubectl
      - curl -O https://storage.googleapis.com/kubernetes-helm/helm-v2.11.0-linux-amd64.tar.gz
      - tar zxf helm-v2.11.0-linux-amd64.tar.gz
      - mv linux-amd64/helm /usr/local/bin/
      - curl -O https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-07-26/bin/linux/amd64/aws-iam-authenticator
      - chmod +x aws-iam-authenticator
      - mv aws-iam-authenticator /usr/local/bin/
      - apt update && apt install -y python3-pip
      - pip3 install awscli
      - sed -i "s/--workers=5/--workers=1/" ./ansible/roles/dashboard/files/nginx/start.sh
  pre_build:
    commands:
      - export COMMIT_SHA=$CODEBUILD_RESOLVED_SOURCE_VERSION
      - export DEPLOY_ENV=$(echo $CODEBUILD_WEBHOOK_TRIGGER | sed -e 's/tag\/.*-\(.*\)/\1/' | sed -e 's/branch\/master/dev/' | sed -e 's/branch\/production/prod/')
      - if [ -z "$DEPLOY_ENV" ]; then export DEPLOY_ENV="dev"; fi
      - export MASTER=$(if [ "$CODEBUILD_WEBHOOK_TRIGGER" = "branch/master" ]; then echo 1; fi)
      - echo "running for ${COMMIT_SHA} in ${DEPLOY_ENV}"
      - aws eks update-kubeconfig --name $CLUSTER_NAME
      - aws ecr get-login --region us-west-2 --no-include-email | bash
      - git clone https://github.com/ansible/ansible-container.git
      - pip install -e ./ansible-container[docker]
  build:
    commands:
      - if [ -n "$MASTER" ]; then cd ansible && ansible-container build --with-volumes `echo $CODEBUILD_SRC_DIR`:/dashboard && cd ..; fi
      - if [ -n "$MASTER" ]; then docker tag ansible-web $DOCKER_REPO:$COMMIT_SHA; fi
      - if [ -n "$MASTER" ]; then docker push $DOCKER_REPO:$COMMIT_SHA; fi
  post_build:
    commands:
      - helm template -f k8s/values.yaml -f k8s/values/$DEPLOY_ENV.yaml --set registry=$DOCKER_REPO,namespace=sso-dashboard-$DEPLOY_ENV,rev=$COMMIT_SHA,assume_role=$ASSUME_ROLE_ARN k8s/ | kubectl apply -f -
<commit_msg>forces a build and push every time the job is triggered<commit_after>version: 0.2

env:
  variables:
    IMAGE_NAME: sso-dashboard
    DOCKER_REGISTRY: 320464205386.dkr.ecr.us-west-2.amazonaws.com

phases:
  install:
    commands:
      - apt update && apt install -y apt-transport-https curl
      - curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
      - echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list
      - apt update && apt install -y kubectl
      - curl -O https://storage.googleapis.com/kubernetes-helm/helm-v2.11.0-linux-amd64.tar.gz
      - tar zxf helm-v2.11.0-linux-amd64.tar.gz
      - mv linux-amd64/helm /usr/local/bin/
      - curl -O https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-07-26/bin/linux/amd64/aws-iam-authenticator
      - chmod +x aws-iam-authenticator
      - mv aws-iam-authenticator /usr/local/bin/
      - apt update && apt install -y python3-pip
      - pip3 install awscli
      - sed -i "s/--workers=5/--workers=1/" ./ansible/roles/dashboard/files/nginx/start.sh
  pre_build:
    commands:
      - export COMMIT_SHA=$CODEBUILD_RESOLVED_SOURCE_VERSION
      - export DEPLOY_ENV=$(echo $CODEBUILD_WEBHOOK_TRIGGER | sed -e 's/tag\/.*-\(.*\)/\1/' | sed -e 's/branch\/master/dev/' | sed -e 's/branch\/production/prod/')
      - if [ -z "$DEPLOY_ENV" ]; then export DEPLOY_ENV="dev"; fi
      - export MASTER=$(if [ "$CODEBUILD_WEBHOOK_TRIGGER" = "branch/master" ]; then echo 1; fi)
      - echo "running for ${COMMIT_SHA} in ${DEPLOY_ENV}"
      - aws eks update-kubeconfig --name $CLUSTER_NAME
      - aws ecr get-login --region us-west-2 --no-include-email | bash
      - git clone https://github.com/ansible/ansible-container.git
      - pip install -e ./ansible-container[docker]
  build:
    commands:
      - if [ -n "$MASTER" ]; then cd ansible && ansible-container build --with-volumes `echo $CODEBUILD_SRC_DIR`:/dashboard && cd ..; fi
      - if [ -n "$MASTER" ]; then docker tag ansible-web $DOCKER_REPO:$COMMIT_SHA; fi
      - if [ -n "$MASTER" ]; then docker push $DOCKER_REPO:$COMMIT_SHA; fi
      - cd ansible && ansible-container build --with-volumes `echo $CODEBUILD_SRC_DIR`:/dashboard && cd ..
      - docker tag ansible-web $DOCKER_REPO:$COMMIT_SHA
      - docker push $DOCKER_REPO:$COMMIT_SHA
  post_build:
    commands:
      - helm template -f k8s/values.yaml -f k8s/values/$DEPLOY_ENV.yaml --set registry=$DOCKER_REPO,namespace=sso-dashboard-$DEPLOY_ENV,rev=$COMMIT_SHA,assume_role=$ASSUME_ROLE_ARN k8s/ | kubectl apply -f -
{'fraction_non_alphanumeric': 0.15041726032973743, 'fraction_numerical': 0.022389578668837777, 'mean_word_length': 2.7227272727272727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, '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': '3694497', 'n_tokens_mistral': 1908, 'n_tokens_neox': 1818, 'n_words': 365}