mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-07 11:32:20 +00:00
44 lines
1.2 KiB
Bash
Executable File
44 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
datadir=$1
|
|
network=$2
|
|
|
|
if [ -z "$datadir" ]; then
|
|
echo "arguments: <your_datadir> <network_name>"
|
|
exit 1
|
|
fi
|
|
if [ -z "$network" ]; then
|
|
echo "arguments: <your_datadir> <network_name>"
|
|
exit 1
|
|
fi
|
|
|
|
#git reset --hard
|
|
#git checkout devel
|
|
#git pull
|
|
|
|
# clean
|
|
cd ./../erigon-snapshot
|
|
git reset --hard
|
|
git checkout auto
|
|
git pull --ff-only origin auto
|
|
cd ../erigon
|
|
|
|
# it will return only .seg of 500K (because Erigon send to Downloader only such files)
|
|
go run -trimpath ./cmd/downloader torrent_hashes --datadir="$datadir" --targetfile=./../erigon-snapshot/"$network".toml
|
|
cd ./../erigon-snapshot
|
|
git add "$network".toml
|
|
git commit -m "[ci]: $network, [from]: $HOSTNAME"
|
|
|
|
GH_TOKEN=""
|
|
GH_TOKEN_FILE=""
|
|
if ! gcloud -v <the_command> &> /dev/null
|
|
then
|
|
GH_TOKEN=$(gcloud secrets versions access 1 --secret="github-snapshot-push")
|
|
GH_TOKEN_FILE="~/.ssh/gh_rsa"
|
|
fi
|
|
|
|
# /dev/null to avoid logging of insecure git output
|
|
#SSH_CMD='echo ${GH_TOKEN} | ssh -i /dev/stdin -o IdentitiesOnly=yes'
|
|
SSH_CMD="ssh -i ${GH_TOKEN_FILE} -o IdentitiesOnly=yes"
|
|
GIT_SSH_COMMAND=${SSH_CMD} git push git@github.com:ledgerwatch/erigon-snapshot.git auto > /dev/null 2>&1
|
|
echo "Done" |