Clean up / document build and release

In writing better RELEASING docs, I realized the build was repeating
steps.  In fixing that I fixed some make deps, but realized I *still*
can't make the build ideal.

At least it is written down now...
This commit is contained in:
Tim Hockin 2019-01-25 10:45:09 -08:00
parent 3286e39b80
commit 497c7df123
3 changed files with 23 additions and 15 deletions

View File

@ -87,10 +87,19 @@ all-push: $(addprefix push-, $(ALL_PLATFORMS))
build: bin/$(OS)_$(ARCH)/$(BIN)
bin/$(OS)_$(ARCH)/$(BIN): build-dirs
BUILD_DIRS := bin/$(OS)_$(ARCH) .go/src/$(PKG) .go/pkg .go/bin .go/std/$(OS)_$(ARCH) .go/cache
# TODO: This is .PHONY because building Go code uses a compiler-internal DAG,
# so we have to run the go tool. Unfortunately, go always touches the binary
# during `go install` even if it didn't change anything (as per md5sum). This
# makes make unhappy. Better would be to run go, see that the result did not
# change, and then bypass further processing. Sadly not possible for now.
.PHONY: bin/$(OS)_$(ARCH)/$(BIN)
bin/$(OS)_$(ARCH)/$(BIN): $(BUILD_DIRS)
@echo "building: $@"
@docker run \
-i \
-ti \
--rm \
-u $$(id -u):$$(id -g) \
-v $$(pwd)/.go:/go \
-v $$(pwd):/go/src/$(PKG) \
@ -98,10 +107,9 @@ bin/$(OS)_$(ARCH)/$(BIN): build-dirs
-v $$(pwd)/bin/$(OS)_$(ARCH):/go/bin/$(OS)_$(ARCH) \
-v $$(pwd)/.go/std/$(OS)_$(ARCH):/usr/local/go/pkg/$(OS)_$(ARCH)_static \
-v $$(pwd)/.go/cache:/.cache \
-w /go/src/$(PKG) \
--env HTTP_PROXY=$(HTTP_PROXY) \
--env HTTPS_PROXY=$(HTTPS_PROXY) \
-w /go/src/$(PKG) \
--rm \
$(BUILD_IMAGE) \
/bin/sh -c " \
ARCH=$(ARCH) \
@ -141,7 +149,7 @@ push-name:
@echo "pushed: $(IMAGE):$(TAG)"
# This depends on github.com/estesp/manifest-tool in $PATH.
manifest-list: container
manifest-list: push
manifest-tool \
--username=oauth2accesstoken \
--password=$$(gcloud auth print-access-token) \
@ -153,7 +161,7 @@ manifest-list: container
version:
@echo $(VERSION)
test: build-dirs
test: $(BUILD_DIRS)
@docker run \
-ti \
-u $$(id -u):$$(id -g) \
@ -171,9 +179,8 @@ test: build-dirs
"
@./test_e2e.sh
build-dirs:
@mkdir -p bin/$(OS)_$(ARCH)
@mkdir -p .go/src/$(PKG) .go/pkg .go/bin .go/std/$(OS)_$(ARCH) .go/cache
$(BUILD_DIRS):
@mkdir -p $@
clean: container-clean bin-clean

View File

@ -12,13 +12,14 @@ v2.0.4
$ git tag -am "v2.0.5" v2.0.5
$ make container
$ make manifest-list
<...lots of output...>
container: staging-k8s.gcr.io/git-sync-amd64:v2.0.5
$ gcloud docker push -- staging-k8s.gcr.io/git-sync-amd64:v2.0.5
Successfully tagged staging-k8s.gcr.io/git-sync:v2.0.5__linux_amd64
<...lots of output...>
v2.0.5: digest: sha256:904833aedf3f14373e73296240ed44d54aecd4c02367b004452dfeca2465e5bf size: 950
v2.0.5__linux_amd64: digest: sha256:74cd8777ba08c7b725cd2f6de34a638ba50b48cde59f829e1dc982c8c8c9959a size: 951
pushed: staging-k8s.gcr.io/git-sync:v2.0.5__linux_amd64
<...lots of output...>
Digest: sha256:4d338888373809661b5a29314ca8024379b77c0afb53fd66d6821cf628f75438 433
```
Lastly, make a release through the [github UI](https://github.com/kubernetes/git-sync/releases).

View File

@ -38,7 +38,7 @@ fi
export CGO_ENABLED=0
export GOARCH="${ARCH}"
export GOOS="${OS}"
export GOFLAGS=-mod=vendor
export GOFLAGS="-mod=vendor"
go install \
-installsuffix "static" \