diff --git a/.drone.yml b/.drone.yml index b079a954..40ffd587 100644 --- a/.drone.yml +++ b/.drone.yml @@ -10,15 +10,28 @@ steps: GITHUB_TOKEN: from_secret: github_token - name: collect - image: publicawesome/stargaze:develop + image: publicawesome/stargaze:0.9.1 commands: - sh ./check.sh + - name: runner + image: publicawesome/stargaze:0.9.1 + detach: true + commands: + - apk add jq + - sh ./run.sh + - name: check_runner + image: alpine:3 + commands: + - apk add curl + - apk add jq + - sh ./check-running-node.sh + trigger: event: - pull_request --- kind: signature -hmac: 74faa35fc712dd6a99de2f8bfa716b1775485b116b9d549810cfcee1ffbef285 +hmac: 682577d282dcaedb9d72319d71325feecb71e29b15bbe021d1ee51188b197818 ... diff --git a/check-running-node.sh b/check-running-node.sh new file mode 100755 index 00000000..bbeef519 --- /dev/null +++ b/check-running-node.sh @@ -0,0 +1,6 @@ +#/bin/sh +FILE=./check-gen-tx +if [ -f "$FILE" ]; then + sleep 50 + curl http://runner:26657/status +fi diff --git a/run.sh b/run.sh new file mode 100644 index 00000000..87c18a8f --- /dev/null +++ b/run.sh @@ -0,0 +1,46 @@ +#/bin/sh +FILE=./check-gen-tx +DENOM=ustarx +CHAIN_ID=cygnusx-1 +ONE_HOUR=3600 +ONE_DAY=$(($ONE_HOUR * 24)) +ONE_YEAR=$(($ONE_DAY * 365)) +VALIDATOR_COINS=1000000000000$DENOM + + +if [ -f "$FILE" ]; then + starsd init validator --chain-id cygnusx-1 + if [ "$1" == "mainnet" ] + then + LOCKUP=ONE_YEAR + else + LOCKUP=ONE_DAY + fi + echo "Lockup period is $LOCKUP" + + echo "Adding vesting accounts..." + GENESIS_TIME=$(jq '.genesis_time' ~/.starsd/config/genesis.json | tr -d '"') + echo "Genesis time is $GENESIS_TIME" + if [[ "$OSTYPE" == "darwin"* ]]; then + GENESIS_UNIX_TIME=$(TZ=UTC gdate "+%s" -d $GENESIS_TIME) + else + GENESIS_UNIX_TIME=$(TZ=UTC date "+%s" -d $GENESIS_TIME) + fi + vesting_start_time=$(($GENESIS_UNIX_TIME + $LOCKUP)) + vesting_end_time=$(($vesting_start_time + $LOCKUP)) + + sed -i 's#tcp://127.0.0.1:26657#tcp://0.0.0.0:26657#g' ~/.starsd/config/config.toml + mkdir -p ~/.starsd/config/gentx + echo "Processing validators..." + for i in $CHAIN_ID/gentx/*.json; do + echo $i + starsd add-genesis-account $(jq -r '.body.messages[0].delegator_address' $i) $VALIDATOR_COINS \ + --vesting-amount $VALIDATOR_COINS \ + --vesting-start-time $vesting_start_time \ + --vesting-end-time $vesting_end_time + cp $i ~/.starsd/config/gentx/ + done + starsd collect-gentxs + starsd validate-genesis + starsd start +fi