forked from SAP/jenkins-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransportRequestDocIDFromGit.go
39 lines (29 loc) · 1.16 KB
/
transportRequestDocIDFromGit.go
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
package cmd
import (
"github.com/SAP/jenkins-library/pkg/log"
"github.com/SAP/jenkins-library/pkg/telemetry"
)
func transportRequestDocIDFromGit(config transportRequestDocIDFromGitOptions,
telemetryData *telemetry.CustomData,
commonPipelineEnvironment *transportRequestDocIDFromGitCommonPipelineEnvironment) {
err := runTransportRequestDocIDFromGit(&config, telemetryData, &gitIDInRange{}, commonPipelineEnvironment)
if err != nil {
log.Entry().WithError(err).Fatal("step execution failed")
}
}
func runTransportRequestDocIDFromGit(config *transportRequestDocIDFromGitOptions,
telemetryData *telemetry.CustomData,
trUtils gitIDInRangeFinder,
commonPipelineEnvironment *transportRequestDocIDFromGitCommonPipelineEnvironment) error {
cdID, err := getChangeDocumentID(config, trUtils)
if err != nil {
return err
}
commonPipelineEnvironment.custom.changeDocumentID = cdID
log.Entry().Infof("Retrieved change document ID '%s' from Git.", cdID)
return nil
}
func getChangeDocumentID(config *transportRequestDocIDFromGitOptions,
trUtils gitIDInRangeFinder) (string, error) {
return trUtils.FindIDInRange(config.ChangeDocumentLabel, config.GitFrom, config.GitTo)
}