From 06feca847fe0eb3ec14668af350bf50aed0c5407 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 31 Jan 2022 13:15:25 +0000 Subject: [PATCH] bug fix - ltr location --- API/aux/constants.py | 2 +- API/main.py | 2 +- API/wrappers/jenkins/pipeline_configuration.py | 10 ++++------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/API/aux/constants.py b/API/aux/constants.py index 9bcd7fe..5299c9f 100644 --- a/API/aux/constants.py +++ b/API/aux/constants.py @@ -69,4 +69,4 @@ "ci_cd_agent_cleaned_test_environment": "CLEANED_TEST_ENVIRONMENT", "test_ended": "TEST_ENDED", "obtained_metrics_collection_files": "OBTAINED_METRICS_COLLECTION_FILES", -} \ No newline at end of file +} diff --git a/API/main.py b/API/main.py index 57a20c1..e4a7f5a 100644 --- a/API/main.py +++ b/API/main.py @@ -77,7 +77,7 @@ app.add_middleware( CORSMiddleware, - allow_origin_regex="http(s)?://ci-cd-manager\.5gasp\.eu.*", + allow_origin_regex="http(s)?://ci-cd-(manager)|(service)\.5gasp\.eu.*", allow_credentials=True, allow_methods=["*"], allow_headers=["*"], diff --git a/API/wrappers/jenkins/pipeline_configuration.py b/API/wrappers/jenkins/pipeline_configuration.py index 9093b38..a536123 100644 --- a/API/wrappers/jenkins/pipeline_configuration.py +++ b/API/wrappers/jenkins/pipeline_configuration.py @@ -36,13 +36,11 @@ def __init__(self, jenkins_script_str, executed_tests_info, available_tests, des self.metrics_collection_information = metrics_collection_information self.test_instance_id = test_instance_id self.testbed_id = testbed_id - self.ltr_info = Utils.get_ltr_info_for_testbed(testbed_id) def create_jenkins_pipeline_script(self): # fill the pipeline script - print(self.ltr_info) self.add_environment_setup_to_jenkins_pipeline_script() self.add_obtain_metrics_collection_files_to_jenkins_pipeline_script(self.metrics_collection_information) self.add_metrics_colllection_mechanism_to_jenkins_pipeline_script(self.descriptor_metrics_collection, self.metrics_collection_information) @@ -79,7 +77,7 @@ def add_obtain_and_perform_tests_to_jenkins_pipeline_script(self, executed_tests environment_obtain_tests = [ f"ltr_user = credentials('ltr_user')", f"ltr_password = credentials('ltr_password')", - f"ltr_location = '{self.ltr_info['location']}'" + f"ltr_location = credentials('ltr_location')" ] run_tests_commands = [] @@ -117,7 +115,7 @@ def add_publish_results_to_jenkins_pipeline_script(self): publish_results_environment = [ f"ltr_user = credentials('ltr_user')", f"ltr_password = credentials('ltr_password')", - f"ltr_location = '{self.ltr_info['location']}'", + f"ltr_location = credentials('ltr_location')", f"results_ftp_location = '{Constants.FTP_RESULTS_URL}'", f"results_ftp_user = '{Constants.FTP_RESULTS_USER}'", f"results_ftp_password = '{Constants.FTP_RESULTS_PASSWORD}'", @@ -147,7 +145,7 @@ def add_obtain_metrics_collection_files_to_jenkins_pipeline_script(self, metrics obtain_metrics_environment = [ f"ltr_user = credentials('ltr_user')", f"ltr_password = credentials('ltr_password')", - f"ltr_location = '{self.ltr_info['location']}'" + f"ltr_location = credentials('ltr_location')" ] obtain_metrics_collection_file_commands = [] @@ -208,4 +206,4 @@ def __update_jenkins_script(self, tag_to_replace, commands_lst): item2 = re.search("{\s*" + tag_to_replace, self.jenkins_script_str, re.MULTILINE) line_offset = item1.span(0)[0] - item2.span(0)[0] - 2 commands_str = "\n{}".format(line_offset * " ").join(commands_lst) - self.jenkins_script_str = self.jenkins_script_str.replace(tag_to_replace, commands_str) \ No newline at end of file + self.jenkins_script_str = self.jenkins_script_str.replace(tag_to_replace, commands_str)