Skip to content

Commit

Permalink
Remove upg branch dependency
Browse files Browse the repository at this point in the history
Makefile: separate testupg binary from build-linux
Update README.md
  • Loading branch information
blewater committed Aug 11, 2021
1 parent 9f8be7a commit 8f5857f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'
build:
go build -mod=readonly $(BUILD_FLAGS) -o build/emd$(BIN_PREFIX) ./cmd/emd

emdupg:
docker run --rm --entrypoint cat emoney/test-upg /go/src/em-ledger/build/emd > "build/emdupg"
chmod +x "build/emdupg"

cosmovisor:
go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@latest

Expand All @@ -73,16 +69,17 @@ install:
build-test-upg:
docker run --rm --entrypoint cat emoney/cosmovisor /go/bin/cosmovisor > build/cosmovisor
chmod +x build/cosmovisor
docker run --rm --entrypoint cat emoney/test-upg /go/src/em-ledger/build/emd > "build/emdupg"
chmod +x "build/emdupg"
docker run --rm --entrypoint cat emoney/test-upg /go/src/em-ledger/build/emd-linux > "build/emdupg-linux"
chmod +x "build/emdupg-linux"
sed -i -e '/bep3.NewKeeper/r networks/upg/upgfunc.txt' app.go

build-linux:
# Linux images for docker-compose
# CGO_ENABLED=0 added to solve this issue: https://stackoverflow.com/a/36308464
BIN_PREFIX=-linux LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build

build-all: build-linux emdupg
build-all: build-linux build-test-upg
$(MAKE) build

build-docker:
Expand Down Expand Up @@ -118,7 +115,7 @@ license:
GO111MODULE=off go get github.com/google/addlicense/
addlicense -f LICENSE .

.PHONY: build build-linux emdupg cosmovisor clean test bdd-test build-docker license
.PHONY: build build-linux build-test-upg cosmovisor clean test bdd-test build-docker license

###############################################################################
### Protobuf ###
Expand Down
2 changes: 1 addition & 1 deletion networks/docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cosmovisor:
docker build cosmovisor --tag emoney/cosmovisor

test-upg:
docker build test-upg --tag emoney/test-upg
docker build test-upg --build-arg branch=$$(git rev-parse --abbrev-ref HEAD) --build-arg version=test-upg-0.2.0 --tag emoney/test-upg

# todo (reviewer): please note the rest-server is not a command anymore. Please enable `api` section in `app.toml` instead

Expand Down
7 changes: 6 additions & 1 deletion networks/docker/test-upg/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
FROM golang:1.16-buster

ARG branch
ARG version

# checkout and build linux binary
RUN cd /go/src && \
git clone https://github.com/e-money/em-ledger.git && \
cd em-ledger && \
git checkout test-upg-0.2.0 && \
git checkout $branch && \
sed -i -e '/bep3.NewKeeper/r networks/upg/upgfunc.txt' app.go && \
git tag $version && \
BIN_PREFIX=-linux LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 make build

# build MacOS binary
Expand Down
3 changes: 2 additions & 1 deletion networks/upg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Please note if you'd rather test the upgrade module within the **e-money local-t
```shell
cd em-ledger
make build-docker
make build-linux
make build-all
go test -v --tags="bdd" bdd_test.go upgrade_test.go
```

Expand All @@ -22,6 +22,7 @@ Note these scripts at **em-ledger/networks/upg**:
* `startcv` (starts a single e-money node with cosmovisor)
* `upg-sched` schedule an upgrade by passing the upgrade block height
* `upg-sched-srv` optional documentation setup and schedule command for upgrading with server downloaded binary
* `upgfunc.txt` Go snippet to be inserted as the upgrade module handler in the *upgrade* binary.

### Components installation
Build the revamped Docker, Linux artifacts
Expand Down

0 comments on commit 8f5857f

Please sign in to comment.