<commit_before>---
- name: Install dependencies
  yum:
    name: '{{ item }}'
    state: present
  when: ansible_user_id != k8s_ssh_user
  with_items:
    - socat

- name: Check kubernetes directories
  file:
    path: '{{ item }}'
    state: directory
    mode: 0755
  when: ansible_user_id != k8s_ssh_user
  with_items:
    - '{{ k8s_policy_dir }}'

- name: Check kubernetes config directories
  file:
    path: '{{ item }}'
    state: directory
    mode: 0755
  with_items:
    - '{{ ansible_env.HOME }}/.kube'
    - '{{ ansible_env.HOME }}/.docker'

- name: Default docker auth
  template:
    src: docker-config.json.j2
    dest: "{{ ansible_env.HOME }}/.docker/config.json"

- name: Get kubectl
  get_url:
    url: 'https://storage.googleapis.com/kubernetes-release/release/v{{ k8s_version }}/bin/{{ ansible_system|lower }}/amd64/kubectl'
    dest: '{{ k8s_bin_dir }}/kubectl'
    mode: 0755
    force: yes
  when: ansible_user_id != k8s_ssh_user

- name: Default policy config
  template:
    src: kubeconfig.j2
    dest: "{{ ansible_env.HOME }}/.kube/config"

- name: Get helm
  unarchive:
    src: 'https://kubernetes-helm.storage.googleapis.com/helm-v{{ helm_version }}-{{ ansible_system|lower }}-amd64.tar.gz'
    dest: '{{ tmp_dir }}'
    remote_src: true
  when: ansible_user_id != k8s_ssh_user

- name: Setup helm
  copy:
    src: '{{ tmp_dir }}/{{ ansible_system|lower }}-amd64/helm'
    dest: '{{ k8s_bin_dir }}/helm'
    mode: 0755
    remote_src: true
  when: ansible_user_id != k8s_ssh_user

- name: Init helm
  command: helm init --client-only

- name: Get Golang
  unarchive:
    src: 'https://storage.googleapis.com/golang/go{{ go_version }}.{{ ansible_system|lower }}-amd64.tar.gz'
    dest: '{{ go_dir }}'
    remote_src: true
  when: ansible_user_id != k8s_ssh_user

- name: Setup custom GOPATH
  file:
    path: '{{ item }}'
    state: directory
    mode: 0755
  with_items:
    - '{{ ansible_env.HOME }}/{{ go_path }}/src'
    - '{{ ansible_env.HOME }}/{{ go_path }}/pkg'
    - '{{ ansible_env.HOME }}/{{ go_path }}/bin'

- name: register Go environment
  lineinfile:
    dest: '{{ ansible_env.HOME }}/.bash_profile'
    line: 'export GOPATH=$HOME/{{ go_path }}'

- name: register PATH environment
  lineinfile:
    dest: '{{ ansible_env.HOME }}/.bash_profile'
    line: 'export PATH=$PATH:{{ go_dir }}/go/bin:$GOPATH/bin'

- name: Setup golint utility
  shell: >
    go get -u github.com/golang/lint/golint
  environment:
    GOPATH: '{{ ansible_env.HOME }}/{{ go_path }}'
    PATH: $PATH:/usr/bin:{{ go_dir }}/go/bin

- name: get charts repository
  git: 
    repo: 'https://{{ k8s_charts_repo }}'
    dest: '{{ ansible_env.HOME }}/{{ go_path }}/src/{{ k8s_charts_repo }}'
  when: ansible_user_id != k8s_ssh_user

- name: test charts
  command: make test
  args:
    chdir: '{{ ansible_env.HOME }}/{{ go_path }}/src/{{ k8s_charts_repo }}'
  environment:
    GOPATH: '{{ ansible_env.HOME }}/{{ go_path }}'
    PATH: $PATH:/usr/bin:{{ go_dir }}/go/bin:{{ ansible_env.HOME }}/{{ go_path }}/bin
  when: ansible_user_id != k8s_ssh_user

- name: deploy charts
  shell: >
    helm upgrade charts {{ ansible_env.HOME }}/{{ go_path }}/src/{{ k8s_charts_repo }}/charts -i --wait
  args:
    chdir: '{{ ansible_env.HOME }}/{{ go_path }}/src/{{ k8s_charts_repo }}'
  environment:
    GOPATH: '{{ ansible_env.HOME }}/{{ go_path }}'
    PATH: $PATH:/usr/bin:{{ go_dir }}/go/bin:{{ ansible_env.HOME }}/{{ go_path }}/bin
  when: ansible_user_id != k8s_ssh_user

- name: get CICD integraton services
  git: 
    repo: 'https://github.com/k8s-community/{{ item }}'
    dest: '{{ ansible_env.HOME }}/{{ go_path }}/src/github.com/k8s-community/{{ item }}'
  when: ansible_user_id != k8s_ssh_user
  with_items: '{{ k8s_cicd_services }}'

# TODO: uncomment it when tests will be exist
# - name: test CICD integraton services
#   command: make test
#   args:
#     chdir: '{{ ansible_env.HOME }}/{{ go_path }}/src/github.com/k8s-community/{{ item }}'
#   environment:
#     GOPATH: '{{ ansible_env.HOME }}/{{ go_path }}'
#     PATH: $PATH:/usr/bin:{{ go_dir }}/go/bin:{{ ansible_env.HOME }}/{{ go_path }}/bin
#   when: ansible_user_id != k8s_ssh_user
#   with_items: '{{ k8s_cicd_services }}'

- name: deploy CICD integraton services
  shell: >
    NAMESPACE=default make deploy
  args:
    chdir: '{{ ansible_env.HOME }}/{{ go_path }}/src/github.com/k8s-community/{{ item }}'
  environment:
    GOPATH: '{{ ansible_env.HOME }}/{{ go_path }}'
    PATH: $PATH:/usr/bin:{{ go_dir }}/go/bin:{{ ansible_env.HOME }}/{{ go_path }}/bin
  when: ansible_user_id != k8s_ssh_user
  with_items: '{{ k8s_cicd_services }}'<commit_msg>Added cicd deployment<commit_after>---
- name: Install dependencies
  yum:
    name: '{{ item }}'
    state: present
  when: ansible_user_id != k8s_ssh_user
  with_items:
    - socat

- name: Check kubernetes directories
  file:
    path: '{{ item }}'
    state: directory
    mode: 0755
  when: ansible_user_id != k8s_ssh_user
  with_items:
    - '{{ k8s_policy_dir }}'

- name: Check kubernetes config directories
  file:
    path: '{{ item }}'
    state: directory
    mode: 0755
  with_items:
    - '{{ ansible_env.HOME }}/.kube'
    - '{{ ansible_env.HOME }}/.docker'

- name: Default docker auth
  template:
    src: docker-config.json.j2
    dest: "{{ ansible_env.HOME }}/.docker/config.json"

- name: Get kubectl
  get_url:
    url: 'https://storage.googleapis.com/kubernetes-release/release/v{{ k8s_version }}/bin/{{ ansible_system|lower }}/amd64/kubectl'
    dest: '{{ k8s_bin_dir }}/kubectl'
    mode: 0755
    force: yes
  when: ansible_user_id != k8s_ssh_user

- name: Default policy config
  template:
    src: kubeconfig.j2
    dest: "{{ ansible_env.HOME }}/.kube/config"

- name: Get helm
  unarchive:
    src: 'https://kubernetes-helm.storage.googleapis.com/helm-v{{ helm_version }}-{{ ansible_system|lower }}-amd64.tar.gz'
    dest: '{{ tmp_dir }}'
    remote_src: true
  when: ansible_user_id != k8s_ssh_user

- name: Setup helm
  copy:
    src: '{{ tmp_dir }}/{{ ansible_system|lower }}-amd64/helm'
    dest: '{{ k8s_bin_dir }}/helm'
    mode: 0755
    remote_src: true
  when: ansible_user_id != k8s_ssh_user

- name: Init helm
  command: helm init --client-only

- name: Get Golang
  unarchive:
    src: 'https://storage.googleapis.com/golang/go{{ go_version }}.{{ ansible_system|lower }}-amd64.tar.gz'
    dest: '{{ go_dir }}'
    remote_src: true
  when: ansible_user_id != k8s_ssh_user

- name: Setup custom GOPATH
  file:
    path: '{{ item }}'
    state: directory
    mode: 0755
  with_items:
    - '{{ ansible_env.HOME }}/{{ go_path }}/src'
    - '{{ ansible_env.HOME }}/{{ go_path }}/pkg'
    - '{{ ansible_env.HOME }}/{{ go_path }}/bin'

- name: register Go environment
  lineinfile:
    dest: '{{ ansible_env.HOME }}/.bash_profile'
    line: 'export GOPATH=$HOME/{{ go_path }}'

- name: register PATH environment
  lineinfile:
    dest: '{{ ansible_env.HOME }}/.bash_profile'
    line: 'export PATH=$PATH:{{ go_dir }}/go/bin:$GOPATH/bin'

- name: Setup golint utility
  shell: >
    go get -u github.com/golang/lint/golint
  environment:
    GOPATH: '{{ ansible_env.HOME }}/{{ go_path }}'
    PATH: $PATH:/usr/bin:{{ go_dir }}/go/bin

- name: get charts repository
  git: 
    repo: 'https://{{ k8s_charts_repo }}'
    dest: '{{ ansible_env.HOME }}/{{ go_path }}/src/{{ k8s_charts_repo }}'
    force: yes
  when: ansible_user_id != k8s_ssh_user

- name: test charts
  command: make test
  args:
    chdir: '{{ ansible_env.HOME }}/{{ go_path }}/src/{{ k8s_charts_repo }}'
  environment:
    GOPATH: '{{ ansible_env.HOME }}/{{ go_path }}'
    PATH: $PATH:/usr/bin:{{ go_dir }}/go/bin:{{ ansible_env.HOME }}/{{ go_path }}/bin
  when: ansible_user_id != k8s_ssh_user

- name: deploy charts
  shell: >
    helm upgrade charts {{ ansible_env.HOME }}/{{ go_path }}/src/{{ k8s_charts_repo }}/charts -i --wait
  args:
    chdir: '{{ ansible_env.HOME }}/{{ go_path }}/src/{{ k8s_charts_repo }}'
  environment:
    GOPATH: '{{ ansible_env.HOME }}/{{ go_path }}'
    PATH: $PATH:/usr/bin:{{ go_dir }}/go/bin:{{ ansible_env.HOME }}/{{ go_path }}/bin
  when: ansible_user_id != k8s_ssh_user

- name: get CICD integraton services
  git: 
    repo: 'https://github.com/k8s-community/{{ item }}'
    dest: '{{ ansible_env.HOME }}/{{ go_path }}/src/github.com/k8s-community/{{ item }}'
    force: yes
  when: ansible_user_id != k8s_ssh_user
  with_items: '{{ k8s_cicd_services }}'

# TODO: uncomment it when tests will be exist
# - name: test CICD integraton services
#   command: make test
#   args:
#     chdir: '{{ ansible_env.HOME }}/{{ go_path }}/src/github.com/k8s-community/{{ item }}'
#   environment:
#     GOPATH: '{{ ansible_env.HOME }}/{{ go_path }}'
#     PATH: $PATH:/usr/bin:{{ go_dir }}/go/bin:{{ ansible_env.HOME }}/{{ go_path }}/bin
#   when: ansible_user_id != k8s_ssh_user
#   with_items: '{{ k8s_cicd_services }}'

- name: deploy CICD integraton services
  shell: >
    NAMESPACE=default make deploy
  args:
    chdir: '{{ ansible_env.HOME }}/{{ go_path }}/src/github.com/k8s-community/{{ item }}'
  environment:
    GOPATH: '{{ ansible_env.HOME }}/{{ go_path }}'
    PATH: $PATH:/usr/bin:{{ go_dir }}/go/bin:{{ ansible_env.HOME }}/{{ go_path }}/bin
  when: ansible_user_id != k8s_ssh_user
  with_items: '{{ k8s_cicd_services }}'

- name: get CICD service
  git: 
    repo: 'https://{{ k8s_cicd_repo }}'
    dest: '{{ ansible_env.HOME }}/{{ go_path }}/src/{{ k8s_cicd_repo }}'
    force: yes
  when: ansible_user_id != k8s_ssh_user

# TODO: uncomment it when tests will be exist
# - name: test CICD service
#   command: make test
#   args:
#     chdir: '{{ ansible_env.HOME }}/{{ go_path }}/src/{{ k8s_cicd_repo }}'
#   environment:
#     GOPATH: '{{ ansible_env.HOME }}/{{ go_path }}'
#     PATH: $PATH:/usr/bin:{{ go_dir }}/go/bin:{{ ansible_env.HOME }}/{{ go_path }}/bin
#   when: ansible_user_id != k8s_ssh_user

- name: Stop CICD service
  shell: >
    make stop >/dev/null 2>&1 || true
  args:
    chdir: '{{ ansible_env.HOME }}/{{ go_path }}/src/{{ k8s_cicd_repo }}'
  environment:
    GOPATH: '{{ ansible_env.HOME }}/{{ go_path }}'
    PATH: $PATH:/usr/bin:{{ go_dir }}/go/bin:{{ ansible_env.HOME }}/{{ go_path }}/bin
  when: ansible_user_id != k8s_ssh_user

- name: Remove CICD service
  shell: >
    make remove >/dev/null 2>&1 || true
  args:
    chdir: '{{ ansible_env.HOME }}/{{ go_path }}/src/{{ k8s_cicd_repo }}'
  environment:
    GOPATH: '{{ ansible_env.HOME }}/{{ go_path }}'
    PATH: $PATH:/usr/bin:{{ go_dir }}/go/bin:{{ ansible_env.HOME }}/{{ go_path }}/bin
  when: ansible_user_id != k8s_ssh_user

- name: install CICD service
  command: make install
  args:
    chdir: '{{ ansible_env.HOME }}/{{ go_path }}/src/{{ k8s_cicd_repo }}'
  environment:
    GOPATH: '{{ ansible_env.HOME }}/{{ go_path }}'
    PATH: $PATH:/usr/bin:{{ go_dir }}/go/bin:{{ ansible_env.HOME }}/{{ go_path }}/bin
  when: ansible_user_id != k8s_ssh_user

- name: start CICD service
  command: make start
  args:
    chdir: '{{ ansible_env.HOME }}/{{ go_path }}/src/{{ k8s_cicd_repo }}'
  environment:
    GOPATH: '{{ ansible_env.HOME }}/{{ go_path }}'
    PATH: $PATH:/usr/bin:{{ go_dir }}/go/bin:{{ ansible_env.HOME }}/{{ go_path }}/bin
  when: ansible_user_id != k8s_ssh_user
{'fraction_non_alphanumeric': 0.17752849002849003, 'fraction_numerical': 0.011841168091168091, 'mean_word_length': 3.31706379707917, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 11, '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': '5870109', 'n_tokens_mistral': 4626, 'n_tokens_neox': 4416, 'n_words': 915}