mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
ci: move the retry_failed_jobs to pre_check stage
This commit is contained in:
@@ -29,5 +29,4 @@ include:
|
|||||||
- ".gitlab/ci/host-test.yml"
|
- ".gitlab/ci/host-test.yml"
|
||||||
- ".gitlab/ci/deploy.yml"
|
- ".gitlab/ci/deploy.yml"
|
||||||
- ".gitlab/ci/post_deploy.yml"
|
- ".gitlab/ci/post_deploy.yml"
|
||||||
- ".gitlab/ci/retry_failed_jobs.yml"
|
|
||||||
- ".gitlab/ci/test-win.yml"
|
- ".gitlab/ci/test-win.yml"
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ stages:
|
|||||||
- test_deploy
|
- test_deploy
|
||||||
- deploy
|
- deploy
|
||||||
- post_deploy
|
- post_deploy
|
||||||
- retry_failed_jobs
|
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
# System environment
|
# System environment
|
||||||
|
|||||||
@@ -202,13 +202,13 @@ gcc_static_analyzer:
|
|||||||
- echo "CONFIG_COMPILER_STATIC_ANALYZER=y" >> ${ANALYZING_APP}/sdkconfig.defaults
|
- echo "CONFIG_COMPILER_STATIC_ANALYZER=y" >> ${ANALYZING_APP}/sdkconfig.defaults
|
||||||
- idf-build-apps build -p ${ANALYZING_APP}
|
- idf-build-apps build -p ${ANALYZING_APP}
|
||||||
|
|
||||||
redundant_pass_job:
|
retry_failed_jobs:
|
||||||
extends:
|
extends:
|
||||||
- .pre_check_template
|
- .pre_check_template
|
||||||
|
- .rules:dev-push
|
||||||
tags: [shiny, fast_run]
|
tags: [shiny, fast_run]
|
||||||
cache: []
|
allow_failure: true
|
||||||
variables:
|
|
||||||
GIT_STRATEGY: none
|
|
||||||
before_script: []
|
|
||||||
script:
|
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
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -15,10 +15,6 @@ TOP_N_APPS_BY_SIZE_DIFF = 10
|
|||||||
SIZE_DIFFERENCE_BYTES_THRESHOLD = 500
|
SIZE_DIFFERENCE_BYTES_THRESHOLD = 500
|
||||||
BINARY_SIZE_METRIC_NAME = 'binary_size'
|
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 = ''
|
|
||||||
|
|
||||||
KNOWN_GENERATE_TEST_CHILD_PIPELINE_WARNINGS_FILEPATH = os.path.join(
|
KNOWN_GENERATE_TEST_CHILD_PIPELINE_WARNINGS_FILEPATH = os.path.join(
|
||||||
IDF_PATH, 'tools', 'ci', 'dynamic_pipelines', 'templates', 'known_generate_test_child_pipeline_warnings.yml'
|
IDF_PATH, 'tools', 'ci', 'dynamic_pipelines', 'templates', 'known_generate_test_child_pipeline_warnings.yml'
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -19,16 +19,12 @@ from .constants import COMMENT_START_MARKER
|
|||||||
from .constants import CSS_STYLES_FILEPATH
|
from .constants import CSS_STYLES_FILEPATH
|
||||||
from .constants import JS_SCRIPTS_FILEPATH
|
from .constants import JS_SCRIPTS_FILEPATH
|
||||||
from .constants import REPORT_TEMPLATE_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 SIZE_DIFFERENCE_BYTES_THRESHOLD
|
||||||
from .constants import TOP_N_APPS_BY_SIZE_DIFF
|
from .constants import TOP_N_APPS_BY_SIZE_DIFF
|
||||||
from .models import GitlabJob
|
from .models import GitlabJob
|
||||||
from .models import TestCase
|
from .models import TestCase
|
||||||
from .utils import format_permalink
|
from .utils import format_permalink
|
||||||
from .utils import get_artifacts_url
|
from .utils import get_artifacts_url
|
||||||
from .utils import get_repository_file_url
|
|
||||||
from .utils import is_url
|
from .utils import is_url
|
||||||
|
|
||||||
|
|
||||||
@@ -286,25 +282,13 @@ class ReportGenerator:
|
|||||||
|
|
||||||
return comment
|
return comment
|
||||||
|
|
||||||
def _update_mr_comment(self, comment: str, print_retry_jobs_message: bool) -> None:
|
def _update_mr_comment(self, comment: str) -> 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})')
|
|
||||||
|
|
||||||
new_comment = f'{COMMENT_START_MARKER}\n\n{comment}'
|
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):
|
for note in self.mr.notes.list(iterator=True):
|
||||||
if note.body.startswith(COMMENT_START_MARKER):
|
if note.body.startswith(COMMENT_START_MARKER):
|
||||||
updated_str = self._get_updated_comment(note.body, comment)
|
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
|
note.body = updated_str
|
||||||
try:
|
try:
|
||||||
note.save()
|
note.save()
|
||||||
@@ -321,7 +305,7 @@ class ReportGenerator:
|
|||||||
updated_str = f'{existing_comment.strip()}\n\n{new_comment}'
|
updated_str = f'{existing_comment.strip()}\n\n{new_comment}'
|
||||||
return updated_str
|
return updated_str
|
||||||
|
|
||||||
def post_report(self, print_retry_jobs_message: bool = False) -> None:
|
def post_report(self) -> None:
|
||||||
comment = self._generate_comment()
|
comment = self._generate_comment()
|
||||||
|
|
||||||
print(comment)
|
print(comment)
|
||||||
@@ -330,7 +314,7 @@ class ReportGenerator:
|
|||||||
print('No MR found, skip posting comment')
|
print('No MR found, skip posting comment')
|
||||||
return
|
return
|
||||||
|
|
||||||
self._update_mr_comment(comment, print_retry_jobs_message=print_retry_jobs_message)
|
self._update_mr_comment(comment)
|
||||||
|
|
||||||
|
|
||||||
class BuildReportGenerator(ReportGenerator):
|
class BuildReportGenerator(ReportGenerator):
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ def generate_jobs_report(args: argparse.Namespace) -> None:
|
|||||||
report_generator = JobReportGenerator(
|
report_generator = JobReportGenerator(
|
||||||
args.project_id, args.mr_iid, args.pipeline_id, args.job_id, args.commit_id, args.local_commit_id, jobs=jobs
|
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:
|
if GitlabEnvVars().IDF_CI_IS_DEBUG_PIPELINE:
|
||||||
print('Debug pipeline detected, exit non-zero to fail the pipeline in order to block merge')
|
print('Debug pipeline detected, exit non-zero to fail the pipeline in order to block merge')
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB |
Reference in New Issue
Block a user