Skip to content

Commit e805bed

Browse files
GooglomGulom Alimovjliempt
authored
feat(orchestrator): add implementation for GitHub (#4525)
* add comments with examples to methods * a bit refactoring and cleanup * actionsURL * GetBuildStatus * GetBuildID, GetChangeSet, GetPipelineStartTime * GetStageName and GetBuildReason * refactor fetching jobs * GetJobName and GetJobURL * chnage GetBuildURL * refactor actionsURL * fix guessCurrentJob bug * unit tests for all * refactor GetLog * refactor and fix tests * change GetBuildURL to use env vars * fix issues * leftover * add comment * fix according to review comments --------- Co-authored-by: Gulom Alimov <[email protected]> Co-authored-by: Jordi van Liempt <[email protected]>
1 parent b766346 commit e805bed

File tree

5 files changed

+506
-271
lines changed

5 files changed

+506
-271
lines changed

pkg/orchestrator/azureDevOps.go

+5-8
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,17 @@ import (
1313

1414
type AzureDevOpsConfigProvider struct {
1515
client piperHttp.Client
16-
options piperHttp.ClientOptions
1716
apiInformation map[string]interface{}
1817
}
1918

2019
// InitOrchestratorProvider initializes http client for AzureDevopsConfigProvider
2120
func (a *AzureDevOpsConfigProvider) InitOrchestratorProvider(settings *OrchestratorSettings) {
22-
a.client = piperHttp.Client{}
23-
a.options = piperHttp.ClientOptions{
21+
a.client.SetOptions(piperHttp.ClientOptions{
2422
Username: "",
2523
Password: settings.AzureToken,
2624
MaxRetries: 3,
2725
TransportTimeout: time.Second * 10,
28-
}
29-
a.client.SetOptions(a.options)
26+
})
3027
log.Entry().Debug("Successfully initialized Azure config provider")
3128
}
3229

@@ -102,12 +99,12 @@ func (a *AzureDevOpsConfigProvider) GetBuildStatus() string {
10299
// cases to align with Jenkins: SUCCESS, FAILURE, NOT_BUILD, ABORTED
103100
switch buildStatus := getEnv("AGENT_JOBSTATUS", "FAILURE"); buildStatus {
104101
case "Succeeded":
105-
return "SUCCESS"
102+
return BuildStatusSuccess
106103
case "Canceled":
107-
return "ABORTED"
104+
return BuildStatusAborted
108105
default:
109106
// Failed, SucceededWithIssues
110-
return "FAILURE"
107+
return BuildStatusFailure
111108
}
112109
}
113110

0 commit comments

Comments
 (0)