Skip to content

Commit

Permalink
Use CLI args when passed for cirdl in Docker entrypoint (#927)
Browse files Browse the repository at this point in the history
* Use CLI args when passed for cirdl in Docker entrypoint

Signed-off-by: Slava <[email protected]>

* Increase CI timeout

Signed-off-by: Slava <[email protected]>

---------

Signed-off-by: Slava <[email protected]>
  • Loading branch information
veaceslavdoina authored Oct 1, 2024
1 parent 264bfa1 commit e1a02c8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 19 additions & 4 deletions docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit e1a02c8

Please sign in to comment.