Skip to content
Snippets Groups Projects
Commit f2faf558 authored by Konstantinos Samaras-Tsakiris's avatar Konstantinos Samaras-Tsakiris
Browse files

Merge branch 'ci-test-improvements' into 'master'

CDD CI improvements

Closes webservices/webframeworks-planning#891

See merge request !99
parents 9f76ba11 1ad43c0c
No related branches found
No related tags found
1 merge request!99CDD CI improvements
Pipeline #3750646 passed
...@@ -102,12 +102,6 @@ test-clonesite-provision: ...@@ -102,12 +102,6 @@ test-clonesite-provision:
deprovision-test-resources: deprovision-test-resources:
stage: deprovision stage: deprovision
# Manual if variable present
needs:
- environment
- build-sitebuilder
- test-newsite-provision
- test-clonesite-provision
image: gitlab-registry.cern.ch/paas-tools/openshift-client:4 image: gitlab-registry.cern.ch/paas-tools/openshift-client:4
script: script:
- ./.gitlab/ci/scripts/deprovision-test-resources.sh - ./.gitlab/ci/scripts/deprovision-test-resources.sh
...@@ -22,16 +22,15 @@ ...@@ -22,16 +22,15 @@
# Wait for clone pod to spawn # Wait for clone pod to spawn
sleep 60s sleep 60s
max_attempts="16" max_attempts="20"
attempt_num="0" attempt_num="0"
while [[ $(oc get drupalsite/$SITENAME -n $NAMESPACE -o json | jq -r '.status.conditions[] | select(.type=="Ready") | .status') != "True" ]] while [[ $(oc get drupalsite/$SITENAME -n $NAMESPACE -o json | jq -r '.status.conditions[] | select(.type=="Ready") | .status') != "True" ]]
do do
if (( $attempt_num == $max_attempts )) if (( $attempt_num == $max_attempts ))
then then
echo $(date -u +"%Y-%m-%dT%H:%M:%SZ")"-Sitename: ${SITENAME}, Timed out (10minutes) waiting for DrupalSite to be ready!" echo $(date -u +"%Y-%m-%dT%H:%M:%SZ")"-Sitename: ${SITENAME}, Timed out (20minutes) waiting for DrupalSite to be ready!"
exit 0 exit 0
else else
#echo $(date -u +"%Y-%m-%dT%H:%M:%SZ")-"Sitename: ${SITENAME}, >> Waiting 10s for Drupalsite to be ready "
(( attempt_num++ )) (( attempt_num++ ))
sleep 60s sleep 60s
fi fi
...@@ -40,7 +39,7 @@ ...@@ -40,7 +39,7 @@
# Warm up the website # Warm up the website
curl --max-time 60 --silent --fail --insecure -IL "https://${FQDN}/" > /dev/null curl --max-time 60 --silent --fail --insecure -IL "https://${FQDN}/" > /dev/null
curl --max-time 60 --silent --fail --insecure -IL "https://${FQDN}/user/login" > /dev/null curl --max-time 60 --silent --fail --insecure -IL "https://${FQDN}/user/login" > /dev/null
# Give another minute for SSO etc. to be properly running # Give another 10 minutes for SSO etc. to be properly running
sleep 600 sleep 600
# Check if the base URL works # Check if the base URL works
......
...@@ -5,11 +5,15 @@ ...@@ -5,11 +5,15 @@
# Ensure oc access # Ensure oc access
oc login -u ${SA_USER} -p ${SA_PASSWORD} --server=https://api.drupal.okd.cern.ch oc login -u ${SA_USER} -p ${SA_PASSWORD} --server=https://api.drupal.okd.cern.ch
# $NAMESPACE is defined on .gitlab-ci.yaml # NAMESPACE is provided by .gitlab-ci.yml, the namespace/project is expected to exist at this point
# Create/ValidateProject oc get project ${NAMESPACE} > /dev/null
oc new-project $NAMESPACE --description="Project created by CI on Cern-drupal-distribution" if [[ "$?" != "0" ]]; then
echo "‼️ Project ${NAMESPACE} doesn't exist! Aborting...."
exit 1
fi
export CLONE_FROM=$(oc get drupalsite -l ci=true --no-headers -o custom-columns=name:.metadata.name) export CLONE_FROM=$(oc get drupalsite -l ci-clone-source=true --no-headers -o custom-columns=name:.metadata.name)
# Validate we only get one website to clone from # Validate we only get one website to clone from
if [[ $(echo $CLONE_FROM | wc -w ) != "1" ]]; then if [[ $(echo $CLONE_FROM | wc -w ) != "1" ]]; then
echo "Error, expected 1 website to clone from, got $CLONE_FROM" echo "Error, expected 1 website to clone from, got $CLONE_FROM"
...@@ -38,5 +42,4 @@ ...@@ -38,5 +42,4 @@
fi fi
echo "✅ Website provisioned as expected!" echo "✅ Website provisioned as expected!"
# We do not delete site, this is a step made after web tests delete_site
# Don't delete Project, as it might be used on othe CIs at the same time, just delete resources!
...@@ -5,9 +5,12 @@ ...@@ -5,9 +5,12 @@
# Ensure oc access # Ensure oc access
oc login -u ${SA_USER} -p ${SA_PASSWORD} --server=https://api.drupal.okd.cern.ch oc login -u ${SA_USER} -p ${SA_PASSWORD} --server=https://api.drupal.okd.cern.ch
# $NAMESPACE is defined on .gitlab-ci.yaml # NAMESPACE is provided by .gitlab-ci.yml, the namespace/project is expected to exist at this point
# Create/ValidateProject oc get project ${NAMESPACE} > /dev/null
oc new-project $NAMESPACE --description="Project created by CI on Cern-drupal-distribution" if [[ "$?" != "0" ]]; then
echo "‼️ Project ${NAMESPACE} doesn't exist! Aborting...."
exit 1
fi
# Variables to create new DrupalSite # Variables to create new DrupalSite
get_tag get_tag
...@@ -41,4 +44,4 @@ ...@@ -41,4 +44,4 @@
echo "✅ Website provisioned as expected!" echo "✅ Website provisioned as expected!"
delete_site delete_site
# Don't delete Project, as it might be used on othe CIs at the same time, just delete resources! # Don't delete Project, as it might be used on other CIs at the same time, just delete resources!
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment