diff options
-rw-r--r-- | jjb/apex/apex.yml | 52 | ||||
-rw-r--r-- | jjb/functest/functest-ci-jobs.yml | 27 | ||||
-rw-r--r-- | utils/test/result_collection_api/resources/handlers.py | 6 | ||||
-rw-r--r-- | utils/test/result_collection_api/resources/models.py | 24 |
4 files changed, 98 insertions, 11 deletions
diff --git a/jjb/apex/apex.yml b/jjb/apex/apex.yml index 26090a3a3..6dbea1a62 100644 --- a/jjb/apex/apex.yml +++ b/jjb/apex/apex.yml @@ -628,6 +628,30 @@ failure-threshold: 'never' unstable-threshold: 'FAILURE' +- job-template: + name: 'apex-gs-clean-{stream}' + + # Job template for clean + # + # Required Variables: + # stream: branch with - in place of / (eg. stable) + node: '{slave}' + + disabled: false + + parameters: + - project-parameter: + project: '{project}' + - apex-parameter: + gs-pathname: '{gs-pathname}' + + builders: + - 'apex-gs-clean' + + triggers: + - 'apex-gs-clean-{stream}' + + ######################## # parameter macros ######################## @@ -780,6 +804,30 @@ echo "RPM Artifact is available as http://$GS_URL/$(basename $OPNFV_RPM_URL)" - builder: + name: 'apex-gs-cleanup' + builders: + - shell: | + #!/bin/bash + set -o errexit + set -o nounset + set -o pipefail + + # log info to console + echo "Cleaning Google Storage" + echo "-----------------------" + echo + + thirty_days_ago=$(date -d "30 days ago" +"%Y%m%d") + + for i in $(gsutil ls gs://$GS_URL/*201?*); do + filedate=$(date -d "$(echo $i | grep -Eo 201[0-9]-?[0-9][0-9]-?[0-9][0-9])" +"%Y%m%d") + if [ $filedate -lt $thirty_days_ago ]; then + # gsutil indicates what it is removing so no need for output here + gsutil rm $i + fi + done + +- builder: name: 'apex-deploy-virtual' builders: - shell: | @@ -1010,3 +1058,7 @@ name: 'apex-brahmaputra' triggers: - timed: '0 3 * * *' +- trigger: + name: 'apex-gs-clean-{stream}' + triggers: + - timed: '0 2 * * *' diff --git a/jjb/functest/functest-ci-jobs.yml b/jjb/functest/functest-ci-jobs.yml index e17e54183..0ee73b0c6 100644 --- a/jjb/functest/functest-ci-jobs.yml +++ b/jjb/functest/functest-ci-jobs.yml @@ -197,7 +197,7 @@ description: "Push the results of all the tests to the resultDB" - string: name: CI_DEBUG - default: 'false' + default: 'true' description: "Show debug output information" ######################## # trigger macros @@ -224,8 +224,13 @@ - shell: | #!/bin/bash set -e - echo "Functest: run $FUNCTEST_SUITE_NAME" - cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test $FUNCTEST_SUITE_NAME" + branch=${GIT_BRANCH##*/} + echo "Functest: run $FUNCTEST_SUITE_NAME on branch ${branch}" + if [[ ${branch} == *"brahmaputra"* ]]; then + cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test $FUNCTEST_SUITE_NAME" + else + cmd="python ${FUNCTEST_REPO_DIR}/ci/run_tests.py -t $FUNCTEST_SUITE_NAME" + fi container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1) docker exec $container_id $cmd @@ -235,9 +240,13 @@ - shell: | #!/bin/bash set +e - flags="-s" - [[ "$PUSH_RESULTS_TO_DB" == "true" ]] && flags+=" -r" - cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh ${flags}" + branch=${GIT_BRANCH##*/} + [[ "$PUSH_RESULTS_TO_DB" == "true" ]] && flags+="-r" + if [[ ${branch} == *"brahmaputra"* ]]; then + cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh -s ${flags}" + else + cmd="python ${FUNCTEST_REPO_DIR}/ci/run_tests.py -t all ${flags}" + fi container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1) docker exec $container_id $cmd @@ -309,7 +318,11 @@ echo "The container opnfv/functest with ID=${container_id} has not been properly started. Exiting..." exit 1 fi - cmd="${FUNCTEST_REPO_DIR}/docker/prepare_env.sh" + if [[ ${branch} == *"brahmaputra"* ]]; then + cmd="${FUNCTEST_REPO_DIR}/docker/prepare_env.sh" + else + cmd="python ${FUNCTEST_REPO_DIR}/ci/prepare_env.py start" + fi echo "Executing command inside the docker: ${cmd}" docker exec ${container_id} ${cmd} diff --git a/utils/test/result_collection_api/resources/handlers.py b/utils/test/result_collection_api/resources/handlers.py index 1eda3b067..c1e8eb182 100644 --- a/utils/test/result_collection_api/resources/handlers.py +++ b/utils/test/result_collection_api/resources/handlers.py @@ -512,6 +512,8 @@ class TestResultsHandler(GenericApiHandler): - period : x (x last days) - scenario : the test scenario (previously version) - criteria : the global criteria status passed or failed + - trust_indicator : evaluate the stability of the test case to avoid + running systematically long and stable test case :param result_id: Get a result by ID @@ -531,6 +533,7 @@ class TestResultsHandler(GenericApiHandler): scenario_arg = self.get_query_argument("scenario", None) criteria_arg = self.get_query_argument("criteria", None) period_arg = self.get_query_argument("period", None) + trust_indicator_arg = self.get_query_argument("trust_indicator", None) # prepare request get_request = dict() @@ -559,6 +562,9 @@ class TestResultsHandler(GenericApiHandler): if criteria_arg is not None: get_request["criteria_tag"] = criteria_arg + if trust_indicator_arg is not None: + get_request["trust_indicator_arg"] = trust_indicator_arg + if period_arg is not None: try: period_arg = int(period_arg) diff --git a/utils/test/result_collection_api/resources/models.py b/utils/test/result_collection_api/resources/models.py index 35b6af11f..06e95f94f 100644 --- a/utils/test/result_collection_api/resources/models.py +++ b/utils/test/result_collection_api/resources/models.py @@ -153,6 +153,7 @@ class TestResult: self.build_tag = None
self.scenario = None
self.criteria = None
+ self.trust_indicator = None
@staticmethod
def test_result_from_dict(test_result_dict):
@@ -173,7 +174,21 @@ class TestResult: t.build_tag = test_result_dict.get('build_tag')
t.scenario = test_result_dict.get('scenario')
t.criteria = test_result_dict.get('criteria')
-
+ # 0 < trust indicator < 1
+ # if bad value => set this indicator to 0
+ if test_result_dict.get('trust_indicator') is not None:
+ if isinstance(test_result_dict.get('trust_indicator'),
+ (int, long, float)):
+ if test_result_dict.get('trust_indicator') < 0:
+ t.trust_indicator = 0
+ elif test_result_dict.get('trust_indicator') > 1:
+ t.trust_indicator = 1
+ else:
+ t.trust_indicator = test_result_dict.get('trust_indicator')
+ else:
+ t.trust_indicator = 0
+ else:
+ t.trust_indicator = 0
return t
def format(self):
@@ -188,7 +203,8 @@ class TestResult: "details": self.details,
"build_tag": self.build_tag,
"scenario": self.scenario,
- "criteria": self.criteria
+ "criteria": self.criteria,
+ "trust_indicator": self.trust_indicator
}
def format_http(self):
@@ -204,6 +220,6 @@ class TestResult: "details": self.details,
"build_tag": self.build_tag,
"scenario": self.scenario,
- "criteria": self.criteria
+ "criteria": self.criteria,
+ "trust_indicator": self.trust_indicator
}
-
|