forked from honeydipper/honeydipper-config-essentials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjira.yaml
More file actions
141 lines (127 loc) · 4.63 KB
/
Copy pathjira.yaml
File metadata and controls
141 lines (127 loc) · 4.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
---
systems:
jira:
description: |
This system enables Honeydipper to integrate with `jira`, so Honeydipper can
react to jira events and take actions on jira.
meta:
configurations:
- name: jira_credential
description: The credential used for making API calls to `jira`
- name: token
description: >
A token used for authenticate incoming webhook requests, every webhook request
must carry a form field **Token** in the post body or url query that matches the value
- name: path
description: The path portion of the webhook url, by default :code:`/jira`
- name: jira_domain
description: Specify the jira domain, e.g. :code:`mycompany` for :code:`mycompany.atlassian.net`
notes:
- For example
- example: |
---
systems:
github:
data:
jira_credential: ENC[gcloud-kms,...masked...]
jira_domain: mycompany
token: ENC[gcloud-kms,...masked...]
path: "/webhook/jira"
- Assuming the domain name for the webhook server is :code:`myhoneydipper.com', you should
configure the webhook in your repo with url like below
- |
.. code-block::
https://myhoneydipper.com/webhook/jira?token=...masked...
data:
token: _place_holder_
path: "/jira"
jira_domain: _place_holder_
jira_credentials: _place_holder_
functions:
createTicket:
driver: web
rawAction: request
parameters:
method: POST
URL: https://{{ .sysData.jira_domain }}.atlassian.net/rest/api/2/issue/
header:
Authorization: Basic {{ .sysData.jira_credentials }}
Accept: application/json
Content-Type: application/json
content:
fields:
project:
key: $ctx.jira_project
summary: $ctx.ticket_title
description: $ctx.ticket_desc
issuetype:
name: '{{ .ctx.ticket_type | default "Task" }}'
export:
jira_ticket: $data.json.key
description: >
This function will create a jira ticket with given information
meta:
inputs:
- name: jira_project
description: The name of the jira project the ticket is created in
- name: ticket_title
description: A summary of the ticket
- name: ticket_desc
description: Detailed description of the work for this ticket
- name: ticket_type
description: The ticket type, by default :code:`Task`
exports:
- name: jira_ticket
description: The ticket number of the newly created ticket
notes:
- See below for example
- example: |
---
workflows:
create_jira_ticket:
call_function: jira.createTicket
with:
jira_project: devlops
ticket_title: upgrading kubernetes
ticket_desc: |
Upgrade the test cluster to kubernetes 1.16
addComment:
driver: web
rawAction: request
parameters:
method: POST
URL: https://{{ .sysData.jira_domain }}.atlassian.net/rest/api/2/issue/{{ .ctx.jira_ticket }}/comment
header:
Authorization: Basic {{ .sysData.jira_credentials }}
Accept: application/json
Content-Type: application/json
content:
body: $ctx.comment_body
description: >
This function will add a comment to the jira ticket
meta:
inputs:
- name: jira_ticket
description: The ticket number that the comment is for
- name: comment_body
description: Detailed description of the comment
notes:
- See below for example
- example: |
---
workflows:
post_comments:
call_function: jira.addComment
with:
jira_ticket: $ctx.jira_ticket
comment_body: |
Ticket has been created by Honeydipper.
triggers:
hit:
driver: webhook
if_match:
method: POST
form:
token: $sysData.token
url: $sysData.path
description: This is a generic trigger for jira webhook events.