30 lines
1.8 KiB
YAML
30 lines
1.8 KiB
YAML
- name: Promote Chart
|
|
block:
|
|
- name: Install Plugin
|
|
shell: helm plugin update push || helm plugin install https://github.com/chartmuseum/helm-push || true
|
|
- name: Get harbor username
|
|
shell: cat {{ harbor_secret_mounted_path }}/username
|
|
register: harbor_username
|
|
- name: Get harbor password
|
|
shell: cat {{ harbor_secret_mounted_path }}/password
|
|
register: harbor_password
|
|
- name: Install Plugin
|
|
shell: helm plugin update push || helm plugin install https://github.com/chartmuseum/helm-push
|
|
- name: Add Harbor Helm repository and Test repository
|
|
shell: helm repo add "{{ chart_repository }}-staging" "https://{{ chart_registry_url }}/{{ chart_name }}-staging" --username="{{ harbor_username.stdout }}" --password="{{ harbor_password.stdout }}" && helm repo add "{{ chart_repository }}" "https://{{ chart_registry_url }}/{{ chart_name }}" --username="{{ harbor_username.stdout }}" --password="{{ harbor_password.stdout }}"
|
|
- name: Pull down Helm Chart
|
|
shell: helm pull "{{ chart_repository }}-staging/{{ chart_name }}" --version="{{ version }}"
|
|
- name: Push chart "{{ chart_name }}" to Helm registry
|
|
command: helm push "{{ chart_name }}-{{ version }}".tgz "{{ chart_repository }}"
|
|
when: ( stage == "promote_chart")
|
|
become: true
|
|
- name: Promote Image
|
|
block:
|
|
- name: Pull image locally
|
|
shell: docker pull "{{ docker_registry }}/{{ project }}-staging/{{ repo }}:{{ tag }}"
|
|
- name: Tag image
|
|
shell: docker tag "{{ docker_registry }}/{{ project }}-staging/{{ repo }}:{{ tag }}" "{{ docker_registry }}/{{ project }}/{{ repo }}:{{ tag }}"
|
|
- name: Push to non-staging Harbor Project
|
|
shell: docker push "{{ docker_registry }}/{{ project }}/{{ repo }}:{{ tag }}"
|
|
when: ( stage == "promote_image")
|