
This patchset copies the development-pipeline and standard-container into the sample network mongodb directory to begin testing the pipeline and standard-container in a namespace created by jarvis-system. Change-Id: I8448a122e8da218752ea57b15fb2983881e90ec9
108 lines
3.0 KiB
Bash
Executable File
108 lines
3.0 KiB
Bash
Executable File
#!/bin/bash
|
|
set -ex
|
|
|
|
function generate_gerrit_creds_override() {
|
|
local output_file
|
|
output_file="$(mktemp -d)/gerrit-host-rsa-key.yaml"
|
|
tee "${output_file}" <<EOF
|
|
params:
|
|
gerrit:
|
|
user: jarvis
|
|
password: password
|
|
ssh_key: |
|
|
$(awk '{ print " " $0 }' "${HOME}/.ssh/id_rsa")
|
|
EOF
|
|
export gerrit_creds_override="${output_file}"
|
|
}
|
|
generate_gerrit_creds_override
|
|
|
|
COUNTER=0
|
|
for jarvis_project in `find ./tools/gate/jarvis/5G-SA-core -maxdepth 1 -mindepth 1 -type d -printf '%f\n'`; do
|
|
# Half of Jarvis-Projects will be made with required CI, half will be made with optional CI to
|
|
# offer examples to developers using Jarvis.
|
|
if (( COUNTER % 2 ));
|
|
then
|
|
voting_ci="true"
|
|
else
|
|
voting_ci="false"
|
|
fi
|
|
|
|
# shellcheck disable=SC2046
|
|
# Copy development-pipeline to be
|
|
helm upgrade \
|
|
--create-namespace \
|
|
--install \
|
|
--namespace=jarvis-projects \
|
|
"${jarvis_project}" \
|
|
"./charts/jarvis-project" \
|
|
--values="${gerrit_creds_override}" \
|
|
--set config.ci.verify="$voting_ci" \
|
|
$(./tools/deployment/common/get-values-overrides.sh jarvis-project)
|
|
|
|
./tools/deployment/common/wait-for-pods.sh jarvis-projects
|
|
|
|
sleep 60
|
|
|
|
# Define creds to use for gerrit.
|
|
ldap_username="jarvis"
|
|
|
|
# Commit .gitreview and project code
|
|
jarvis_sanity_repo=$(mktemp -d)
|
|
git clone ssh://${ldap_username}@gerrit.jarvis.local:29418/${jarvis_project}.git "${jarvis_sanity_repo}"
|
|
pushd "${jarvis_sanity_repo}"
|
|
tee .gitreview <<EOF
|
|
[gerrit]
|
|
host=gerrit.jarvis.local
|
|
port=29418
|
|
project=${jarvis_project}.git
|
|
EOF
|
|
popd
|
|
cp -a tools/gate/jarvis/5G-SA-core/${jarvis_project}/. "${jarvis_sanity_repo}"
|
|
cp -a tools/gate/jarvis/development-pipeline/* "${jarvis_sanity_repo}/jarvis/development-pipeline"
|
|
pushd "${jarvis_sanity_repo}"
|
|
git review -s
|
|
git add -A
|
|
git commit -asm "Add project code and .gitreview file"
|
|
git review
|
|
change_id=`git log -1 | grep Change-Id: | awk '{print $2}'`
|
|
popd
|
|
|
|
COUNTER=$((COUNTER+1))
|
|
done
|
|
|
|
./tools/deployment/common/wait-for-pods.sh jarvis-projects
|
|
|
|
./tools/deployment/common/wait-for-pods.sh jarvis-8-1
|
|
|
|
# Check jarvis pipeline run
|
|
end=$(date +%s)
|
|
timeout="3400"
|
|
end=$((end + timeout))
|
|
change_id=8
|
|
while true; do
|
|
result="$(curl -L https://gerrit.jarvis.local/changes/${change_id}/revisions/1/checks | tail -1 | jq -r .[].state)"
|
|
[ $result == "SUCCESSFUL" ] && break || [ $result == "FAILED" ] && break || true
|
|
sleep 5
|
|
now=$(date +%s)
|
|
if [ $now -gt $end ] ; then
|
|
echo "Pipeline failed to complete $timeout seconds"
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
# Check that Jarvis-System has reported the success of the pipeline run to Gerrit
|
|
end=$(date +%s)
|
|
timeout="120"
|
|
end=$((end + timeout))
|
|
change_id=8
|
|
while true; do
|
|
VERIFIED="$(curl -L https://gerrit.jarvis.local/changes/${change_id}/revisions/1/review/ | tail -1 | jq -r .labels.Verified.all[0].value)"
|
|
[ "$VERIFIED" == 1 ] && break || true
|
|
sleep 5
|
|
now=$(date +%s)
|
|
if [ "$now" -gt "$end" ] ; then
|
|
echo "Jarvis-System has not verified the change"
|
|
exit 1
|
|
fi
|
|
done
|