Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #120 from EOSIO/merge-release-1.0.x-to-master
Browse files Browse the repository at this point in the history
Merge release/1.0.x to master for v1.0.0
  • Loading branch information
nksanthosh authored May 20, 2021
2 parents 83c0bb0 + 04cd28b commit 0962de0
Show file tree
Hide file tree
Showing 45 changed files with 7,855 additions and 1,620 deletions.
18 changes: 18 additions & 0 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -eu

# Create the environment variable that needs to be uploaded
GIT_SHORT_HASH=$(git log -1 --pretty=%h)

# export created environment variables (we do this separately, see: https://github.com/koalaman/shellcheck/wiki/SC2155)
export GIT_SHORT_HASH

IMAGE_BRANCH_TAG=$( echo ${BUILDKITE_BRANCH} | tr '/' '_' )
if [ $IMAGE_BRANCH_TAG = 'master' ]; then
IMAGE_BRANCH_TAG=latest
fi

export IMAGE_BRANCH_TAG

DOCKER_FILE_COMMIT_SHORT_HASH=$(git --no-pager log Dockerfile | head -1 | cut -d' ' -f2 | cut -c-7)
export DOCKER_FILE_COMMIT_SHORT_HASH
2 changes: 2 additions & 0 deletions .cicd/helpers/Dockerfile.db_query
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM postgres
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
44 changes: 44 additions & 0 deletions .cicd/helpers/db-query.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

set -e

function wait_nodeos_ready {
for (( i=0 ; i<10; i++ )); do
! curl -fs http://nodeos:8888/v1/chain/get_info || break
sleep 3
done
}

function block_info_row_number {
psql -c 'SELECT COUNT(*) from chain.block_info;' | head -3 | tail -1 | sed 's/^[ \t]*//'
}

wait_nodeos_ready

sleep 10

## first lets check the number of tables created in the chain schema
num_tables=$(psql -c "select count(*) from pg_stat_all_tables where schemaname='chain'" | head -3 | tail -1 | sed 's/^[ \t]*//')

if [[ $num_tables < 24 ]]; then
>&2 echo "expected at least 24 tables existed in the chain schema, only got ${num_tables}"
exit 1
fi

sleep 30

psql -c "select relname from pg_stat_all_tables where schemaname='chain' and (n_tup_ins - n_tup_del)=0;" > empty_tables
let num_empty_tables="$( cat empty_tables | wc -l ) - 4"

if [[ $num_empty_tables > 3 ]]; then
>&2 echo "expected no more than 3 empty tables, got $num_empty_tables empty tables"
tail +3 empty_tables | head -n -2 >&2
exit 1
fi

old_num_blocks=$(block_info_row_number)
sleep 10
if [[ $(block_info_row_number) = $old_num_blocks ]]; then
>&2 echo the number of rows in block_info did not increase after 10 seconds
exit 1
fi
16 changes: 16 additions & 0 deletions .cicd/helpers/docker-compose.test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "3.9"
services:
postgres-query:
build:
context: .
dockerfile: Dockerfile.db_query
command:
- db-query.sh
environment:
- PGUSER=postgres
- PGPASSWORD=password
- PGHOST=postgres
volumes:
- ./db-query.sh:/usr/local/bin/db-query.sh
depends_on:
- postgres
16 changes: 16 additions & 0 deletions .cicd/helpers/execute_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -x

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd $DIR

[ -f snapshot.bin ] || ./get_snapshot.sh
[ -f docker-compose.yaml ] || cp ../../docker-compose.yaml .

export DOCKER_EOSIO_TAG=${1:-develop}
if [[ "$BUILDKITE" == 'true' ]]; then
export DOCKER_HISTORY_TOOLS_TAG=$BUILDKITE_COMMIT
fi

docker-compose -f docker-compose.yaml -f docker-compose.test.yaml up -V --exit-code-from postgres-query
24 changes: 24 additions & 0 deletions .cicd/helpers/get_snapshot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#get xml with info about snapshots
curl -L https://snapshot.testnet.eos.io > snapshots.xml

#parse xml to get latest snaspshot
read_dom () {
local IFS=\>
read -d \< ENTITY CONTENT
}

LATEST_SNAPSHOT=""

while read_dom; do
if [[ $ENTITY = "Key" ]]; then
if [[ $CONTENT =~ "snapshots" ]]; then
LATEST_SNAPSHOT=$CONTENT
fi
fi
done < snapshots.xml

#get actual snapshot file and unzip
curl -L https://snapshot.testnet.eos.io/$LATEST_SNAPSHOT | tar -xzf -

mv snapshots/`ls snapshots` snapshot.bin
rm -rf snapshots.xml snapshots
45 changes: 45 additions & 0 deletions .cicd/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
env:
IMAGE_REPO: eosio/history-tools
#
# The following environment variables are exported by `hooks/pre-command`
# - IMAGE_BRANCH_TAG
# - GIT_SHORT_HASH
# - DOCKER_FILE_COMMIT_SHORT_HASH

steps:
- label: "Build docker image"
command:
- |
docker build --target base \
--cache-from ${IMAGE_REPO}:builder_base-${DOCKER_FILE_COMMIT_SHORT_HASH} \
--tag ${IMAGE_REPO}:builder_base-${DOCKER_FILE_COMMIT_SHORT_HASH} \
--build-arg BUILDKIT_INLINE_CACHE=1 \
"."
- |
docker build --cache-from ${IMAGE_REPO}:builder_base-${DOCKER_FILE_COMMIT_SHORT_HASH} \
--cache-from ${IMAGE_REPO}:${IMAGE_BRANCH_TAG} \
--tag ${IMAGE_REPO}:${GIT_SHORT_HASH} \
--tag ${IMAGE_REPO}:${IMAGE_BRANCH_TAG} \
--build-arg BUILDKIT_INLINE_CACHE=1 \
"."
- docker push ${IMAGE_REPO}:builder_base-${DOCKER_FILE_COMMIT_SHORT_HASH}
- docker push ${IMAGE_REPO}:${GIT_SHORT_HASH}
- docker push ${IMAGE_REPO}:${IMAGE_BRANCH_TAG}
agents:
queue: "automation-eks-eos-builder-fleet"

- wait

- label: "Run integration test against eos(develop)"
timeout: ${TIMEOUT:-10}
command: .cicd/helpers/execute_test.sh develop
agents:
queue: "automation-eks-eos-builder-fleet"

- wait

- label: "Run integration test against eos(release/2.1.x)"
timeout: ${TIMEOUT:-10}
command: .cicd/helpers/execute_test.sh release_2.1.x
agents:
queue: "automation-eks-eos-builder-fleet"
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ _book
*/dist
*/node_modules
*/package-lock.json
build*
build
.cicd
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ package-lock.json
_book
*.o
/CMakeLists.txt.user
.cicd/helpers/docker-compose.yaml
.cicd/helpers/snapshot.bin
18 changes: 0 additions & 18 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,18 +0,0 @@
[submodule "external/abieos"]
path = external/abieos
url = https://github.com/EOSIO/abieos.git
[submodule "external/fc"]
path = external/fc
url = https://github.com/EOSIO/fc.git
[submodule "external/appbase"]
path = external/appbase
url = https://github.com/EOSIO/appbase.git
[submodule "external/eos-vm"]
path = external/eos-vm
url = https://github.com/EOSIO/eos-vm.git
[submodule "external/libpqxx"]
path = external/libpqxx
url = https://github.com/jtv/libpqxx.git
[submodule "external/rocksdb"]
path = external/rocksdb
url = https://github.com/facebook/rocksdb.git
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit 0962de0

Please sign in to comment.