diff --git a/tools/gate/jarvis/development-pipeline/templates/task-functional.yaml b/tools/gate/jarvis/development-pipeline/templates/task-functional.yaml index 977b4b8c..b0de53db 100644 --- a/tools/gate/jarvis/development-pipeline/templates/task-functional.yaml +++ b/tools/gate/jarvis/development-pipeline/templates/task-functional.yaml @@ -26,6 +26,9 @@ spec: image: {{ $.Values.tasks.functional.functionalTestImage }} script: | /jarvis/functional_test.sh + volumeMounts: + - mountPath: $(workspaces.development_pipeline_data.path)/config + name: kubeconfig volumes: - name: helm-publish-creds secret: diff --git a/tools/gate/jarvis/standard-container/assets/playbooks/roles/functional/tasks/functional-test.yaml b/tools/gate/jarvis/standard-container/assets/playbooks/roles/functional/tasks/functional-test.yaml index a2c58955..eda99028 100644 --- a/tools/gate/jarvis/standard-container/assets/playbooks/roles/functional/tasks/functional-test.yaml +++ b/tools/gate/jarvis/standard-container/assets/playbooks/roles/functional/tasks/functional-test.yaml @@ -1,4 +1,26 @@ +#Test pre-defined image tag +- name: test pre-defined image tag + shell: | + echo "Checking if pre-defined image tag is preserved during development pipeline run" ; + # The original image tag is what is in the deployment-flow configmap + ORIGINAL_TAG=$(kubectl get cm deployment-flow -o json | jq -r .'data'.'"image.json"' | jq -r .'[0]'.'tag') + # The actual image tag is the tag that is assigned during the development pipeline run and is ultimately + # what is used to tag the image in Harbor + ACTUAL_TAG=$(helm --kubeconfig /workspace/development_pipeline_data/config/kubeconfig ls -n mongodb -o json | jq -r .[0].app_version) + if [ "${ORIGINAL_TAG}" == "null" ] || [ "${ORIGINAL_TAG}" == "" ]; then + echo "Skipping as there is no pre-defined tag that should be used on the image" + else + if [ "${ACTUAL_TAG}" == "${ORIGINAL_TAG}" ]; then + echo "Actual tag: ${ACTUAL_TAG} matches expected tag: ${ORIGINAL_TAG}" + else + echo "Actual tag: ${ACTUAL_TAG} does NOT match expected tag: ${ORIGINAL_TAG}" + exit 1 + fi + fi + args: + executable: /bin/bash + #Test Deployed CNF - name: Chart has no Helm Tests, echo for now shell: echo "There are no helm tests yet" -# shell: echo 'helm test --kubeconfig="{{ cluster_kubeconfig_path }}/kubeconfig" "{{ name }}"' \ No newline at end of file +# shell: echo 'helm test --kubeconfig="{{ cluster_kubeconfig_path }}/kubeconfig" "{{ name }}"' diff --git a/tools/gate/jarvis/standard-container/assets/playbooks/roles/functional/tasks/main.yaml b/tools/gate/jarvis/standard-container/assets/playbooks/roles/functional/tasks/main.yaml index 98c2e8a1..3198a3c6 100644 --- a/tools/gate/jarvis/standard-container/assets/playbooks/roles/functional/tasks/main.yaml +++ b/tools/gate/jarvis/standard-container/assets/playbooks/roles/functional/tasks/main.yaml @@ -54,5 +54,5 @@ 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" + - name: Run tests + include_tasks: ./roles/functional/tasks/functional-test.yaml