diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9c33fe48f6..7c02159d1a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,5 +29,4 @@ include: - ".gitlab/ci/host-test.yml" - ".gitlab/ci/deploy.yml" - ".gitlab/ci/post_deploy.yml" - - ".gitlab/ci/retry_failed_jobs.yml" - ".gitlab/ci/test-win.yml" diff --git a/.gitlab/ci/common.yml b/.gitlab/ci/common.yml index a74c634098..1161176b02 100644 --- a/.gitlab/ci/common.yml +++ b/.gitlab/ci/common.yml @@ -12,7 +12,6 @@ stages: - test_deploy - deploy - post_deploy - - retry_failed_jobs variables: # System environment diff --git a/.gitlab/ci/pre_check.yml b/.gitlab/ci/pre_check.yml index 758bef51a4..49c3920ebd 100644 --- a/.gitlab/ci/pre_check.yml +++ b/.gitlab/ci/pre_check.yml @@ -202,13 +202,13 @@ gcc_static_analyzer: - echo "CONFIG_COMPILER_STATIC_ANALYZER=y" >> ${ANALYZING_APP}/sdkconfig.defaults - idf-build-apps build -p ${ANALYZING_APP} -redundant_pass_job: +retry_failed_jobs: extends: - .pre_check_template + - .rules:dev-push tags: [shiny, fast_run] - cache: [] - variables: - GIT_STRATEGY: none - before_script: [] + allow_failure: true script: - - echo "This job is redundant to ensure the 'retry_failed_jobs' job can exist and not be skipped" + - echo "Retrieving and retrying all failed jobs for the pipeline..." + - python tools/ci/python_packages/gitlab_api.py retry_failed_jobs $CI_MERGE_REQUEST_PROJECT_ID --pipeline_id $CI_PIPELINE_ID + when: manual diff --git a/.gitlab/ci/retry_failed_jobs.yml b/.gitlab/ci/retry_failed_jobs.yml deleted file mode 100644 index 8eff2ed6b4..0000000000 --- a/.gitlab/ci/retry_failed_jobs.yml +++ /dev/null @@ -1,15 +0,0 @@ -retry_failed_jobs: - stage: retry_failed_jobs - tags: [shiny, fast_run] - allow_failure: true - image: $ESP_ENV_IMAGE - dependencies: null - before_script: [] - cache: [] - extends: [] - script: - - echo "Retrieving and retrying all failed jobs for the pipeline..." - - python tools/ci/python_packages/gitlab_api.py retry_failed_jobs $CI_MERGE_REQUEST_PROJECT_ID --pipeline_id $CI_PIPELINE_ID - when: manual - needs: - - redundant_pass_job diff --git a/tools/ci/dynamic_pipelines/constants.py b/tools/ci/dynamic_pipelines/constants.py index a85e9a5793..40dbe346d1 100644 --- a/tools/ci/dynamic_pipelines/constants.py +++ b/tools/ci/dynamic_pipelines/constants.py @@ -15,10 +15,6 @@ TOP_N_APPS_BY_SIZE_DIFF = 10 SIZE_DIFFERENCE_BYTES_THRESHOLD = 500 BINARY_SIZE_METRIC_NAME = 'binary_size' -RETRY_JOB_PICTURE_PATH = 'tools/ci/dynamic_pipelines/templates/retry-jobs.png' -RETRY_JOB_TITLE = '\n\nRetry failed jobs with with help of "retry_failed_jobs" stage of the pipeline:' -RETRY_JOB_PICTURE_LINK = '![Retry Jobs Image]({pic_url})' - KNOWN_GENERATE_TEST_CHILD_PIPELINE_WARNINGS_FILEPATH = os.path.join( IDF_PATH, 'tools', 'ci', 'dynamic_pipelines', 'templates', 'known_generate_test_child_pipeline_warnings.yml' ) diff --git a/tools/ci/dynamic_pipelines/report.py b/tools/ci/dynamic_pipelines/report.py index 1ae1f04778..24b0ed9a03 100644 --- a/tools/ci/dynamic_pipelines/report.py +++ b/tools/ci/dynamic_pipelines/report.py @@ -19,16 +19,12 @@ from .constants import COMMENT_START_MARKER from .constants import CSS_STYLES_FILEPATH from .constants import JS_SCRIPTS_FILEPATH from .constants import REPORT_TEMPLATE_FILEPATH -from .constants import RETRY_JOB_PICTURE_LINK -from .constants import RETRY_JOB_PICTURE_PATH -from .constants import RETRY_JOB_TITLE from .constants import SIZE_DIFFERENCE_BYTES_THRESHOLD from .constants import TOP_N_APPS_BY_SIZE_DIFF from .models import GitlabJob from .models import TestCase from .utils import format_permalink from .utils import get_artifacts_url -from .utils import get_repository_file_url from .utils import is_url @@ -286,25 +282,13 @@ class ReportGenerator: return comment - def _update_mr_comment(self, comment: str, print_retry_jobs_message: bool) -> None: - retry_job_picture_comment = (f'{RETRY_JOB_TITLE}\n\n{RETRY_JOB_PICTURE_LINK}').format( - pic_url=get_repository_file_url(RETRY_JOB_PICTURE_PATH) - ) - del_retry_job_pic_pattern = re.escape(RETRY_JOB_TITLE) + r'.*?' + re.escape(f'{RETRY_JOB_PICTURE_PATH})') - + def _update_mr_comment(self, comment: str) -> None: new_comment = f'{COMMENT_START_MARKER}\n\n{comment}' - if print_retry_jobs_message: - new_comment += retry_job_picture_comment for note in self.mr.notes.list(iterator=True): if note.body.startswith(COMMENT_START_MARKER): updated_str = self._get_updated_comment(note.body, comment) - # Add retry job message only if any job has failed - if print_retry_jobs_message: - updated_str = re.sub(del_retry_job_pic_pattern, '', updated_str, flags=re.DOTALL) - updated_str += retry_job_picture_comment - note.body = updated_str try: note.save() @@ -321,7 +305,7 @@ class ReportGenerator: updated_str = f'{existing_comment.strip()}\n\n{new_comment}' return updated_str - def post_report(self, print_retry_jobs_message: bool = False) -> None: + def post_report(self) -> None: comment = self._generate_comment() print(comment) @@ -330,7 +314,7 @@ class ReportGenerator: print('No MR found, skip posting comment') return - self._update_mr_comment(comment, print_retry_jobs_message=print_retry_jobs_message) + self._update_mr_comment(comment) class BuildReportGenerator(ReportGenerator): diff --git a/tools/ci/dynamic_pipelines/scripts/generate_report.py b/tools/ci/dynamic_pipelines/scripts/generate_report.py index 83829c8558..1f40fff50a 100644 --- a/tools/ci/dynamic_pipelines/scripts/generate_report.py +++ b/tools/ci/dynamic_pipelines/scripts/generate_report.py @@ -110,7 +110,7 @@ def generate_jobs_report(args: argparse.Namespace) -> None: report_generator = JobReportGenerator( args.project_id, args.mr_iid, args.pipeline_id, args.job_id, args.commit_id, args.local_commit_id, jobs=jobs ) - report_generator.post_report(print_retry_jobs_message=any(job.is_failed for job in jobs)) + report_generator.post_report() if GitlabEnvVars().IDF_CI_IS_DEBUG_PIPELINE: print('Debug pipeline detected, exit non-zero to fail the pipeline in order to block merge') diff --git a/tools/ci/dynamic_pipelines/templates/retry-jobs.png b/tools/ci/dynamic_pipelines/templates/retry-jobs.png deleted file mode 100644 index a8a60112c0..0000000000 Binary files a/tools/ci/dynamic_pipelines/templates/retry-jobs.png and /dev/null differ