build: Add release builds, now generated with 'make release'

Currently supported platforms are

    - linux{amd64,arm,386}
    - winows{amd64,386}
    - darwin{amd64}
master
Harshavardhana 9 years ago
parent 781540081d
commit 223245cc45
  1. 2
      MAINTAINERS.md
  2. 11
      Makefile
  3. 12
      build-constants.go
  4. 48
      buildscripts/build.sh
  5. 2
      buildscripts/gen-ldflags.go
  6. 5
      release.cmd
  7. 6
      release.sh
  8. 7
      update-main.go

@ -34,4 +34,4 @@ $
`minio` doesn't follow semantic versioning style, `minio` instead uses the release date and time as the release versions. `minio` doesn't follow semantic versioning style, `minio` instead uses the release date and time as the release versions.
`make release` will install new released binary into your `GOPATH` `make release` will generate new binary into `release` directory.

@ -124,6 +124,9 @@ pkg-update:
pkg-remove: pkg-remove:
@GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/govendor remove $(PKG) @GO15VENDOREXPERIMENT=1 ${GOPATH}/bin/govendor remove $(PKG)
pkg-list:
@GO15VENDOREXPERIMENT=1 $(GOPATH)/bin/govendor list
install: gomake-all install: gomake-all
dockerimage: checkdocker verifiers $(UI_ASSETS) dockerimage: checkdocker verifiers $(UI_ASSETS)
@ -134,8 +137,11 @@ dockerimage: checkdocker verifiers $(UI_ASSETS)
@rmdir export @rmdir export
@rm minio.dockerimage @rm minio.dockerimage
release: release: verifiers
@./release.sh @MC_RELEASE=RELEASE GO15VENDOREXPERIMENT=1 ./buildscripts/build.sh
experimental: verifiers
@MC_RELEASE=EXPERIMENTAL GO15VENDOREXPERIMENT=1 ./buildscripts/build.sh
clean: clean:
@echo "Cleaning up all the generated files:" @echo "Cleaning up all the generated files:"
@ -143,3 +149,4 @@ clean:
@find . -name '*.test' | xargs rm -fv @find . -name '*.test' | xargs rm -fv
@rm -rf isa-l @rm -rf isa-l
@rm -rf build @rm -rf build
@rm -rf release

@ -17,8 +17,12 @@
package main package main
var ( var (
minioVersion = "UNOFFICIAL.GOGET" // minioVersion - version time.RFC3339.
minioReleaseTag = "UNOFFICIAL.GOGET" minioVersion = "DEVELOPMENT.GOGET"
minioCommitID = "UNOFFICIAL.GOGET" // minioReleaseTag - release tag in TAG.%Y-%m-%dT%H-%M-%SZ.
minioShortCommitID = minioCommitID[:] minioReleaseTag = "DEVELOPMENT.GOGET"
// minioCommitID - latest commit id.
minioCommitID = "DEVELOPMENT.GOGET"
// minioShortCommitID - first 12 characters from mcCommitID
minioShortCommitID = minioCommitID[:12]
) )

@ -0,0 +1,48 @@
#!/bin/bash
_init() {
# Save release LDFLAGS
LDFLAGS=$(go run buildscripts/gen-ldflags.go)
# Extract release tag
release_tag=$(echo $LDFLAGS | awk {'print $4'} | cut -f2 -d=)
# Verify release tag.
if [ -z "$release_tag" ]; then
echo "Release tag cannot be empty. Please check return value of \`go run buildscripts/gen-ldflags.go\`"
exit 1;
fi
# Extract release string.
release_str=$(echo $MC_RELEASE | tr '[:upper:]' '[:lower:]')
# Verify release string.
if [ -z "$release_str" ]; then
echo "Release string cannot be empty. Please set \`MC_RELEASE\` env variable."
exit 1;
fi
# List of supported architectures
SUPPORTED_OSARCH='linux/386 linux/amd64 linux/arm windows/386 windows/amd64 darwin/amd64'
}
go_build() {
local osarch=$1
os=$(echo $osarch | cut -f1 -d'/')
arch=$(echo $osarch | cut -f2 -d'/')
package=$(go list -f '{{.ImportPath}}')
echo -n "-->"
printf "%15s:%s\n" "${osarch}" "${package}"
GO15VENDOREXPERIMENT=1 GOOS=$os GOARCH=$arch go build --ldflags "${LDFLAGS}" -o $release_str/$os-$arch/$(basename $package).$release_tag
}
main() {
# Build releases.
echo "Executing $release_str builds for OS: ${SUPPORTED_OSARCH}"
for osarch in ${SUPPORTED_OSARCH}; do
go_build ${osarch}
done
}
# Run main.
_init && main

@ -37,7 +37,7 @@ func genLDFlags(version string) string {
// genReleaseTag prints release tag to the console for easy git tagging. // genReleaseTag prints release tag to the console for easy git tagging.
func releaseTag(version string) string { func releaseTag(version string) string {
relPrefix := "UNOFFICIAL" relPrefix := "DEVELOPMENT"
if prefix := os.Getenv("MINIO_RELEASE"); prefix != "" { if prefix := os.Getenv("MINIO_RELEASE"); prefix != "" {
relPrefix = prefix relPrefix = prefix
} }

@ -1,5 +0,0 @@
SET MINIO_RELEASE=OFFICIAL
SET GO15VENDOREXPERIMENT=1
go run buildscripts/gen-ldflags.go > temp.txt
SET /p LDFLAGS=<temp.txt
go build -ldflags="%LDFLAGS%" -o %GOPATH%\bin\minio.exe

@ -1,6 +0,0 @@
#!/bin/bash
echo -n "Making official release binaries.. "
export MINIO_RELEASE=OFFICIAL
make 1>/dev/null
echo "Binaries built at ${GOPATH}/bin/minio"

@ -121,8 +121,9 @@ func parseReleaseData(data string) (time.Time, *probe.Error) {
if releaseDateSplits[0] != "minio" { if releaseDateSplits[0] != "minio" {
return time.Time{}, probe.NewError(errors.New("Update data malformed, missing minio tag")) return time.Time{}, probe.NewError(errors.New("Update data malformed, missing minio tag"))
} }
if releaseDateSplits[1] != "OFFICIAL" { // "OFFICIAL" tag is still kept for backward compatibility, we should remove this for the next release.
return time.Time{}, probe.NewError(errors.New("Update data malformed, missing OFFICIAL tag")) if releaseDateSplits[1] != "RELEASE" && releaseDateSplits[1] != "OFFICIAL" {
return time.Time{}, probe.NewError(errors.New("Update data malformed, missing RELEASE tag"))
} }
dateSplits := strings.SplitN(releaseDateSplits[2], "T", 2) dateSplits := strings.SplitN(releaseDateSplits[2], "T", 2)
if len(dateSplits) < 2 { if len(dateSplits) < 2 {
@ -145,7 +146,7 @@ func getReleaseUpdate(updateURL string) {
data, e := http.Get(newUpdateURL) data, e := http.Get(newUpdateURL)
fatalIf(probe.NewError(e), "Unable to read from update URL ‘"+newUpdateURL+"’.", nil) fatalIf(probe.NewError(e), "Unable to read from update URL ‘"+newUpdateURL+"’.", nil)
if minioVersion == "UNOFFICIAL.GOGET" { if minioVersion == "DEVELOPMENT.GOGET" {
fatalIf(probe.NewError(errors.New("")), fatalIf(probe.NewError(errors.New("")),
"Update mechanism is not supported for ‘go get’ based binary builds. Please download official releases from https://minio.io/#minio", nil) "Update mechanism is not supported for ‘go get’ based binary builds. Please download official releases from https://minio.io/#minio", nil)
} }

Loading…
Cancel
Save