Skip to content

Commit

Permalink
Always use latest GoCD API version
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandro Heinzelmann committed Jan 30, 2020
1 parent 8c52f3a commit 3717d80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public GoServerApi setAdminCredentials(String username, String password) {

public Optional<PipelineConfig> fetchPipelineConfig(String pipelineName) {
String url = baseUrl + "/api/admin/pipelines/" + pipelineName;
return fetch(url, PipelineConfig.class, "v6", adminUser, adminPassword);
return fetch(url, PipelineConfig.class, null, adminUser, adminPassword);
}

public Optional<PipelineHistory> fetchPipelineHistory(String pipelineName) {
Expand All @@ -46,6 +46,10 @@ private static <T> Optional<T> fetch(String url, Class<T> clazz, String apiVer,
if (apiVer != null) {
conn.addRequestProperty("Accept", "application/vnd.go.cd." + apiVer + "+json");
}
else {
// Use latest API version (introduced in GoCD 19.8)
conn.addRequestProperty("Accept", "application/vnd.go.cd+json");
}
if (user != null) {
String auth = Base64.getEncoder().encodeToString((user + ":" + password).getBytes(StandardCharsets.UTF_8));
conn.addRequestProperty("Authorization", "Basic " + auth);
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
group = ch.adnovum.gong.notifier
baseVersion = 0.0.3
emailVersion = 0.0.3
goVersion = 18.7.0
baseVersion = 0.0.4
emailVersion = 0.0.4
goVersion = 19.8.0

0 comments on commit 3717d80

Please sign in to comment.