
This patch set allows the ability to override the application image tag key so it takes in the correct image information during the deployment stage of Jarvis. This patch set rebases on [0] to leverage a multichart configmap paradigm rather than a single chart. [0] https://review.opendev.org/c/airship/charts/+/772135 Signed-off-by: Tin Lam <tin@irrational.io> Change-Id: Idbf76bf27460fdd49fa9acf0cd64fb440202c20f
58 lines
2.5 KiB
YAML
58 lines
2.5 KiB
YAML
- set_fact:
|
|
_async: "{{ chart_async | default(600) }}"
|
|
_delay: "{{ chart_check_status_delay | default(5) }}"
|
|
|
|
- name: Functional Deploy
|
|
when: ("{{ stage }}" == "deploy")
|
|
block:
|
|
#Deploy CNF
|
|
- name: Deploy charts
|
|
shell: |
|
|
set -xe ;
|
|
CHARTNAME={{ chart.chart_name }} ;
|
|
REPO={{ docker_registry }} ;
|
|
NAME={{ chart.project }}-staging/{{ chart.chart_name }} ;
|
|
|
|
jq -c --arg c $CHARTNAME --arg v $REPO 'map(if .repo == $c then .["tmp_repo"] = $v else . end)' {{ datapath }}/image.json | sponge {{ datapath }}/image.json ;
|
|
jq -c --arg c $CHARTNAME --arg v $NAME 'map(if .repo == $c then .["tmp_name"] = $v else . end)' {{ datapath }}/image.json | sponge {{ datapath }}/image.json ;
|
|
|
|
M=$(jq -c --arg c $CHARTNAME 'map(select(.chart_name == $c)) | first | .sources.image_map' {{ datapath }}/chart.json) ;
|
|
if [ "$M" != "null" ] && [ -n "$M" ] ; then \
|
|
echo $M | jq -r 'keys[]' | while IFS= read -r k; do \
|
|
v=$(echo $M | jq -c --arg k $k '.[$k]') ;\
|
|
filter=".$k" ;\
|
|
value=$(jq -c --arg c $CHARTNAME 'map(select(.image_name == $c)) | first' {{ datapath}}/image.json | jq -r $filter) ;\
|
|
jq -r --arg c $CHARTNAME --argjson k $v --arg v $value 'map(if .chart_name == $c then getpath($k) = $v else . end)' {{ datapath }}/chart.json | sponge {{ datapath }}/chart.json ;\
|
|
done ; \
|
|
fi ;
|
|
jq -c --arg c $CHARTNAME 'map(select(.chart_name == $c)) | first | .releases' \
|
|
{{ datapath }}/chart.json > {{ datapath }}/{{ chart.chart_name }}-overrides.json ;
|
|
cat {{ datapath }}/{{ chart.chart_name }}-overrides.json ;
|
|
helm upgrade --install \
|
|
--kubeconfig="{{ cluster_kubeconfig_path }}/kubeconfig" \
|
|
"{{ chart.release_name }}" "{{ chart.project }}-staging/{{ chart.chart_name }}" \
|
|
--version="{{ chart.version }}" \
|
|
--values="{{ datapath }}/{{ chart.chart_name }}-overrides.json" \
|
|
--namespace="{{ chart.namespace }}"
|
|
args:
|
|
executable: /bin/bash
|
|
loop: "{{ charts }}"
|
|
loop_control:
|
|
loop_var: "chart"
|
|
async: "{{ _async }}"
|
|
poll: 0
|
|
register: install_async_results
|
|
|
|
- name: Wait for helm install results
|
|
vars:
|
|
async_results: "{{ install_async_results }}"
|
|
include_tasks: ./roles/common/tasks/check_sync_status.yaml
|
|
become: true
|
|
|
|
- name: Functional Test
|
|
when: ( stage == "test")
|
|
block:
|
|
#Test Deployed CNF
|
|
- name: Chart currently has no Helm Tests, echo for now
|
|
shell: echo "There are no helm tests yet"
|