1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
sap-jenkins-library/cmd/transportRequestDocIDFromGit.go
Roland Stengel 02dd60c0c8
Split git commit message scan from solman upload (#2773)
* Split git commit message scan from solman upload
2021-05-21 08:54:43 +02:00

40 lines
1.2 KiB
Go

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)
}