Skip to content

Commit

Permalink
fix: add etherscan_api_key to profiles.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mrekucci committed Dec 10, 2024
1 parent da297ab commit 02542a6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
34 changes: 23 additions & 11 deletions infrastructure/nomad/cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ environment_name="devenv"
profile_name="devnet"
datadog_key=""
l1_rpc_urls="mock"
etherscan_api_key=""
otel_collector_endpoint_url=""
genesis_file_url=""
geth_bootnode_url=""

help() {
echo "Usage:"
echo "$0 [init [--environment <name=devenv>] [--skip-certificates-setup] [--debug]]"
echo "$0 [deploy [version=HEAD] [--environment <name=devenv>] [--profile <name=devnet>] [--force-build-templates] [--no-logs-collection] [--datadog-key <key>] [--l1-rpc-urls <urls>] [--otel-collector-endpoint-url <url>] [--genesis-file-url <url>] [--geth-bootnode-url <url>] [--release] [--debug]]"
echo "$0 [deploy [version=HEAD] [--environment <name=devenv>] [--profile <name=devnet>] [--force-build-templates] [--no-logs-collection] [--datadog-key <key>] [--l1-rpc-urls <urls>] [--etherscan-api-key <key>] [--otel-collector-endpoint-url <url>] [--genesis-file-url <url>] [--geth-bootnode-url <url>] [--release] [--debug]]"
echo "$0 [destroy [--environment <name=devenv>] [--debug]]"
echo "$0 --help"
echo
Expand All @@ -33,15 +34,16 @@ help() {
echo " --debug Enable debug mode for detailed output."
echo
echo " deploy [version=HEAD] Deploy the specified artifact version (a git commit hash or an existing AWS S3 tag). If not specified or set to HEAD, a local build is triggered."
echo " --environment <name=devenv>] Specify the environment to use (default is devenv)."
echo " --profile <name=devnet>] Specify the profile to use (default is devnet)."
echo " --environment <name=devenv> Specify the environment to use (default is devenv)."
echo " --profile <name=devnet> Specify the profile to use (default is devnet)."
echo " --force-build-templates Force the build of all job templates before deployment."
echo " --no-logs-collection Disable the collection of logs from deployed jobs."
echo " --datadog-key <key>] Datadog API key, cannot be empty."
echo " --l1-rpc-urls <urls>] Comma separated list of L1 RPC URLs, cannot be empty."
echo " --otel-collector-endpoint-url <url>] OpenTelemetry Collector Endpoint URL, cannot be empty."
echo " --genesis-file-url <url>] URL to the genesis file, cannot be empty."
echo " --geth-bootnode-url <url>] URL to the Geth bootnode, cannot be empty."
echo " --datadog-key <key> Datadog API key, cannot be empty."
echo " --l1-rpc-urls <urls> Comma separated list of L1 RPC URLs, cannot be empty."
echo " --etherscan-api-key <key> Etherscan API key, cannot be empty."
echo " --otel-collector-endpoint-url <url> OpenTelemetry Collector Endpoint URL, cannot be empty."
echo " --genesis-file-url <url> URL to the genesis file, cannot be empty."
echo " --geth-bootnode-url <url> URL to the Geth bootnode, cannot be empty."
echo " --release It will ignore the specified deployment version and use the current HEAD tag as the build version."
echo " --debug Enable debug mode for detailed output."
echo
Expand All @@ -61,7 +63,7 @@ help() {
usage() {
echo "Usage:"
echo "$0 [init [--environment <name=devenv>] [--skip-certificates-setup] [--debug]]"
echo "$0 [deploy [version=HEAD] [--environment <name=devenv>] [--profile <name=devnet>] [--force-build-templates] [--no-logs-collection] [--datadog-key <key>] [--l1-rpc-urls <urls>] [--otel-collector-endpoint-url <url>] [--genesis-file-url <url>] [--geth-bootnode-url <url>] [--release] [--debug]]"
echo "$0 [deploy [version=HEAD] [--environment <name=devenv>] [--profile <name=devnet>] [--force-build-templates] [--no-logs-collection] [--datadog-key <key>] [--l1-rpc-urls <urls>] [--etherscan-api-key <key>] [--otel-collector-endpoint-url <url>] [--genesis-file-url <url>] [--geth-bootnode-url <url>] [--release] [--debug]]"
echo "$0 [destroy [--environment <name=devenv>] [--debug]]"
echo "$0 --help"
exit 1
Expand Down Expand Up @@ -123,8 +125,8 @@ check_deps() {
parse_args() {
while [[ $# -gt 0 ]]; do
if $init_flag || $deploy_flag || $destroy_flag; then
echo "Error: Only one of 'init', 'deploy', or 'destroy' can be specified."
usage
echo "Error: Only one of 'init', 'deploy', or 'destroy' can be specified."
usage
fi

key="$1"
Expand Down Expand Up @@ -201,6 +203,15 @@ parse_args() {
usage
fi
fi
if [[ $# -gt 0 && $1 == "--etherscan-api-key" ]]; then
if [[ $# -gt 1 && ! $2 =~ ^-- ]]; then
etherscan_api_key="$2"
shift 2
else
echo "Error: --etherscan-api-key requires a value."
usage
fi
fi
if [[ $# -gt 0 && $1 == "--otel-collector-endpoint-url" ]]; then
if [[ $# -gt 1 && ! $2 =~ ^-- ]]; then
otel_collector_endpoint_url="$2"
Expand Down Expand Up @@ -293,6 +304,7 @@ main() {
[[ "${force_build_templates_flag}" == true ]] && flags+=("--extra-vars" "build_templates=true")
[[ -n "${datadog_key}" ]] && flags+=("--extra-vars" "datadog_key=${datadog_key}")
[[ -n "${l1_rpc_urls}" ]] && flags+=("--extra-vars" "l1_rpc_urls=${l1_rpc_urls}")
[[ -n "${etherscan_api_key}" ]] && flags+=("--extra-vars" "etherscan_api_key=${etherscan_api_key}")
[[ -n "${otel_collector_endpoint_url}" ]] && flags+=("--extra-vars" "otel_collector_endpoint_url=${otel_collector_endpoint_url}")
[[ -n "${genesis_file_url}" ]] && flags+=("--extra-vars" "genesis_file_url=${genesis_file_url}")
[[ -n "${geth_bootnode_url}" ]] && flags+=("--extra-vars" "geth_bootnode_url=${geth_bootnode_url}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ job "{{ job.name }}" {
KEYSTORE_DIR="/local/data-{{ env "NOMAD_ALLOC_INDEX" }}/keystore"
KEYSTORE_FILENAME="{{ with secret "secret/data/mev-commit" }}{{ .Data.data.{% endraw %}{{ job.artifacts | selectattr('keystores', 'defined') | map(attribute='keystores') | first | list | first }}{% raw %}_filename }}{{ end }}"
KEYSTORE_PASSWORD="{{ with secret "secret/data/mev-commit" }}{{ .Data.data.{% endraw %}{{ job.artifacts | selectattr('keystores', 'defined') | map(attribute='keystores') | first | list | first }}{% raw %}_password }}{{ end }}"
ETHERSCAN_API_KEY="{{ with secret "secret/data/etherscan" }}{{ .Data.data.etherscan_api_key }}{{ end }}"
{% endraw %}
CHAIN_ID="{{ job.env['chain-id'] }}"
SCRIPT_PATH_PREFIX="local/contracts/scripts"
Expand Down Expand Up @@ -218,6 +217,7 @@ job "{{ job.name }}" {
{% if profile == 'testnet' %}
export RPC_URL="{{ job.env['l1_rpc_url'] }}"
export CHAIN_ID="17000"
export ETHERSCAN_API_KEY="{{ job.env['etherscan_api_key'] }}"
{% endif %}

{%- raw %}
Expand Down
1 change: 1 addition & 0 deletions infrastructure/nomad/playbooks/variables/profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ jobs:
env:
chain-id: "{{ environments[env].chain_id }}"
l1_rpc_url: "{{ resolved_l1_rpc_urls.split(',')[0] }}"
etherscan_api_key: "{{ etherscan_api_key }}"

mev_commit_dashboard: &mev_commit_dashboard_job
name: mev-commit-dashboard
Expand Down

0 comments on commit 02542a6

Please sign in to comment.