Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Arendt committed Sep 25, 2020
1 parent bfe50e0 commit c67687f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
8 changes: 7 additions & 1 deletion core/src/epicli/data/common/ansible/playbooks/helm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@
- role: helm
when:
- groups.helm is defined
- groups.helm | length > 0
- groups.helm | length > 0
environment:
# The "inventory_dir" fact cannot be used here.
# Documentation (https://docs.ansible.com/ansible/latest/inventory/implicit_localhost.html) states:
# - The inventory_file and inventory_dir magic variables are not available for the implicit localhost as they are dependent on each inventory host.
# TODO: https://github.com/epiphany-platform/epiphany/issues/1650
KUBECONFIG: "{{ vault_location }}/../kubeconfig"
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@

always:
- name: Clean up temporary Helm chart values file
delegate_to: localhost
file:
state: absent
path: /tmp/{{ helm_chart_name }}_values.yaml

block:
- name: Upgrade/install Helm chart
delegate_to: localhost
environment:
KUBECONFIG: "{{ vault_location }}/../kubeconfig"

# IF `disable_helm_chart`
- when: disable_helm_chart_bool
block:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,24 @@
or helm_repo_list.rc > 1

- name: Get Helm charts list from repo before update
command: helm search repo {{ helm_chart_repo_name }} --output json | jq -r '.[].name'
shell: helm search repo {{ helm_chart_repo_name }} --output json | jq -r '.[].name'
register: helm_charts_list_before_update
failed_when: (helm_charts_list_before_update.rc != 0 and not 'no repositories' in helm_charts_list_before_update.stderr)
or helm_charts_list_before_update.rc > 1

- name: "Add {{ helm_chart_repo_name }} Helm repository from url http://localhost/epirepo"
command: helm repo add {{ helm_chart_repo_name }} http://localhost/epirepo/helm-charts/system
shell: helm repo add {{ helm_chart_repo_name }} http://localhost/epirepo/helm-charts/system
when: helm_chart_repo_name not in helm_repo_list.stdout

- name: Update Helm repo
command: helm repo update
shell: helm repo update

- name: Get Helm charts list from repo after update
command: helm search repo {{ helm_chart_repo_name }} --output json | jq -r '.[].name'
shell: helm search repo {{ helm_chart_repo_name }} --output json | jq -r '.[].name'
register: helm_charts_list_after_update

- name: Delete Helm charts not present in repository
command: helm delete {{ chart_subname }} --purge
shell: helm delete {{ chart_subname }} --purge
vars:
chart_subname: "{{ item.split('/')[1] }}"
loop: "{{ helm_charts_list_before_update.stdout_lines }}"
Expand Down

0 comments on commit c67687f

Please sign in to comment.