Fix up build
* Use `go mod download` for "vendor", as the `vendor/` dir is ignored by the build anyway. * Fix branch info embedding when not running in Travis. Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
		
							parent
							
								
									f71b449775
								
							
						
					
					
						commit
						f1e4a3f7b0
					
				|  | @ -38,7 +38,10 @@ ITERATION=$(git rev-list --count --all || echo 0) | ||||||
| DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" | DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" | ||||||
| COMMIT="$(git rev-parse --short HEAD || echo 0)" | COMMIT="$(git rev-parse --short HEAD || echo 0)" | ||||||
| 
 | 
 | ||||||
|  | GIT_BRANCH="$(git rev-parse --abbrev-ref HEAD || echo unknown)" | ||||||
|  | BRANCH="${TRAVIS_BRANCH:-${GIT_BRANCH}}" | ||||||
|  | 
 | ||||||
| # This is a custom download path for homebrew formula. | # This is a custom download path for homebrew formula. | ||||||
| SOURCE_PATH=https://golift.io/${BINARY}/archive/v${VERSION}.tar.gz | SOURCE_PATH=https://golift.io/${BINARY}/archive/v${VERSION}.tar.gz | ||||||
| 
 | 
 | ||||||
| export SOURCE_URL URL VVERSION VERSION ITERATION DATE COMMIT SOURCE_PATH | export SOURCE_URL URL VVERSION VERSION ITERATION DATE BRANCH COMMIT SOURCE_PATH | ||||||
|  |  | ||||||
							
								
								
									
										4
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										4
									
								
								Makefile
								
								
								
								
							|  | @ -46,7 +46,7 @@ endef | ||||||
| PLUGINS:=$(patsubst plugins/%/main.go,%,$(wildcard plugins/*/main.go)) | PLUGINS:=$(patsubst plugins/%/main.go,%,$(wildcard plugins/*/main.go)) | ||||||
| 
 | 
 | ||||||
| VERSION_LDFLAGS:= \
 | VERSION_LDFLAGS:= \
 | ||||||
|   -X github.com/prometheus/common/version.Branch=$(TRAVIS_BRANCH) \
 |   -X github.com/prometheus/common/version.Branch=$(BRANCH) \
 | ||||||
|   -X github.com/prometheus/common/version.BuildDate=$(DATE) \
 |   -X github.com/prometheus/common/version.BuildDate=$(DATE) \
 | ||||||
|   -X github.com/prometheus/common/version.Revision=$(COMMIT) \
 |   -X github.com/prometheus/common/version.Revision=$(COMMIT) \
 | ||||||
|   -X github.com/prometheus/common/version.Version=$(VERSION)-$(ITERATION) |   -X github.com/prometheus/common/version.Version=$(VERSION)-$(ITERATION) | ||||||
|  | @ -285,7 +285,7 @@ lint: | ||||||
| # This is safe; recommended even.
 | # This is safe; recommended even.
 | ||||||
| dep: vendor | dep: vendor | ||||||
| vendor: go.mod go.sum | vendor: go.mod go.sum | ||||||
| 	go mod vendor | 	go mod download | ||||||
| 
 | 
 | ||||||
| # Don't run this unless you're ready to debug untested vendored dependencies.
 | # Don't run this unless you're ready to debug untested vendored dependencies.
 | ||||||
| deps: update vendor | deps: update vendor | ||||||
|  |  | ||||||
|  | @ -19,8 +19,7 @@ RUN mkdir -p $GOPATH/pkg/mod $GOPATH/bin $GOPATH/src /${BINARY} | ||||||
| COPY . /${BINARY} | COPY . /${BINARY} | ||||||
| WORKDIR /${BINARY} | WORKDIR /${BINARY} | ||||||
| 
 | 
 | ||||||
| RUN go mod vendor \ | RUN CGO_ENABLED=0 make ${BINARY}.${ARCH}.${OS} | ||||||
|   && CGO_ENABLED=0 make ${BINARY}.${ARCH}.${OS} |  | ||||||
| 
 | 
 | ||||||
| FROM scratch | FROM scratch | ||||||
| ARG ARCH | ARG ARCH | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue