Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (60 loc) · 3.93 KB
/
Copy pathMakefile
File metadata and controls
69 lines (60 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
.PHONY: run logs console build test
CONTAINER_RUNTIME?=docker
REVISION=$(shell git -c core.abbrev=no describe --always --exclude='*' --long --dirty)
TAG?=latest
# Process images.json through the images-resolve-inherits and images-with-extras scripts
IMAGE_JSON=.image.json
.DELETE_ON_ERROR:
.image.json: SHELL=/bin/bash
.image.json: .SHELLFLAGS=-o pipefail -c
.image.json: images.json .scripts/images-resolve-inherits .scripts/images-with-extras .image.tag
< images.json .scripts/images-resolve-inherits | jq '.[] | select(.tag == "$(TAG)") | [ . ]' | .scripts/images-with-extras | jq '.[]' > $@
# Track TAG as a file so that .image.json regenerates when TAG changes
.image.tag: FORCE
@echo '$(TAG)' | cmp -s - $@ || echo '$(TAG)' > $@
FORCE:
# Extract configuration from selected image
XDR_REPO = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "xdr") | .repo')
XDR_SHA = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "xdr") | .sha')
CORE_REPO = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "core") | .repo')
CORE_SHA = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "core") | .sha')
CORE_OPTIONS = $(shell < $(IMAGE_JSON) jq -c '.deps[] | select(.name == "core") | .options // {}')
RPC_REPO = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "rpc") | .repo')
RPC_SHA = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "rpc") | .sha')
GALEXIE_REPO = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "galexie") | .repo')
GALEXIE_SHA = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "galexie") | .sha')
HORIZON_REPO = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "horizon") | .repo')
HORIZON_SHA = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "horizon") | .sha')
HORIZON_OPTIONS = $(shell < $(IMAGE_JSON) jq -c '.deps[] | select(.name == "horizon") | .options // {}')
FRIENDBOT_REPO = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "friendbot") | .repo')
FRIENDBOT_SHA = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "friendbot") | .sha')
FRIENDBOT_OPTIONS = $(shell < $(IMAGE_JSON) jq -c '.deps[] | select(.name == "friendbot") | .options // {}')
LAB_REPO = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "lab") | .repo')
LAB_SHA = $(shell < $(IMAGE_JSON) jq -r '.deps[] | select(.name == "lab") | .sha')
run:
$(CONTAINER_RUNTIME) run --rm -i --name stellar -p 8000:8000 -p 11626:11626 stellar/quickstart:$(TAG) --local
logs:
$(CONTAINER_RUNTIME) exec stellar /bin/sh -c 'tail -F /var/log/supervisor/*'
console:
$(CONTAINER_RUNTIME) exec -it stellar /bin/bash
build: $(IMAGE_JSON)
$(CONTAINER_RUNTIME) build -t stellar/quickstart:$(TAG) -f Dockerfile . \
--build-arg REVISION=$(REVISION) \
--build-arg XDR_REPO=$(XDR_REPO) --build-arg XDR_REF=$(XDR_SHA) \
--build-arg CORE_REPO="$(CORE_REPO)" --build-arg CORE_REF="$(CORE_SHA)" --build-arg CORE_OPTIONS='$(CORE_OPTIONS)' \
--build-arg RPC_REPO="$(RPC_REPO)" --build-arg RPC_REF="$(RPC_SHA)" \
--build-arg GALEXIE_REPO="$(GALEXIE_REPO)" --build-arg GALEXIE_REF="$(GALEXIE_SHA)" \
--build-arg HORIZON_REPO="$(HORIZON_REPO)" --build-arg HORIZON_REF="$(HORIZON_SHA)" --build-arg HORIZON_OPTIONS='$(HORIZON_OPTIONS)' \
--build-arg FRIENDBOT_REPO="$(FRIENDBOT_REPO)" --build-arg FRIENDBOT_REF="$(FRIENDBOT_SHA)" --build-arg FRIENDBOT_OPTIONS='$(FRIENDBOT_OPTIONS)' \
--build-arg LAB_REPO="$(LAB_REPO)" --build-arg LAB_REF=$(LAB_SHA)
# Run the same tests that CI runs against a running quickstart container.
# Build and run the container first with: make build run TAG=...
# These mirror the tests run in the CI workflow (.github/workflows/internal-test.yml)
test:
go run tests/test_core.go
go run tests/test_horizon_up.go
go run tests/test_horizon_core_up.go
go run tests/test_horizon_ingesting.go
go run tests/test_friendbot.go
go run tests/test_stellar_rpc_up.go
go run tests/test_stellar_rpc_healthy.go