Skip to content

Commit

Permalink
ci: Test with CometBFT v0.38.2 (#210)
Browse files Browse the repository at this point in the history
* ci: Test with CometBFT v0.38.0

Signed-off-by: Thane Thomson <[email protected]>

* Ensure group exists

Signed-off-by: Thane Thomson <[email protected]>

* Update directories for CometBFT

Signed-off-by: Thane Thomson <[email protected]>

* Bump Comet version used to v0.38.2

Signed-off-by: Thane Thomson <[email protected]>

---------

Signed-off-by: Thane Thomson <[email protected]>
  • Loading branch information
thanethomson authored Aug 19, 2024
1 parent 8aeb5fe commit 6158245
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 29 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ test:
go test -cover -race ./...
.PHONY: test

# Builds a Docker image called "tendermint/localnode", which is based on
# Builds a Docker image called "cometbft/localnode", which is based on
# Tendermint Core. Takes the current system user and group ID as the user/group
# IDs for the tmuser user within the container so as to eliminate permissions
# issues when generating testnet files in the localnet target.
localnode:
@docker build -f ./test/localnode/Dockerfile \
--build-arg UID=$(shell id -u) \
--build-arg GID=$(shell id -g) \
-t tendermint/localnode:latest \
-t cometbft/localnode:latest \
./test/localnode/
.PHONY: localnode

Expand All @@ -48,9 +48,9 @@ localnet: localnode
mkdir -p build && \
docker run \
--rm \
-v $(BUILD_DIR):/tendermint:Z \
tendermint/localnode \
testnet --config /etc/tendermint/config-template.toml --o . --starting-ip-address 192.168.10.2; \
-v $(BUILD_DIR):/cometbft:Z \
cometbft/localnode \
testnet --config /etc/cometbft/config-template.toml --o . --starting-ip-address 192.168.10.2; \
fi
.PHONY: localnet

Expand Down
24 changes: 12 additions & 12 deletions test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,56 @@ version: '3'
services:
node0:
container_name: node0
image: "tendermint/localnode"
image: "cometbft/localnode"
ports:
- "26656-26657:26656-26657"
environment:
- ID=0
- LOG=${LOG:-tendermint.log}
- LOG=${LOG:-cometbft.log}
volumes:
- ../build:/tendermint:Z
- ../build:/cometbft:Z
networks:
localnet:
ipv4_address: 192.168.10.2

node1:
container_name: node1
image: "tendermint/localnode"
image: "cometbft/localnode"
ports:
- "26659-26660:26656-26657"
environment:
- ID=1
- LOG=${LOG:-tendermint.log}
- LOG=${LOG:-cometbft.log}
volumes:
- ../build:/tendermint:Z
- ../build:/cometbft:Z
networks:
localnet:
ipv4_address: 192.168.10.3

node2:
container_name: node2
image: "tendermint/localnode"
image: "cometbft/localnode"
environment:
- ID=2
- LOG=${LOG:-tendermint.log}
- LOG=${LOG:-cometbft.log}
ports:
- "26661-26662:26656-26657"
volumes:
- ../build:/tendermint:Z
- ../build:/cometbft:Z
networks:
localnet:
ipv4_address: 192.168.10.4

node3:
container_name: node3
image: "tendermint/localnode"
image: "cometbft/localnode"
environment:
- ID=3
- LOG=${LOG:-tendermint.log}
- LOG=${LOG:-cometbft.log}
ports:
- "26663-26664:26656-26657"
volumes:
- ../build:/tendermint:Z
- ../build:/cometbft:Z
networks:
localnet:
ipv4_address: 192.168.10.5
Expand Down
10 changes: 6 additions & 4 deletions test/localnode/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM tendermint/tendermint:v0.34.24
FROM cometbft/cometbft:v0.38.2
LABEL maintainer="[email protected]"

ARG UID
Expand All @@ -10,19 +10,21 @@ RUN apk update && \
apk upgrade && \
apk --no-cache add curl jq file shadow

RUN groupadd -g ${GID} tmgroup || true

# Set the tmuser's UID and GID to the preconfigured values to match the host's
# UID/GID combo. Otherwise permissions become difficult to manage.
RUN usermod -u ${UID} -g ${GID} tmuser

USER tmuser

VOLUME /tendermint
WORKDIR /tendermint
VOLUME /cometbft
WORKDIR /cometbft

EXPOSE 26656 26657
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
CMD ["node", "--proxy_app", "kvstore"]
STOPSIGNAL SIGTERM

COPY entrypoint.sh /usr/bin/entrypoint.sh
COPY config-template.toml /etc/tendermint/config-template.toml
COPY config-template.toml /etc/cometbft/config-template.toml
16 changes: 8 additions & 8 deletions test/localnode/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
##
## Input parameters
##
BINARY=${BINARY:-/usr/bin/tendermint}
BINARY=${BINARY:-/usr/bin/cometbft}
ID=${ID:-0}
LOG=${LOG:-tendermint.log}
LOG=${LOG:-cometbft.log}

##
## Assert linux binary
##
if ! [ -f "${BINARY}" ]; then
echo "The binary $(basename "${BINARY}") cannot be found. Please add the binary to the shared folder. Please use the BINARY environment variable if the name of the binary is not 'tendermint' E.g.: -e BINARY=tendermint_my_test_version"
echo "The binary $(basename "${BINARY}") cannot be found. Please add the binary to the shared folder. Please use the BINARY environment variable if the name of the binary is not 'cometbft' E.g.: -e BINARY=cometbft_my_test_version"
exit 1
fi
BINARY_CHECK="$(file "$BINARY" | grep 'ELF 64-bit LSB executable, x86-64')"
Expand All @@ -25,14 +25,14 @@ id
##
## Run binary with all parameters
##
export TMHOME="/tendermint/node${ID}"
export CMTHOME="/cometbft/node${ID}"

if [ -d "`dirname ${TMHOME}/${LOG}`" ]; then
"$BINARY" "$@" | tee "${TMHOME}/${LOG}"
if [ -d "`dirname ${CMTHOME}/${LOG}`" ]; then
"$BINARY" "$@" | tee "${CMTHOME}/${LOG}"
else
"$BINARY" "$@"
fi

find /tendermint -type d -exec chmod ug=rwx,o=rx {} \;
find /tendermint -type f -exec chmod ug=rw,o=r {} \;
find /cometbft -type d -exec chmod ug=rwx,o=rx {} \;
find /cometbft -type f -exec chmod ug=rw,o=r {} \;

0 comments on commit 6158245

Please sign in to comment.