1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

make keeper script less noisy

This commit is contained in:
Matthias Kretschmann 2019-07-31 13:48:57 +02:00
parent 84db87d8d2
commit dbedaaecd0
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 45 additions and 36 deletions

View File

@ -31,7 +31,7 @@ script:
- export ETH_PORT=18545; npm run test:cover - export ETH_PORT=18545; npm run test:cover
- npm run build - npm run build
- npm run doc - npm run doc
- ./scripts/wait_for_migration_and_extract_keeper_artifacts.sh - ./scripts/keeper.sh
- npm run integration:cover - npm run integration:cover
- npm run report-coverage - npm run report-coverage

View File

@ -18,17 +18,17 @@
--- ---
- [Get started](#Get-started) - [Get started](#get-started)
- [Examples](#Examples) - [Examples](#examples)
- [Documentation](#Documentation) - [Documentation](#documentation)
- [Development](#Development) - [Development](#development)
- [Testing](#Testing) - [Testing](#testing)
- [Unit Tests](#Unit-Tests) - [Unit Tests](#unit-tests)
- [Integration Tests](#Integration-Tests) - [Integration Tests](#integration-tests)
- [Code Style](#Code-Style) - [Code Style](#code-style)
- [Production build](#Production-build) - [Production build](#production-build)
- [Releases](#Releases) - [Releases](#releases)
- [License](#License) - [License](#license)
--- ---
@ -142,7 +142,7 @@ In another terminal window, run this script and export the seed phrase:
```bash ```bash
# copies the contract artifacts once the local Ocean network is up and running # copies the contract artifacts once the local Ocean network is up and running
./scripts/wait_for_migration_and_extract_keeper_artifacts.sh ./scripts/keeper.sh
# export Spree accounts seed phrase # export Spree accounts seed phrase
export SEED_WORDS="taxi music thumb unique chat sand crew more leg another off lamp" export SEED_WORDS="taxi music thumb unique chat sand crew more leg another off lamp"
@ -215,3 +215,4 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
```

31
scripts/keeper.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
# Wait for contracts migration and extract Keeper artifacts
RETRY_COUNT=0
COMMAND_STATUS=1
printf '\n\e[33m◯ Waiting for contracts to be generated...\e[0m\n'
mkdir -p artifacts
until [ $COMMAND_STATUS -eq 0 ] || [ $RETRY_COUNT -eq 120 ]; do
keeper_contracts_docker_id=$(docker container ls | grep keeper-contracts | awk '{print $1}')
docker cp "${keeper_contracts_docker_id}":/keeper-contracts/artifacts/ready ./artifacts/ > /dev/null 2>&1
COMMAND_STATUS=$?
sleep 5
(( RETRY_COUNT=RETRY_COUNT+1 ))
done
printf '\e[32m✔ Found new contract artifacts.\e[0m\n'
rm -rf ./artifacts/
if [ $COMMAND_STATUS -ne 0 ]; then
echo "Waited for more than two minutes, but keeper contracts have not been migrated yet. Did you run an Ethereum RPC client and the migration script?"
exit 1
fi
docker cp "${keeper_contracts_docker_id}":/keeper-contracts/artifacts/. ./node_modules/@oceanprotocol/keeper-contracts/artifacts/
printf '\e[32m✔ Copied new contract artifacts.\e[0m\n'

View File

@ -1,23 +0,0 @@
#!/bin/bash
RETRY_COUNT=0
COMMAND_STATUS=1
mkdir -p artifacts
until [ $COMMAND_STATUS -eq 0 ] || [ $RETRY_COUNT -eq 120 ]; do
keeper_contracts_docker_id=$(docker container ls | grep keeper-contracts | awk '{print $1}')
docker cp ${keeper_contracts_docker_id}:/keeper-contracts/artifacts/ready ./artifacts/
COMMAND_STATUS=$?
sleep 5
let RETRY_COUNT=RETRY_COUNT+1
done
rm -rf ./artifacts/
if [ $COMMAND_STATUS -ne 0 ]; then
echo "Waited for more than two minutes, but keeper contracts have not been migrated yet. Did you run an Ethereum RPC client and the migration script?"
exit 1
fi
docker cp ${keeper_contracts_docker_id}:/keeper-contracts/artifacts/. ./node_modules/@oceanprotocol/keeper-contracts/artifacts/