Don't update image field when we can't manage it (#29)

* If deploymentconfigs are configured to trigger on image stream updates don't try to replace image field

* First pass at parsing the trigger annotation

* First draft of IS idempotence tests

* Found even more not idempotent stuff

* Separate handling of annotation and dc spec

* handle malformed annotations

* refactor incluster integration test to catch last flake

* Add proper DNS01 regex for container names

* fix broken conditional for trigger annotations

* Handle namespace field that is added to trigger

* deduplicate shared code

* Set namespace in incluster script

* Give high permissions to test pod

* Still working on permissions issues in prow

* Fix inventory test

* add namespace to watch

* run in default namespace

* fix recursive call

* Fix ansible collection path for downstream test

* Clone the proper ansible collection
This commit is contained in:
Fabian von Feilitzsch
2020-09-17 13:21:00 -04:00
committed by GitHub
parent 1339e2bdf7
commit f52d63c83f
6 changed files with 317 additions and 53 deletions

View File

@@ -133,9 +133,8 @@ f_install_kubernetes_core_from_src()
# ansible-galaxy collection install -p "${install_collections_dir}" "${community_k8s_tmpdir}"/kubernetes-core-*.tar.gz
# popd
#popd
git clone https://github.com/maxamillion/community.kubernetes "${community_k8s_tmpdir}"
git clone https://github.com/ansible-collections/community.kubernetes "${community_k8s_tmpdir}"
pushd "${community_k8s_tmpdir}"
git checkout downstream/fix_collection_name
make downstream-build
ansible-galaxy collection install -p "${install_collections_dir}" "${community_k8s_tmpdir}"/kubernetes-core-*.tar.gz
popd
@@ -189,7 +188,7 @@ f_test_integration_option()
f_install_kubernetes_core_from_src
pushd "${_build_dir}" || return
f_log_info "INTEGRATION TEST WD: ${PWD}"
make test-integration-incluster
OVERRIDE_COLLECTION_PATH="${_tmp_dir}" molecule test
popd || return
f_cleanup
}

View File

@@ -2,6 +2,8 @@
set -x
NAMESPACE=${NAMESPACE:-default}
# IMAGE_FORMAT is in the form $registry/$org/$image:$$component, ie
# quay.io/openshift/release:$component
# To test with your own image, build and push the test image
@@ -14,6 +16,15 @@ eval IMAGE=$IMAGE_FORMAT
PULL_POLICY=${PULL_POLICY:-IfNotPresent}
if ! oc get namespace $NAMESPACE
then
oc create namespace $NAMESPACE
fi
oc project $NAMESPACE
oc adm policy add-cluster-role-to-user cluster-admin -z default
oc adm policy who-can create projectrequests
echo "Deleting test job if it exists"
oc delete job molecule-integration-test --wait --ignore-not-found
@@ -40,22 +51,36 @@ spec:
parallelism: 1
EOF
function wait_for_success {
oc wait --for=condition=complete job/molecule-integration-test --timeout 5m
echo "Molecule integration tests ran successfully"
exit 0
function check_success {
oc wait --for=condition=complete job/molecule-integration-test --timeout 5s -n $NAMESPACE \
&& oc logs job/molecule-integration-test \
&& echo "Molecule integration tests ran successfully" \
&& return 0
return 1
}
function wait_for_failure {
oc wait --for=condition=failed job/molecule-integration-test --timeout 5m
oc logs job/molecule-integration-test
echo "Molecule integration tests failed, see logs for more information..."
exit 1
function check_failure {
oc wait --for=condition=failed job/molecule-integration-test --timeout 5s -n $NAMESPACE \
&& oc logs job/molecule-integration-test \
&& echo "Molecule integration tests failed, see logs for more information..." \
&& return 0
return 1
}
# Ensure the child processes are killed
trap 'kill -SIGTERM 0' SIGINT EXIT
runtime="15 minute"
endtime=$(date -ud "$runtime" +%s)
echo "Waiting for test job to complete"
wait_for_success &
wait_for_failure
while [[ $(date -u +%s) -le $endtime ]]
do
if check_success
then
exit 0
elif check_failure
then
exit 1
fi
sleep 10
done
exit 1