diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f11b75 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ diff --git a/Dockerfile b/Dockerfile index 38e3088..1ed08a6 100755 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,12 @@ FROM golang:1.9 WORKDIR /go/src/github.com/sjeandeaux/nexus-cli COPY . . -RUN go-wrapper download # "go get -d -v ./..." -RUN go-wrapper install # "go install -v ./..." +RUN go-wrapper download +RUN go-wrapper install -ldflags " \ + -X github.com/sjeandeaux/nexus-cli/information.Version=$(cat VERSION) \ + -X github.com/sjeandeaux/nexus-cli/information.BuildTime=$(date +"%Y-%m-%dT%H:%M:%S") \ + -X github.com/sjeandeaux/nexus-cli/information.GitCommit=$(git rev-parse --short HEAD) \ + -X github.com/sjeandeaux/nexus-cli/information.GitDescribe=$(git describe --tags --always) \ + -X github.com/sjeandeaux/nexus-cli/information.GitDirty=$(test -n "`git status --porcelain`" && echo "+CHANGES" || true)" -ENTRYPOINT ["go-wrapper" , "run"] \ No newline at end of file +ENTRYPOINT ["go-wrapper", "run"] \ No newline at end of file diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..0d91a54 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.3.0 diff --git a/information/information.go b/information/information.go new file mode 100644 index 0000000..050dcf6 --- /dev/null +++ b/information/information.go @@ -0,0 +1,17 @@ +package information + +import "fmt" + +//We use ldflags +var ( + Version = "No Version Provided" + GitCommit = "No GitCommit Provided" + GitDescribe = "No GitDescribe Provided" + GitDirty = "No GitDirty Provided" + BuildTime = "No BuildTime Provided" +) + + +func Print() string { + return fmt.Sprintf("%q-%q-%q-%q-%q", Version, BuildTime, GitCommit, GitDescribe, GitDirty) +} \ No newline at end of file diff --git a/main.go b/main.go index 6c660d9..97fc823 100755 --- a/main.go +++ b/main.go @@ -9,6 +9,7 @@ import ( "github.com/sjeandeaux/nexus-cli/repositorymanager" "os" + "github.com/sjeandeaux/nexus-cli/information" ) type enableHash []string @@ -58,7 +59,7 @@ func init() { //main upload artifact func main() { - + log.Logger.Println(information.Print()) repo := repositorymanager.NewRepository(commandLine.urlOfRepository, commandLine.user, commandLine.password) artifact, err := repositorymanager.NewArtifact(commandLine.groupID, commandLine.artifactID, commandLine.version, commandLine.file) diff --git a/repositorymanager/repositorymanager.go b/repositorymanager/repositorymanager.go index 6475977..106d0f5 100755 --- a/repositorymanager/repositorymanager.go +++ b/repositorymanager/repositorymanager.go @@ -20,6 +20,7 @@ import ( "github.com/sjeandeaux/nexus-cli/log" "errors" + "github.com/sjeandeaux/nexus-cli/information" ) const ( @@ -107,10 +108,10 @@ func generateURLIssue(h string) string { const ( title = "Move your ass" urlFormat = "https://github.com/sjeandeaux/nexus-cli/issues/new?title=%s&body=%s" - bodyFormat = "Could you add the hash %q lazy man?" + bodyFormat = "Could you add the hash %q lazy man?\n%s" ) escapedTitle := url.QueryEscape(title) - body := fmt.Sprintf(bodyFormat, h) + body := fmt.Sprintf(bodyFormat, h, information.Print()) escapedBody := url.QueryEscape(body) urlIssue := fmt.Sprintf(urlFormat, escapedTitle, escapedBody) return urlIssue