Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 1, 2017. It is now read-only.

Commitd9ba9c3

Browse files
committed
Merge pull request#159 from github/update-deployment-payloads
Update deployment docs to reflect reality
2 parents6a3231e +d2fb092 commitd9ba9c3

File tree

5 files changed

+123
-13
lines changed

5 files changed

+123
-13
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
kind:change
3+
title:New attributes for the Deployments API
4+
created_at:2014-05-19
5+
author_name:atmos
6+
---
7+
8+
We're continuing to iterate on the[Deployments API preview][deployments-preview], and we're starting to see it satisfy more and more use cases. Today we're introducing new attributes for Deployments and Deployment Statuses as well as a few payload changes.
9+
10+
**This is a breaking change for Deployment Status payloads**. If you're trying out this new API during its preview period, you'll need to update your code to continue working with it.
11+
12+
##API Changes
13+
14+
For Deployments we're introducing the concept of an`environment`. An environment is basically a unique identifier for a deployment target. Lots of people tend toward the concept of environments for staging, QA, user acceptance testing, etc. We hope this enhancement will enable more use cases for our users that deploy to multiple environments.
15+
16+
Deployments are also persisting the requested deployment`ref`. Previously we resolved a ref to the current SHA for that ref. Now we'll be keeping the ref around for historical purposes. This is especially helpful if you're deploying branches to verify them before you merge them into your default branch (e.g., "master").
17+
18+
##JSON Payload Changes
19+
20+
We're also adding a few attributes to the outbound Deployment payloads. We're now including the`ref` attribute so you know the branch or tag name that resolved to a specific SHA. The`environment` is also present.
21+
22+
##Webhook Changes
23+
24+
The Deployment Status payloads now embed the associated Deployment object. With this enhancement, Deployment Status events received via webhooks will have enough information to notify other systems, without having to call back to the GitHub API for the`environment`,`ref`, or payload that was deployed.
25+
26+
###Example Deployment JSON
27+
28+
<pre><codeclass="language-javascript">
29+
{
30+
"url": "https://api.github.com/repos/my-org/my-repo/deployments/392",
31+
"id": 392,
32+
"sha": "837db83be4137ca555d9a5598d0a1ea2987ecfee",
33+
"ref": "master",
34+
"environment": "staging",
35+
"payload": {
36+
"fe": [
37+
"fe1",
38+
"fe2",
39+
"fe3"
40+
]
41+
},
42+
"description": "ship it!",
43+
"creator": {
44+
"login": "my-org",
45+
"id": 521,
46+
"avatar_url": "https://avatars.githubusercontent.com/u/2988?",
47+
"type": "User"
48+
},
49+
"created_at": "2014-05-09T19:56:47Z",
50+
"updated_at": "2014-05-09T19:56:47Z",
51+
"statuses_url": "https://api.github.com/repos/my-org/my-repo/deployments/392/statuses"
52+
}
53+
</code></pre>
54+
55+
###Example Deployment Status JSON
56+
57+
<pre><codeclass="language-javascript">
58+
{
59+
"url": "https://api.github.com/repos/my-org/my-repo/deployments/396/statuses/1",
60+
"id": 1,
61+
"state": "success",
62+
"deployment": {
63+
"url": "https://api.github.com/repos/my-org/my-repo/deployments/396",
64+
"id": 392,
65+
"sha": "837db83be4137ca555d9a5598d0a1ea2987ecfee",
66+
"ref": "master",
67+
"payload": {
68+
"fe": [
69+
"fe1",
70+
"fe2",
71+
"fe3"
72+
]
73+
},
74+
"environment": "production",
75+
"description": "Deploying to production",
76+
"creator": {
77+
"login": "alysson-goldner",
78+
"id": 540,
79+
"type": "User"
80+
},
81+
"created_at": "2014-05-09T19:59:36Z",
82+
"updated_at": "2014-05-09T19:59:36Z",
83+
"statuses_url": "https://api.github.com/repos/my-org/my-repo/deployments/396/statuses"
84+
},
85+
"description": "Deployment succeeded",
86+
"target_url": "https://deploy.myorg.com/apps/my-repo/logs/420",
87+
"created_at": "2014-05-09T19:59:39Z",
88+
"updated_at": "2014-05-09T19:59:39Z",
89+
"deployment_url": "https://api.github.com/repos/my-org/my-repo/deployments/396"
90+
}
91+
</code></pre>
92+
93+
If you have any questions or feedback, please[get in touch][contact].
94+
95+
[contact]:https://github.com/contact?form[subject]=Deployments+API
96+
[deployments-preview]:https://developer.github.com/changes/2014-01-09-preview-the-new-deployments-api/

‎content/v3/activity/events/types.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ Key | Type | Description
8484
`sha` |`string` | The commit SHA for which this deployment was created.
8585
`name` |`string` | Name of repository for this deployment, formatted as`:owner/:repo`.
8686
`payload` |`string` | The optional extra information for this deployment.
87+
`environment`|`string` | The optional environment to deploy to. Default:`"production"`
8788
`description`|`string` | The optional human-readable description added to the deployment.
8889

8990

@@ -101,14 +102,11 @@ Events of this type are not visible in timelines, they are only used to trigger
101102

102103
Key | Type | Description
103104
----|------|-------------
104-
`sha` |`string` | The commit SHA for the associated deployment.
105-
`name` |`string` | Name of repository for the associated deployment, formatted as`:owner/:repo`.
106105
`state` |`string` | The new state. Can be`pending`,`success`,`failure`, or`error`.
107-
`payload` |`string` | The optional extra information for the associated deployment.
108106
`target_url` |`string` | The optional link added to the status.
107+
`deployment` |`hash` | The deployment that this status is associated with.
109108
`description`|`string` | The optional human-readable description added to the status.
110109

111-
112110
##DownloadEvent
113111

114112
Triggered when a new[download](/v3/repos/downloads/) is created.

‎content/v3/repos/deployments.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,15 @@ Name | Type | Description
128128
`ref`|`string`|**Required**. The ref to deploy. This can be a branch, tag, or sha.
129129
`force`|`boolean`| Optional parameter to bypass any ahead/behind checks or commit status checks. Default:`false`
130130
`payload`|`string` | Optional JSON payload with extra information about the deployment. Default:`""`
131+
`environment`|`string` | Optional name for the target deployment environment (e.g., production, staging, qa). Default:`"production"`
131132
`auto_merge`|`boolean`| Optional parameter to merge the default branch into the requested deployment branch if necessary. Default:`false`
132133
`description`|`string` | Optional short description. Default:`""`
133134

134135
####Example
135136

136137
<%= json\
137138
:ref => "topic-branch",
138-
:payload => "{\"environment\":\"production\",\"deploy_user\":\"atmos\",\"room_id\":123456}",
139+
:payload => "{\"user\":\"atmos\",\"room_id\":123456}",
139140
:description => "Deploying my sweet branch"
140141
%>
141142

@@ -167,7 +168,7 @@ Name | Type | Description
167168
###Response
168169

169170
<%= headers 200,:pagination => default_pagination_rels %>
170-
<%= json(:deployment_status) { |h|[h] } %>
171+
<%= json(:deployment_status) { |h|h.delete("deployment");[h] } %>
171172

172173
##Create a Deployment Status
173174

‎content/webhooks/index.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ Name | Description
7171
`commit_comment` | Any time a Commit is commented on.
7272
`create` | Any time a Repository, Branch, or Tag is created.
7373
`delete` | Any time a Branch or Tag is deleted.
74-
`deployment_status` | Any time a deployment for the Repository has a status update from the API.
7574
`deployment` | Any time a Repository has a new deployment created from the API.
75+
`deployment_status` | Any time a deployment for the Repository has a status update from the API.
7676
`fork` | Any time a Repository is forked.
7777
`gollum` | Any time a Wiki page is updated.
7878
`issue_comment` | Any time an Issue is commented on.

‎lib/resources.rb‎

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,27 +1572,42 @@ def text_html(response, status, head = {})
15721572
]
15731573

15741574
DEPLOYMENT={
1575+
"url"=>"https://api.github.com/repos/octocat/example/deployments/1",
15751576
"id"=>1,
15761577
"sha"=>"a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d",
1577-
"url"=>"https://api.github.com/repos/octocat/example/deployments/1",
1578+
"ref"=>"master",
1579+
"payload"=>{:task=>'deploy:migrate'},
1580+
"environment"=>"production",
1581+
"description"=>"Deploy request from hubot",
15781582
"creator"=>USER,
1579-
"payload"=>{:environment=>'production'},
15801583
"created_at"=>"2012-07-20T01:19:13Z",
15811584
"updated_at"=>"2012-07-20T01:19:13Z",
1582-
"description"=>"Deploy request from hubot",
15831585
"statuses_url"=>"https://api.github.com/repos/octocat/example/deployments/1/statuses"
15841586
}
15851587

15861588
DEPLOYMENT_STATUS={
1587-
"id"=>1,
15881589
"url"=>"https://api.github.com/repos/octocat/example/deployments/1/statuses/42",
1590+
"id"=>1,
15891591
"state"=>"success",
15901592
"creator"=>USER,
1591-
"payload"=>{:environment=>'production'},
1593+
"description"=>"Deploy request from hubot",
15921594
"target_url"=>"https://gist.github.com/628b2736d379f",
15931595
"created_at"=>"2012-07-20T01:19:13Z",
15941596
"updated_at"=>"2012-07-20T01:19:13Z",
1595-
"description"=>"Deploy request from hubot",
1597+
"deployment_url"=>"https://api.github.com/repos/octocat/example/deployments/1",
1598+
"deployment"=>{
1599+
"id"=>1,
1600+
"ref"=>"master",
1601+
"sha"=>"a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d",
1602+
"url"=>"https://api.github.com/repos/octocat/example/deployments/1",
1603+
"creator"=>USER,
1604+
"environment"=>"production",
1605+
"payload"=>{:task=>'deploy:migrate'},
1606+
"created_at"=>"2012-07-20T01:19:13Z",
1607+
"updated_at"=>"2012-07-20T01:19:13Z",
1608+
"description"=>"Deploy request from hubot",
1609+
"statuses_url"=>"https://api.github.com/repos/octocat/example/deployments/1/statuses"
1610+
}
15961611
}
15971612

15981613
SIMPLE_STATUS={

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp