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

Appearance settings

Commit ed4f9c8

Browse filesBrowse files
authored
Merge pull request hub4j#960 from marcoferrer/update-deployments-api
Implement deployment API support for ant-man and flash previews
2 parents fdbbd2e + bbb46e8 commit ed4f9c8
Copy full SHA for ed4f9c8
Expand file treeCollapse file tree

18 files changed

+307
-14
lines changed

‎src/main/java/org/kohsuke/github/GHDeployment.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHDeployment.java
+45Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ public class GHDeployment extends GHObject {
2424
protected String statuses_url;
2525
protected String repository_url;
2626
protected GHUser creator;
27+
protected String original_environment;
28+
protected boolean transient_environment;
29+
protected boolean production_environment;
2730

2831
GHDeployment wrap(GHRepository owner) {
2932
this.owner = owner;
@@ -89,6 +92,19 @@ public Object getPayloadObject() {
8992
return payload;
9093
}
9194

95+
/**
96+
* The environment defined when the deployment was first created.
97+
*
98+
* @deprecated until preview feature has graduated to stable
99+
*
100+
* @return the original deployment environment
101+
*/
102+
@Deprecated
103+
@Preview(Previews.FLASH)
104+
public String getOriginalEnvironment() {
105+
return original_environment;
106+
}
107+
92108
/**
93109
* Gets environment.
94110
*
@@ -98,6 +114,33 @@ public String getEnvironment() {
98114
return environment;
99115
}
100116

117+
/**
118+
* Specifies if the given environment is specific to the deployment and will no longer exist at some point in the
119+
* future.
120+
*
121+
* @deprecated until preview feature has graduated to stable
122+
*
123+
* @return the environment is transient
124+
*/
125+
@Deprecated
126+
@Preview(Previews.ANT_MAN)
127+
public boolean isTransientEnvironment() {
128+
return transient_environment;
129+
}
130+
131+
/**
132+
* Specifies if the given environment is one that end-users directly interact with.
133+
*
134+
* @deprecated until preview feature has graduated to stable
135+
*
136+
* @return the environment is used by end-users directly
137+
*/
138+
@Deprecated
139+
@Preview(Previews.ANT_MAN)
140+
public boolean isProductionEnvironment() {
141+
return production_environment;
142+
}
143+
101144
/**
102145
* Gets creator.
103146
*
@@ -154,6 +197,8 @@ public GHDeploymentStatusBuilder createStatus(GHDeploymentState state) {
154197
public PagedIterable<GHDeploymentStatus> listStatuses() {
155198
return root.createRequest()
156199
.withUrlPath(statuses_url)
200+
.withPreview(Previews.ANT_MAN)
201+
.withPreview(Previews.FLASH)
157202
.toIterable(GHDeploymentStatus[].class, item -> item.wrap(owner));
158203
}
159204

‎src/main/java/org/kohsuke/github/GHDeploymentBuilder.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHDeploymentBuilder.java
+47-1Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ public class GHDeploymentBuilder {
1919
*/
2020
public GHDeploymentBuilder(GHRepository repo) {
2121
this.repo = repo;
22-
this.builder = repo.root.createRequest().method("POST");
22+
this.builder = repo.root.createRequest()
23+
.withPreview(Previews.ANT_MAN)
24+
.withPreview(Previews.FLASH)
25+
.method("POST");
2326
}
2427

2528
/**
@@ -40,6 +43,7 @@ public GHDeploymentBuilder(GHRepository repo, String ref) {
4043
*
4144
* @param branch
4245
* the branch
46+
*
4347
* @return the gh deployment builder
4448
*/
4549
public GHDeploymentBuilder ref(String branch) {
@@ -52,6 +56,7 @@ public GHDeploymentBuilder ref(String branch) {
5256
*
5357
* @param task
5458
* the task
59+
*
5560
* @return the gh deployment builder
5661
*/
5762
public GHDeploymentBuilder task(String task) {
@@ -64,6 +69,7 @@ public GHDeploymentBuilder task(String task) {
6469
*
6570
* @param autoMerge
6671
* the auto merge
72+
*
6773
* @return the gh deployment builder
6874
*/
6975
public GHDeploymentBuilder autoMerge(boolean autoMerge) {
@@ -76,6 +82,7 @@ public GHDeploymentBuilder autoMerge(boolean autoMerge) {
7682
*
7783
* @param requiredContexts
7884
* the required contexts
85+
*
7986
* @return the gh deployment builder
8087
*/
8188
public GHDeploymentBuilder requiredContexts(List<String> requiredContexts) {
@@ -88,6 +95,7 @@ public GHDeploymentBuilder requiredContexts(List<String> requiredContexts) {
8895
*
8996
* @param payload
9097
* the payload
98+
*
9199
* @return the gh deployment builder
92100
*/
93101
public GHDeploymentBuilder payload(String payload) {
@@ -100,18 +108,55 @@ public GHDeploymentBuilder payload(String payload) {
100108
*
101109
* @param environment
102110
* the environment
111+
*
103112
* @return the gh deployment builder
104113
*/
105114
public GHDeploymentBuilder environment(String environment) {
106115
builder.with("environment", environment);
107116
return this;
108117
}
109118

119+
/**
120+
* Specifies if the given environment is specific to the deployment and will no longer exist at some point in the
121+
* future.
122+
*
123+
* @deprecated until preview feature has graduated to stable
124+
*
125+
* @param transientEnvironment
126+
* the environment is transient
127+
*
128+
* @return the gh deployment builder
129+
*/
130+
@Deprecated
131+
@Preview(Previews.ANT_MAN)
132+
public GHDeploymentBuilder transientEnvironment(boolean transientEnvironment) {
133+
builder.with("transient_environment", transientEnvironment);
134+
return this;
135+
}
136+
137+
/**
138+
* Specifies if the given environment is one that end-users directly interact with.
139+
*
140+
* @deprecated until preview feature has graduated to stable
141+
*
142+
* @param productionEnvironment
143+
* the environment is used by end-users directly
144+
*
145+
* @return the gh deployment builder
146+
*/
147+
@Deprecated
148+
@Preview(Previews.ANT_MAN)
149+
public GHDeploymentBuilder productionEnvironment(boolean productionEnvironment) {
150+
builder.with("production_environment", productionEnvironment);
151+
return this;
152+
}
153+
110154
/**
111155
* Description gh deployment builder.
112156
*
113157
* @param description
114158
* the description
159+
*
115160
* @return the gh deployment builder
116161
*/
117162
public GHDeploymentBuilder description(String description) {
@@ -123,6 +168,7 @@ public GHDeploymentBuilder description(String description) {
123168
* Create gh deployment.
124169
*
125170
* @return the gh deployment
171+
*
126172
* @throws IOException
127173
* the io exception
128174
*/

‎src/main/java/org/kohsuke/github/GHDeploymentState.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHDeploymentState.java
+31-1Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,35 @@
44
* Represents the state of deployment
55
*/
66
public enum GHDeploymentState {
7-
PENDING, SUCCESS, ERROR, FAILURE
7+
PENDING,
8+
SUCCESS,
9+
ERROR,
10+
FAILURE,
11+
12+
/**
13+
* The state of the deployment currently reflects it's in progress.
14+
*
15+
* @deprecated until preview feature has graduated to stable
16+
*/
17+
@Deprecated
18+
@Preview(Previews.FLASH)
19+
IN_PROGRESS,
20+
21+
/**
22+
* The state of the deployment currently reflects it's queued up for processing.
23+
*
24+
* @deprecated until preview feature has graduated to stable
25+
*/
26+
@Deprecated
27+
@Preview(Previews.FLASH)
28+
QUEUED,
29+
30+
/**
31+
* The state of the deployment currently reflects it's no longer active.
32+
*
33+
* @deprecated until preview feature has graduated to stable
34+
*/
35+
@Deprecated
36+
@Preview(Previews.ANT_MAN)
37+
INACTIVE
838
}

‎src/main/java/org/kohsuke/github/GHDeploymentStatus.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHDeploymentStatus.java
+34Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@ public class GHDeploymentStatus extends GHObject {
1313
protected String state;
1414
protected String description;
1515
protected String target_url;
16+
protected String log_url;
1617
protected String deployment_url;
1718
protected String repository_url;
19+
protected String environment_url;
1820

1921
/**
2022
* Wrap gh deployment status.
2123
*
2224
* @param owner
2325
* the owner
26+
*
2427
* @return the gh deployment status
2528
*/
2629
public GHDeploymentStatus wrap(GHRepository owner) {
@@ -34,12 +37,30 @@ public GHDeploymentStatus wrap(GHRepository owner) {
3437
/**
3538
* Gets target url.
3639
*
40+
* @deprecated Target url is deprecated in favor of {@link #getLogUrl() getLogUrl}
41+
*
3742
* @return the target url
3843
*/
44+
@Deprecated
3945
public URL getTargetUrl() {
4046
return GitHubClient.parseURL(target_url);
4147
}
4248

49+
/**
50+
* Gets target url.
51+
* <p>
52+
* This method replaces {@link #getTargetUrl() getTargetUrl}}.
53+
*
54+
* @deprecated until preview feature has graduated to stable
55+
*
56+
* @return the target url
57+
*/
58+
@Deprecated
59+
@Preview(Previews.ANT_MAN)
60+
public URL getLogUrl() {
61+
return GitHubClient.parseURL(log_url);
62+
}
63+
4364
/**
4465
* Gets deployment url.
4566
*
@@ -49,6 +70,19 @@ public URL getDeploymentUrl() {
4970
return GitHubClient.parseURL(deployment_url);
5071
}
5172

73+
/**
74+
* Gets deployment environment url.
75+
*
76+
* @deprecated until preview feature has graduated to stable
77+
*
78+
* @return the deployment environment url
79+
*/
80+
@Deprecated
81+
@Preview(Previews.ANT_MAN)
82+
public URL getEnvironmentUrl() {
83+
return GitHubClient.parseURL(environment_url);
84+
}
85+
5286
/**
5387
* Gets repository url.
5488
*

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.