-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(notify): Add conductor scheduled pipelines to the notification rules #32094
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,5 +1,6 @@ | ||||||||||
from __future__ import annotations | ||||||||||
|
||||||||||
import os | ||||||||||
import re | ||||||||||
from typing import Any | ||||||||||
from urllib.parse import quote | ||||||||||
|
@@ -43,3 +44,30 @@ def get_ci_visibility_job_url( | |||||||||
extra_args = ''.join([f'&{key}={value}' for key, value in extra_args.items()]) | ||||||||||
|
||||||||||
return CI_VISIBILITY_JOB_URL.format(name=name, extra_flags=extra_flags, extra_args=extra_args) | ||||||||||
|
||||||||||
|
||||||||||
def should_notify(): | ||||||||||
""" | ||||||||||
Check if the pipeline should notify the channel: only for non-downstream pipelines, unless conductor triggered it | ||||||||||
""" | ||||||||||
from tasks.libs.ciproviders.gitlab_api import get_pipeline | ||||||||||
|
||||||||||
CONDUCTOR_ID = 8278 | ||||||||||
pipeline = get_pipeline(PROJECT_NAME, os.environ['CI_PIPELINE_ID']) | ||||||||||
return ( | ||||||||||
os.environ['CI_PIPELINE_SOURCE'] != 'pipeline' | ||||||||||
or os.environ['CI_PIPELINE_SOURCE'] == 'pipeline' | ||||||||||
and pipeline.user['id'] == CONDUCTOR_ID | ||||||||||
Comment on lines
+59
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ question
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not needed because
|
||||||||||
) | ||||||||||
|
||||||||||
|
||||||||||
def notification_type(): | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💬 suggestion: A docstring would be nice here imo if the function is meant to be used elsewhere |
||||||||||
""" | ||||||||||
Return the type of notification to send (related to the type of pipeline, amongst 'deploy', 'trigger' and 'merge') | ||||||||||
""" | ||||||||||
if os.environ['DEPLOY_AGENT'] == 'true': | ||||||||||
return 'deploy' | ||||||||||
elif os.environ['CI_PIPELINE_SOURCE'] != 'push': | ||||||||||
return 'trigger' | ||||||||||
else: | ||||||||||
return 'merge' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💬 suggestion: A docstring would be nice here imo if the function is meant to be used elsewhere