-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create template tot automate network deployment
- Loading branch information
1 parent
d75d429
commit c6de852
Showing
4 changed files
with
393 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"bellecour": { | ||
"STARTBLOCK": 4543300, | ||
"ERC1538_ADDRESS" : "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", | ||
"IEXECE_INTERFACE_TOKEN_CORE_ADDRESS" : "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", | ||
"APP_REGISTRY_ADDRESS" : "0xB1C52075b276f87b1834919167312221d50c9D16", | ||
"DATATSET_REGISTRY_ADDRESS" : "0x799DAa22654128d0C64d5b79eac9283008158730", | ||
"WORKERPOOL_REGISTRY_ADDRESS" : "0xC76A18c78B7e530A165c5683CB1aB134E21938B4" | ||
}, | ||
"c13": { | ||
"STARTBLOCK": 4543300, | ||
"ERC1538_ADDRESS" : "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", | ||
"IEXECE_INTERFACE_TOKEN_CORE_ADDRESS" : "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", | ||
"APP_REGISTRY_ADDRESS" : "0xB1C52075b276f87b1834919167312221d50c9D16", | ||
"DATATSET_REGISTRY_ADDRESS" : "0x799DAa22654128d0C64d5b79eac9283008158730", | ||
"WORKERPOOL_REGISTRY_ADDRESS" : "0xC76A18c78B7e530A165c5683CB1aB134E21938B4" | ||
}, | ||
"goerli": { | ||
"STARTBLOCK": 2564000, | ||
"ERC1538_ADDRESS" : "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", | ||
"IEXECE_INTERFACE_TOKEN_CORE_ADDRESS" : "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", | ||
"APP_REGISTRY_ADDRESS" : "0xB1C52075b276f87b1834919167312221d50c9D16", | ||
"DATATSET_REGISTRY_ADDRESS" : "0x799DAa22654128d0C64d5b79eac9283008158730", | ||
"WORKERPOOL_REGISTRY_ADDRESS" : "0xC76A18c78B7e530A165c5683CB1aB134E21938B4" | ||
}, | ||
"mainnet": { | ||
"STARTBLOCK": 9917600, | ||
"ERC1538_ADDRESS" : "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", | ||
"IEXECE_INTERFACE_TOKEN_CORE_ADDRESS" : "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", | ||
"APP_REGISTRY_ADDRESS" : "0xB1C52075b276f87b1834919167312221d50c9D16", | ||
"DATATSET_REGISTRY_ADDRESS" : "0x799DAa22654128d0C64d5b79eac9283008158730", | ||
"WORKERPOOL_REGISTRY_ADDRESS" : "0xC76A18c78B7e530A165c5683CB1aB134E21938B4" | ||
}, | ||
"rinkeby": { | ||
"STARTBLOCK": 6355862, | ||
"ERC1538_ADDRESS" : "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", | ||
"IEXECE_INTERFACE_TOKEN_CORE_ADDRESS" : "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", | ||
"APP_REGISTRY_ADDRESS" : "0xB1C52075b276f87b1834919167312221d50c9D16", | ||
"DATATSET_REGISTRY_ADDRESS" : "0x799DAa22654128d0C64d5b79eac9283008158730", | ||
"WORKERPOOL_REGISTRY_ADDRESS" : "0xC76A18c78B7e530A165c5683CB1aB134E21938B4" | ||
}, | ||
"viviani": { | ||
"STARTBLOCK": 5556000, | ||
"ERC1538_ADDRESS" : "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", | ||
"IEXECE_INTERFACE_TOKEN_CORE_ADDRESS" : "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", | ||
"APP_REGISTRY_ADDRESS" : "0xB1C52075b276f87b1834919167312221d50c9D16", | ||
"DATATSET_REGISTRY_ADDRESS" : "0x799DAa22654128d0C64d5b79eac9283008158730", | ||
"WORKERPOOL_REGISTRY_ADDRESS" : "0xC76A18c78B7e530A165c5683CB1aB134E21938B4" | ||
}, | ||
"test": { | ||
"STARTBLOCK": 0, | ||
"ERC1538_ADDRESS" : "0xC129e7917b7c7DeDfAa5Fff1FB18d5D7050fE8ca", | ||
"IEXECE_INTERFACE_TOKEN_CORE_ADDRESS" : "0xC129e7917b7c7DeDfAa5Fff1FB18d5D7050fE8ca", | ||
"APP_REGISTRY_ADDRESS" : "0xbB66c75dc79D21E8A5b9EF5DE346021082469892", | ||
"DATATSET_REGISTRY_ADDRESS" : "0xe325907A7E0E320A4dcBfAC0cBCda120e7788A0D", | ||
"WORKERPOOL_REGISTRY_ADDRESS" : "0xDaecE9E92C2414D1F4AFcf6B79d76A2491dfd6A6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash | ||
|
||
# Check if jq is installed | ||
if ! command -v jq &> /dev/null; then | ||
echo "jq is required but not installed. Please install jq to proceed." | ||
exit 1 | ||
fi | ||
|
||
# Function to replace placeholders in the template | ||
generate_yaml() { | ||
local network=$1 | ||
local config_file="config.json" | ||
local template_file="subgraph.bellecour.template.yaml" | ||
local output_file="subgraph.${network}.yaml" | ||
|
||
# Read values from config.json | ||
local start_block=$(jq -r ".${network}.STARTBLOCK" ${config_file}) | ||
local erc1538_address=$(jq -r ".${network}.ERC1538_ADDRESS" ${config_file}) | ||
local core_address=$(jq -r ".${network}.IEXECE_INTERFACE_TOKEN_CORE_ADDRESS" ${config_file}) | ||
local app_registry_address=$(jq -r ".${network}.APP_REGISTRY_ADDRESS" ${config_file}) | ||
local dataset_registry_address=$(jq -r ".${network}.DATATSET_REGISTRY_ADDRESS" ${config_file}) | ||
local workerpool_registry_address=$(jq -r ".${network}.WORKERPOOL_REGISTRY_ADDRESS" ${config_file}) | ||
|
||
# Replace placeholders in the template and create the output file | ||
sed -e "s/#NETWORK_NAME#/network: ${network}/g" \ | ||
-e "s/#STARTBLOCK#/startBlock: ${start_block}/g" \ | ||
-e "s|#ERC1538_ADDRESS#|address: \"${erc1538_address}\"|g" \ | ||
-e "s|#IEXECE_INTERFACE_TOKEN_CORE_ADDRESS#|address: \"${core_address}\"|g" \ | ||
-e "s|#APP_REGISTRY_ADDRESS#|address: \"${app_registry_address}\"|g" \ | ||
-e "s|#DATATSET_REGISTRY_ADDRESS#|address: \"${dataset_registry_address}\"|g" \ | ||
-e "s|#WORKERPOOL_REGISTRY_ADDRESS#|address: \"${workerpool_registry_address}\"|g" \ | ||
${template_file} > ${output_file} | ||
|
||
echo "Generated ${output_file}" | ||
} | ||
|
||
|
||
# Function to create the Jenkinsfile | ||
generate_jenkinsfile() { | ||
local network=$1 | ||
local jenkinsfile="Jenkinsfile_Subgraph_${network}" | ||
|
||
cat <<EOL > ${jenkinsfile} | ||
//Readme @ http://gitlab.iex.ec:30000/iexec/jenkins-library | ||
@Library('[email protected]') _ | ||
deploySubGraph( | ||
targetRemoteHost : 'azubgrpvx-thegraph-${network}.public.az2.internal', | ||
subgraphFolder: './', | ||
subgraphFilename: 'subgraph.${network}.yaml', | ||
subgraphVersionLabel: 'v1.0.0-rc.1', | ||
subgraphLabel: '${network}/poco-v5' | ||
) | ||
EOL | ||
|
||
echo "Generated ${jenkinsfile}" | ||
} | ||
|
||
# Check if the user provided a network name | ||
if [ -z "$1" ]; then | ||
echo "Usage: $0 <network-name>" | ||
exit 1 | ||
fi | ||
|
||
network_name=$1 | ||
|
||
# Generate the YAML file for the specified network | ||
generate_yaml ${network_name} | ||
generate_jenkinsfile ${network_name} |
Oops, something went wrong.