MCPcopy
hub / github.com/certbot/certbot / get_message

Function get_message

tools/notify_mattermost.py:26–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24 return random.choice(fun_greetings)
25
26def get_message():
27 fun_success_messages = [
28 'the certbot release is ready to come out of the oven!',
29 "it's release-finishing go time!",
30 'all certbot release systems are set for launch!',
31 ]
32
33 # https://learn.microsoft.com/en-us/rest/api/azure/devops/build/timeline/get?view=azure-devops-rest-7.1
34 timeline_url = f'https://dev.azure.com/{repo_name}/_apis/build/builds/{build_id}/timeline/?api-version=7.1'
35 response = requests.get(timeline_url)
36 response.raise_for_status()
37 data = response.json()
38 deploy_record = next((rec for rec in data['records'] if rec['name'] == 'Deploy'), None)
39 if deploy_record is None:
40 raise RuntimeError('Unable to find the record for the Deploy stage')
41 deploy_result = deploy_record['result']
42 if deploy_result in ['succeeded', 'succeededWithIssues']:
43 message = random.choice(fun_success_messages)
44 elif deploy_result in ['skipped', 'failed', 'abandoned']:
45 message = "the release pipeline has failed."
46 else:
47 raise RuntimeError('Unexpected stage result {0}'.format(deploy_result))
48 return message
49
50def get_mattermost_url():
51 # This should be a mattermost webhook url that posts to a specific channel,

Callers 1

get_contentFunction · 0.85

Calls 2

formatMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected