Use CLI args when passed for cirdl in Docker entrypoint (#927)

* Use CLI args when passed for cirdl in Docker entrypoint

Signed-off-by: Slava <20563034+veaceslavdoina@users.noreply.github.com>

* Increase CI timeout

Signed-off-by: Slava <20563034+veaceslavdoina@users.noreply.github.com>

---------

Signed-off-by: Slava <20563034+veaceslavdoina@users.noreply.github.com>
This commit is contained in:
Slava 2024-10-01 16:05:22 +03:00 committed by GitHub
parent 264bfa17f5
commit e1a02c8b76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 5 deletions

View File

@ -26,7 +26,7 @@ jobs:
name: '${{ matrix.os }}-${{ matrix.cpu }}-${{ matrix.nim_version }}-${{ matrix.tests }}'
runs-on: ${{ matrix.builder }}
timeout-minutes: 90
timeout-minutes: 100
steps:
- name: Checkout sources
uses: actions/checkout@v4

View File

@ -1,6 +1,8 @@
#!/bin/bash
# Environment variables from files
# If set to file path, read the file and export the variables
# If set to directory path, read all files in the directory and export the variables
if [[ -n "${ENV_PATH}" ]]; then
set -a
[[ -f "${ENV_PATH}" ]] && source "${ENV_PATH}" || for f in "${ENV_PATH}"/*; do source "$f"; done
@ -53,15 +55,28 @@ fi
# Circuit downloader
# cirdl [circuitPath] [rpcEndpoint] [marketplaceAddress]
if [[ "$@" == *"prover"* ]]; then
echo "Run Circuit downloader"
# Set circuits dir from CODEX_CIRCUIT_DIR variables if set
echo "Prover is enabled - Run Circuit downloader"
# Set variables required by cirdl from command line arguments when passed
for arg in data-dir circuit-dir eth-provider marketplace-address; do
arg_value=$(grep -o "${arg}=[^ ,]\+" <<< $@ | awk -F '=' '{print $2}')
if [[ -n "${arg_value}" ]]; then
var_name=$(tr '[:lower:]' '[:upper:]' <<< "CODEX_${arg//-/_}")
export "${var_name}"="${arg_value}"
fi
done
# Set circuit dir from CODEX_CIRCUIT_DIR variables if set
if [[ -z "${CODEX_CIRCUIT_DIR}" ]]; then
export CODEX_CIRCUIT_DIR="${CODEX_DATA_DIR}/circuits"
fi
# Download circuits
# Download circuit
mkdir -p "${CODEX_CIRCUIT_DIR}"
chmod 700 "${CODEX_CIRCUIT_DIR}"
cirdl "${CODEX_CIRCUIT_DIR}" "${CODEX_ETH_PROVIDER}" "${CODEX_MARKETPLACE_ADDRESS}"
download="cirdl ${CODEX_CIRCUIT_DIR} ${CODEX_ETH_PROVIDER} ${CODEX_MARKETPLACE_ADDRESS}"
echo "${download}"
eval "${download}"
[[ $? -ne 0 ]] && { echo "Failed to download circuit files"; exit 1; }
fi