2019-10-31 14:57:29 +02:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2020-02-04 11:46:43 +02:00
|
|
|
|
|
|
|
"github.com/SAP/jenkins-library/pkg/telemetry"
|
2019-10-31 14:57:29 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// GitCommit ...
|
|
|
|
var GitCommit string
|
|
|
|
|
|
|
|
// GitTag ...
|
|
|
|
var GitTag string
|
|
|
|
|
2020-02-04 11:46:43 +02:00
|
|
|
func version(config versionOptions, telemetryData *telemetry.CustomData) {
|
2019-10-31 14:57:29 +02:00
|
|
|
|
|
|
|
gitCommit, gitTag := "<n/a>", "<n/a>"
|
|
|
|
|
|
|
|
if len(GitCommit) > 0 {
|
|
|
|
gitCommit = GitCommit
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(GitTag) > 0 {
|
|
|
|
gitTag = GitTag
|
|
|
|
}
|
|
|
|
|
2020-02-04 11:46:43 +02:00
|
|
|
fmt.Printf("piper-version:\n commit: \"%s\"\n tag: \"%s\"\n", gitCommit, gitTag)
|
2019-10-31 14:57:29 +02:00
|
|
|
}
|