Skip to content

Commit

Permalink
[CCIP-2944] Merge CCIP E2E Tests and CI into Core Repo (#14102)
Browse files Browse the repository at this point in the history
* [CCIP-2937] Copy ccip-tests and CI to Core (#14069)

* gitignore

* Fix gitignore

* Adds CCIP Tests Dir

* Adds CCIP CI

* [CCIP-2937] Fixes Conflicts and Run Issues with CCIP E2E Tests Merge (#14070)

* Fixes CI conflicts

* Fixes config path

* Separate CCIP smoke tests

* Change repo for compatibility tests

* Remove references to separate CCIP repo

* Callout needed updates

* Remove CCIP Upgrade Test

---------

Co-authored-by: asoliman <[email protected]>

* Fixes

* Go mod

* Ports over fixes for CCIP network tests

---------

Co-authored-by: asoliman <[email protected]>
  • Loading branch information
kalverra and asoliman92 authored Aug 14, 2024
1 parent 3399dd6 commit 8d332fd
Show file tree
Hide file tree
Showing 57 changed files with 23,038 additions and 16 deletions.
187 changes: 187 additions & 0 deletions .github/actions/setup-create-base64-config-ccip/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
name: Create Base64 Config for CCIP Tests
description: A composite action that creates a base64-encoded config to be used by ccip integration tests

inputs:
runId:
description: The run id
existingNamespace:
description: If test needs to run against already deployed namespace
testLogCollect:
description: Whether to always collect logs, even for passing tests
default: "false"
selectedNetworks:
description: The networks to run tests against
chainlinkImage:
description: The chainlink image to use
default: "public.ecr.aws/chainlink/chainlink"
chainlinkVersion:
description: The git commit sha to use for the image tag
upgradeImage:
description: The chainlink image to upgrade to
default: ""
upgradeVersion:
description: The git commit sha to use for the image tag
lokiEndpoint:
description: Loki push endpoint
lokiTenantId:
description: Loki tenant id
lokiBasicAuth:
description: Loki basic auth
logstreamLogTargets:
description: Where to send logs (e.g. file, loki)
grafanaUrl:
description: Grafana URL
grafanaDashboardUrl:
description: Grafana dashboard URL
grafanaBearerToken:
description: Grafana bearer token
customEvmNodes:
description: Custom EVM nodes to use in key=value format, where key is chain id and value is docker image to use. If they are provided the number of networksSelected must be equal to the number of customEvmNodes
evmNodeLogLevel:
description: Log level for the custom EVM nodes
default: "info"

runs:
using: composite
steps:
- name: Prepare Base64 TOML override
shell: bash
id: base64-config-override
env:
RUN_ID: ${{ inputs.runId }}
SELECTED_NETWORKS: ${{ inputs.selectedNetworks }}
EXISTING_NAMESPACE: ${{ inputs.existingNamespace }}
TEST_LOG_COLLECT: ${{ inputs.testLogCollect }}
CHAINLINK_IMAGE: ${{ inputs.chainlinkImage }}
CHAINLINK_VERSION: ${{ inputs.chainlinkVersion }}
UPGRADE_IMAGE: ${{ inputs.upgradeImage }}
UPGRADE_VERSION: ${{ inputs.upgradeVersion }}
LOKI_ENDPOINT: ${{ inputs.lokiEndpoint }}
LOKI_TENANT_ID: ${{ inputs.lokiTenantId }}
LOKI_BASIC_AUTH: ${{ inputs.lokiBasicAuth }}
LOGSTREAM_LOG_TARGETS: ${{ inputs.logstreamLogTargets }}
GRAFANA_URL: ${{ inputs.grafanaUrl }}
GRAFANA_DASHBOARD_URL: ${{ inputs.grafanaDashboardUrl }}
GRAFANA_BEARER_TOKEN: ${{ inputs.grafanaBearerToken }}
CUSTOM_EVM_NODES: ${{ inputs.customEvmNodes }}
EVM_NODE_LOG_LEVEL: ${{ inputs.evmNodeLogLevel }}
run: |
echo ::add-mask::$CHAINLINK_IMAGE
function convert_to_toml_array() {
local IFS=','
local input_array=($1)
local toml_array_format="["
for element in "${input_array[@]}"; do
toml_array_format+="\"$element\","
done
toml_array_format="${toml_array_format%,}]"
echo "$toml_array_format"
}
selected_networks=$(convert_to_toml_array "$SELECTED_NETWORKS")
log_targets=$(convert_to_toml_array "$LOGSTREAM_LOG_TARGETS")
if [ -n "$TEST_LOG_COLLECT" ]; then
test_log_collect=true
else
test_log_collect=false
fi
# make sure the number of networks and nodes match
IFS=',' read -r -a networks_array <<< "$SELECTED_NETWORKS"
IFS=',' read -r -a nodes_array <<< "$CUSTOM_EVM_NODES"
networks_count=${#networks_array[@]}
nodes_count=${#nodes_array[@]}
# Initialize or clear CONFIG_TOML environment variable
custom_nodes_toml=""
# Check if the number of CUSTOM_EVM_NODES is zero
if [ $nodes_count -eq 0 ]; then
echo "The number of CUSTOM_EVM_NODES is zero, won't output any custom private Ethereum network configurations."
else
if [ $networks_count -ne $nodes_count ]; then
echo "The number of elements in SELECTED_NETWORKS (${networks_count}) and CUSTOM_EVM_NODES does not match (${nodes_count})."
exit 1
else
for i in "${!networks_array[@]}"; do
IFS='=' read -r chain_id docker_image <<< "${nodes_array[i]}"
custom_nodes_toml+="
[CCIP.Env.PrivateEthereumNetworks.${networks_array[i]}]
ethereum_version=\"\"
execution_layer=\"\"
[CCIP.Env.PrivateEthereumNetworks.${networks_array[i]}.EthereumChainConfig]
seconds_per_slot=3
slots_per_epoch=2
genesis_delay=15
validator_count=4
chain_id=${chain_id}
addresses_to_fund=[\"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266\", \"0x70997970C51812dc3A010C7d01b50e0d17dc79C8\"]
node_log_level=\"${EVM_NODES_LOG_LEVEL}\"
[CCIP.Env.PrivateEthereumNetworks.${networks_array[i]}.EthereumChainConfig.HardForkEpochs]
Deneb=500
[CCIP.Env.PrivateEthereumNetworks.${networks_array[i]}.CustomDockerImages]
execution_layer=\"${docker_image}\"
"
done
fi
fi
grafana_bearer_token=""
if [ -n "$GRAFANA_BEARER_TOKEN" ]; then
grafana_bearer_token="bearer_token_secret=\"$GRAFANA_BEARER_TOKEN\""
fi
cat << EOF > config.toml
[CCIP]
[CCIP.Env]
EnvToConnect="$EXISTING_NAMESPACE"
[CCIP.Env.Network]
selected_networks = $selected_networks
[CCIP.Env.NewCLCluster]
[CCIP.Env.NewCLCluster.Common]
[CCIP.Env.NewCLCluster.Common.ChainlinkImage]
image="$CHAINLINK_IMAGE"
version="$CHAINLINK_VERSION"
[CCIP.Env.NewCLCluster.Common.ChainlinkUpgradeImage]
image="$UPGRADE_IMAGE"
version="$UPGRADE_VERSION"
$custom_nodes_toml
[CCIP.Env.Logging]
test_log_collect=$test_log_collect
run_id="$RUN_ID"
[CCIP.Env.Logging.LogStream]
log_targets=$log_targets
[CCIP.Env.Logging.Loki]
tenant_id="$LOKI_TENANT_ID"
endpoint="$LOKI_ENDPOINT"
basic_auth_secret="$LOKI_BASIC_AUTH"
[CCIP.Env.Logging.Grafana]
base_url="$GRAFANA_URL"
dashboard_url="$GRAFANA_DASHBOARD_URL"
$grafana_bearer_token
[CCIP.Groups.load]
TestRunName = '$EXISTING_NAMESPACE'
[CCIP.Groups.smoke]
TestRunName = '$EXISTING_NAMESPACE'
EOF
BASE64_CCIP_SECRETS_CONFIG=$(cat config.toml | base64 -w 0)
echo ::add-mask::$BASE64_CCIP_SECRETS_CONFIG
echo "BASE64_CCIP_SECRETS_CONFIG=$BASE64_CCIP_SECRETS_CONFIG" >> $GITHUB_ENV
echo "TEST_BASE64_CCIP_SECRETS_CONFIG=$BASE64_CCIP_SECRETS_CONFIG" >> $GITHUB_ENV
Loading

0 comments on commit 8d332fd

Please sign in to comment.