Skip to content

Commit

Permalink
Add SlackAlertStep in remove_unpublished_sites pipeline (#2271)
Browse files Browse the repository at this point in the history
* Add SlackAlertStep in remove_unpublished_sites pipeline

* Add resources

* Add Slack alert for Abort
  • Loading branch information
ibrahimjaved12 authored Aug 19, 2024
1 parent 32941ac commit f81543e
Showing 1 changed file with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
TaskConfig,
TaskStep,
)
from ol_concourse.lib.resource_types import slack_notification_resource

from content_sync.constants import DEV_ENDPOINT_URL, VERSION_LIVE
from content_sync.pipelines.definitions.concourse.common.identifiers import (
Expand All @@ -33,6 +34,7 @@
from content_sync.pipelines.definitions.concourse.common.steps import (
ClearCdnCacheStep,
OcwStudioWebhookCurlStep,
SlackAlertStep,
)
from content_sync.utils import (
get_cli_endpoint_url,
Expand Down Expand Up @@ -87,6 +89,7 @@ def __init__(self, **kwargs):
HttpResourceType(),
S3IamResourceType(),
]
resources = []
unpublish_failed_webhook_across_step = OcwStudioWebhookCurlStep(
site_name="((.:site.name))",
data={"version": VERSION_LIVE, "status": "errored", "unpublished": True},
Expand Down Expand Up @@ -212,6 +215,22 @@ def __init__(self, **kwargs):
),
]
job = Job(name=self._remove_unpublished_sites_job_identifier, serial=True)

if not is_dev():
resource_types.append(slack_notification_resource())
resources.append(self._slack_resource)
job.on_failure = SlackAlertStep(
alert_type="failed",
text="""
Failed to remove unpublished site. Check the pipeline logs for more details.
""", # noqa: E501
)
job.on_abort = SlackAlertStep(
alert_type="aborted",
text="""
User aborted the unpublish operation for site. Check the pipeline logs for more details.
""", # noqa: E501
)
job.plan = tasks
base.__init__(resource_types=resource_types, jobs=[job], **kwargs)
base.__init__(
resource_types=resource_types, resources=resources, jobs=[job], **kwargs
)

0 comments on commit f81543e

Please sign in to comment.