Merge "Add test to validate on-merge"

This commit is contained in:
Zuul 2021-04-02 20:27:02 +00:00 committed by Gerrit Code Review
commit 02e90bc91f
4 changed files with 54 additions and 17 deletions

View File

@ -15,12 +15,12 @@ data:
"image_name": "mongodb-sharded", "image_name": "mongodb-sharded",
"project": "mongodb", "project": "mongodb",
"repo": "mongodb-sharded", "repo": "mongodb-sharded",
"tag": "4.4.3", "tag": "4.4.4",
"image_fullname": "mongodb/mongodb-sharded:4.4.3", "image_fullname": "mongodb/mongodb-sharded:4.4.4",
"path": "", "path": "",
"build": { "build": {
"git_repo": "docker.io/bitnami/mongodb-sharded", "git_repo": "quay.io/slfletch/mongodb-sharded",
"tag": "4.4.3-debian-10-r44", "tag": "4.4.4-debian-10-r41",
"user": "", "user": "",
"password": "" "password": ""
} }
@ -31,7 +31,7 @@ data:
"chart_name": "mongodb-sharded", "chart_name": "mongodb-sharded",
"project": "mongodb", "project": "mongodb",
"repo": "mongodb-sharded", "repo": "mongodb-sharded",
"version": "3.3.3", "version": "3.4.4",
"build_from_source": false, "build_from_source": false,
"path": "", "path": "",
"remote_namespace": "mongodb", "remote_namespace": "mongodb",
@ -53,9 +53,9 @@ data:
}, },
"releases": { "releases": {
"image": { "image": {
"registry": "docker.io", "registry": "quay.io",
"repository": "bitnami/mongodb-sharded", "repository": "slfletch/mongodb-sharded",
"tag": "4.4.4-debian-10-r28" "tag": "4.4.4-debian-10-r41"
} }
} }
}] }]

View File

@ -81,14 +81,10 @@ EOF
change_id=$(git log -1 | grep Change-Id: | awk '{print $2}') change_id=$(git log -1 | grep Change-Id: | awk '{print $2}')
popd popd
sleep 60 sleep 60
if (( COUNTER == 0 ));
then
CHANGE_ID_COUNTER=$change_id
fi
COUNTER=$((COUNTER+1)) COUNTER=$((COUNTER+1))
done done
COUNTER=1
voting_ci="false" voting_ci="false"
for jarvis_project in $(find ./tools/gate/jarvis/5G-SA-core -maxdepth 1 -mindepth 1 -type d -printf '%f\n'); do for jarvis_project in $(find ./tools/gate/jarvis/5G-SA-core -maxdepth 1 -mindepth 1 -type d -printf '%f\n'); do
echo "--- processing ${jarvis_project} with voting_ci = ${voting_ci}" echo "--- processing ${jarvis_project} with voting_ci = ${voting_ci}"
@ -97,7 +93,7 @@ for jarvis_project in $(find ./tools/gate/jarvis/5G-SA-core -maxdepth 1 -mindept
timeout="4000" timeout="4000"
end=$((end + timeout)) end=$((end + timeout))
while true; do while true; do
result="$(curl -u jarvis:password -SsL https://gerrit.jarvis.local/a/changes/${CHANGE_ID_COUNTER}/revisions/1/checks | tail -1 | jq -r .[].state)" result="$(curl -u jarvis:password -SsL https://gerrit.jarvis.local/a/changes/${COUNTER}/revisions/1/checks | tail -1 | jq -r .[].state)"
[ $result == "SUCCESSFUL" ] && break || true [ $result == "SUCCESSFUL" ] && break || true
[ $result == "FAILED" ] && exit 1 || true [ $result == "FAILED" ] && exit 1 || true
sleep 25 sleep 25
@ -114,8 +110,37 @@ for jarvis_project in $(find ./tools/gate/jarvis/5G-SA-core -maxdepth 1 -mindept
end=$((end + timeout)) end=$((end + timeout))
while true; do while true; do
# Check that Jarvis-System has reported the success of the pipeline run to Gerrit, by checking the value of the Verified label # Check that Jarvis-System has reported the success of the pipeline run to Gerrit, by checking the value of the Verified label
VERIFIED="$(curl -u jarvis:password -SsL https://gerrit.jarvis.local/a/changes/${CHANGE_ID_COUNTER}/revisions/1/review/ | tail -1 | jq -r .labels.Verified.all[0].value)" VERIFIED="$(curl -u jarvis:password -SsL https://gerrit.jarvis.local/a/changes/${COUNTER}/revisions/1/review/ | tail -1 | jq -r .labels.Verified.all[0].value)"
[ "$VERIFIED" == 1 ] && break || true if [ "$VERIFIED" == 1 ] ; then
if [ "${jarvis_project}" == "mongodb" ] ; then
echo "Merging mongodb patchset"
ssh -p 29418 jarvis@gerrit.jarvis.local gerrit review "${COUNTER}",1 --label Workflow=1 --label Code-Review=2
sleep 60
#Setting a longer timeout if it is going through the Merge pipeline.
timeout="720"
end=$((end + timeout))
while true; do
MERGED="$(curl -u jarvis:password -SsL https://gerrit.jarvis.local/a/changes/${COUNTER}/revisions/1/review/ | tail -1 | jq -r .status)"
kubectl get pods -n "jarvis-${COUNTER}-1"
if [ "$MERGED" == "MERGED" ] ; then
break
else
sleep 20
true
fi
now=$(date +%s)
if [ "$now" -gt "$end" ] ; then
echo "Jarvis-System has not merged the change"
exit 1
fi
done
break
else
break
fi
else
true
fi
sleep 5 sleep 5
now=$(date +%s) now=$(date +%s)
if [ "$now" -gt "$end" ] ; then if [ "$now" -gt "$end" ] ; then
@ -123,5 +148,5 @@ for jarvis_project in $(find ./tools/gate/jarvis/5G-SA-core -maxdepth 1 -mindept
exit 1 exit 1
fi fi
done done
CHANGE_ID_COUNTER=$((CHANGE_ID_COUNTER+1)) COUNTER=$((COUNTER+1))
done done

View File

@ -14,12 +14,23 @@
shell: "jq -c '.[] | {repo: (\"https://{{ chart_registry_url }}/\"+.project+\"-staging\"), secret: \"{{ harbor_secret_mounted_path }}\", name: (.project+\"-staging\")}' {{ loop_source }} | sort | uniq" shell: "jq -c '.[] | {repo: (\"https://{{ chart_registry_url }}/\"+.project+\"-staging\"), secret: \"{{ harbor_secret_mounted_path }}\", name: (.project+\"-staging\")}' {{ loop_source }} | sort | uniq"
register: internal_repos register: internal_repos
- name: Get list of nonstaging internal repos
when: (stage == 'deploy')
shell: "jq -c '.[] | {repo: (\"https://{{ chart_registry_url }}/\"+.project), secret: \"{{ harbor_secret_mounted_path }}\", name: (.project)}' {{ loop_source }} | sort | uniq"
register: internal_nonstaging_repos
- include_tasks: ./roles/charts/tasks/setup_helm_repo.yaml - include_tasks: ./roles/charts/tasks/setup_helm_repo.yaml
when: (stage == 'deploy') when: (stage == 'deploy')
loop: "{{ internal_repos.stdout_lines }}" loop: "{{ internal_repos.stdout_lines }}"
vars: vars:
repo: "{{ item }}" repo: "{{ item }}"
- include_tasks: ./roles/charts/tasks/setup_helm_repo.yaml
when: (stage == 'deploy')
loop: "{{ internal_nonstaging_repos.stdout_lines }}"
vars:
repo: "{{ item }}"
- include_tasks: ./roles/functional/tasks/main.yaml - include_tasks: ./roles/functional/tasks/main.yaml
when: data.stdout_lines |length > 0 when: data.stdout_lines |length > 0
loop: "{{ data.stdout_lines | map('from_json') | batch(chart_async_batch_size) | list }}" loop: "{{ data.stdout_lines | map('from_json') | batch(chart_async_batch_size) | list }}"

View File

@ -32,6 +32,7 @@
--kubeconfig="{{ cluster_kubeconfig_path }}/kubeconfig" \ --kubeconfig="{{ cluster_kubeconfig_path }}/kubeconfig" \
"{{ chart.release_name }}" "{{ chart.project }}/{{ chart.chart_name }}" \ "{{ chart.release_name }}" "{{ chart.project }}/{{ chart.chart_name }}" \
--version="{{ chart.version }}" \ --version="{{ chart.version }}" \
--create-namespace \
--values="{{ datapath }}/{{ chart.chart_name }}-overrides.json" \ --values="{{ datapath }}/{{ chart.chart_name }}-overrides.json" \
--namespace="{{ chart.remote_namespace }}" --namespace="{{ chart.remote_namespace }}"
args: args: