File tree Expand file tree Collapse file tree 6 files changed +40
-374
lines changed
Expand file tree Collapse file tree 6 files changed +40
-374
lines changed Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ debug-dist: apply server webapp-debug bundle
248248
249249# # Runs any lints and unit tests defined for the server and webapp, if they exist.
250250.PHONY : test
251- test : webapp/.npminstall
251+ test : apply webapp/.npminstall
252252ifneq ($(HAS_SERVER ) ,)
253253 $(GO) test -v $(GO_TEST_FLAGS) -ldflags '$(LDFLAGS)' ./server/...
254254endif
Original file line number Diff line number Diff line change @@ -4,11 +4,18 @@ import (
44 "encoding/json"
55 "fmt"
66 "os"
7+ "strings"
78
89 "github.com/mattermost/mattermost/server/public/model"
910 "github.com/pkg/errors"
1011)
1112
13+ var (
14+ BuildHashShort string
15+ BuildTagLatest string
16+ BuildTagCurrent string
17+ )
18+
1219const pluginIDGoFileTemplate = `// This file is automatically generated. Do not modify it manually.
1320
1421package main
@@ -100,6 +107,32 @@ func findManifest() (*model.Manifest, error) {
100107 return nil , errors .Wrap (err , "failed to parse manifest" )
101108 }
102109
110+ // If no version is listed in the manifest, generate one based on the state of the current
111+ // commit, and use the first version we find (to prevent causing errors)
112+ if manifest .Version == "" {
113+ var version string
114+ tags := strings .Fields (BuildTagCurrent )
115+ for _ , t := range tags {
116+ if strings .HasPrefix (t , "v" ) {
117+ version = t
118+ break
119+ }
120+ }
121+ if version == "" {
122+ switch {
123+ case BuildTagLatest != "" && BuildHashShort != "" :
124+ version = BuildTagLatest + "+" + BuildHashShort
125+ case BuildTagLatest != "" :
126+ version = BuildTagLatest
127+ case BuildHashShort != "" :
128+ version = "v0.0.0+" + BuildHashShort
129+ default :
130+ version = "v0.0.0"
131+ }
132+ }
133+ manifest .Version = strings .TrimPrefix (version , "v" )
134+ }
135+
103136 return & manifest , nil
104137}
105138
Original file line number Diff line number Diff line change @@ -4,8 +4,13 @@ ifeq ($(GO),)
44 $(error "go is not available : see https://golang.org/doc/install")
55endif
66
7+ # Gather build variables to inject into the manifest tool
8+ BUILD_HASH_SHORT = $(shell git rev-parse --short HEAD)
9+ BUILD_TAG_LATEST = $(shell git describe --tags --match 'v* ' --abbrev=0 2>/dev/null)
10+ BUILD_TAG_CURRENT = $(shell git tag --points-at HEAD)
11+
712# Ensure that the build tools are compiled. Go's caching makes this quick.
8- $(shell cd build/manifest && $(GO) build -o ../bin/manifest)
13+ $(shell cd build/manifest && $(GO) build -ldflags '-X "main.BuildHashShort=$(BUILD_HASH_SHORT)" -X "main.BuildTagLatest=$(BUILD_TAG_LATEST)" -X "main.BuildTagCurrent=$(BUILD_TAG_CURRENT)"' - o ../bin/manifest)
914
1015# Ensure that the deployment tools are compiled. Go's caching makes this quick.
1116$(shell cd build/deploy && $(GO) build -o ../bin/deploy)
Original file line number Diff line number Diff line change 22 "id" : " com.mattermost.wrangler" ,
33 "name" : " Wrangler" ,
44 "description" : " Manage messages across teams and channels" ,
5- "version" : " 0.9.0" ,
65 "min_server_version" : " 10.11.0" ,
76 "server" : {
87 "executables" : {
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments