From d5392ff1608f41453e254af1103a5f6297bc55e0 Mon Sep 17 00:00:00 2001 From: nolash Date: Wed, 29 Sep 2021 06:39:39 +0200 Subject: [PATCH] Add state dir outputs for contract migration --- apps/contract-migration/config.sh | 8 +++++++- apps/contract-migration/reset.sh | 2 ++ apps/contract-migration/run_job.sh | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/contract-migration/config.sh b/apps/contract-migration/config.sh index 819b131c..1a39b576 100644 --- a/apps/contract-migration/config.sh +++ b/apps/contract-migration/config.sh @@ -5,7 +5,13 @@ set -a if [ -z $DEV_DATA_DIR ]; then export DEV_DATA_DIR=`mktemp -d` else - mkdir -p $DEV_DATA_DIR + mkdir -vp $DEV_DATA_DIR +fi + +if [ -z $STATE_DIR ]; then + export STATE_DIR=/run/cic_init + mkdir -vp $STATE_DIR + echo 0 > $STATE_DIR/init fi if [ -z $DEV_CONFIG_RESET ]; then diff --git a/apps/contract-migration/reset.sh b/apps/contract-migration/reset.sh index f4d45f7f..c60ea96a 100755 --- a/apps/contract-migration/reset.sh +++ b/apps/contract-migration/reset.sh @@ -117,6 +117,8 @@ export CIC_DEFAULT_TOKEN_SYMBOL=$CIC_DEFAULT_TOKEN_SYMBOL export TOKEN_NAME=$TOKEN_NAME " >> "${DEV_DATA_DIR}"/env_reset +echo -n $CIC_REGISTRY_ADDRESS > $STATE_DIR/registry + set +a set +e diff --git a/apps/contract-migration/run_job.sh b/apps/contract-migration/run_job.sh index 0df34361..c7101872 100644 --- a/apps/contract-migration/run_job.sh +++ b/apps/contract-migration/run_job.sh @@ -16,6 +16,7 @@ then >&2 echo -e "\033[;31mFAILED\033[;39m RUN_MASK 1 - contract deployment" exit 1; fi + echo -n 1 > $STATE_DIR/init >&2 echo -e "\033[;32mSUCCEEDED\033[;39m RUN_MASK 1 - contract deployment" fi @@ -27,5 +28,6 @@ then >&2 echo -e "\033[;31mFAILED\033[;39m RUN_MASK 2 - custodial service initialization" exit 1; fi + echo -n 2 > $STATE_DIR/init >&2 echo -e "\033[;32mSUCCEEDED\033[;39m RUN_MASK 2 - custodial service initialization" fi