Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
gfournieriExec committed Jul 10, 2024
1 parent 425ed76 commit 151f94f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 29 deletions.
23 changes: 12 additions & 11 deletions Jenkinsfile_Subgraph_generic
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
def userInput

node {
docker.image('node:18').inside('--user root') {
docker.image('node:20-alpine').inside('--user root') {
stage('Setup') {
checkout scm
}
Expand All @@ -22,7 +22,7 @@ node {
println "Selected service name: '${userInput.targetRemoteHost}'"
}
stage('Setup Docker image') {
sh 'apt install bash'
sh 'apk add jq'
}
stage('Building subgraph') {
// Print working directory and list files for debugging
Expand All @@ -31,6 +31,7 @@ node {
ls -la &&
chmod +x generate_subgraph.sh &&
cat generate_subgraph.sh &&
apk add bash &&
bash ./generate_subgraph.sh '${userInput.network}'
"""

Expand All @@ -47,12 +48,12 @@ node {
}
}
}
stage('Deploy SubGraph') {
deploySubGraph(
targetRemoteHost: "${userInput.targetRemoteHost}",
subgraphFolder: './',
subgraphFilename: "subgraph.${userInput.network}.yaml",
subgraphVersionLabel: 'v1.0.0-rc.1',
subgraphLabel: "${userInput.network}/poco-v5"
)
}
stage('Deploy SubGraph') {
deploySubGraph(
targetRemoteHost: "${userInput.targetRemoteHost}",
subgraphFolder: './',
subgraphFilename: "subgraph.${userInput.network}.yaml",
subgraphVersionLabel: 'v1.0.0-rc.1',
subgraphLabel: "${userInput.network}/poco-v5"
)
}
29 changes: 11 additions & 18 deletions generate_subgraph.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/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
# 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

generate_yaml() {
local network=$1
Expand All @@ -13,19 +13,12 @@ generate_yaml() {
local output_file="subgraph.${network}.yaml"

# Read values from config.json
# local start_block=$(jq -r ".${network}.STARTBLOCK" ${config_file})
local start_block=$(echo ${config_file} | json ${network}.STARTBLOCK)
# local erc1538_address=$(jq -r ".${network}.ERC1538_ADDRESS" ${config_file})
local erc1538_address=$(echo ${config_file} | json ${network}.ERC1538_ADDRESS)
# local core_address=$(jq -r ".${network}.IEXECE_INTERFACE_TOKEN_CORE_ADDRESS" ${config_file})
local core_address=$(echo ${config_file} | json ${network}.IEXECE_INTERFACE_TOKEN_CORE_ADDRESS)
# local app_registry_address=$(jq -r ".${network}.APP_REGISTRY_ADDRESS" ${config_file})
local app_registry_address=$(echo ${config_file} | json ${network}.APP_REGISTRY_ADDRESS)
# local dataset_registry_address=$(jq -r ".${network}.DATATSET_REGISTRY_ADDRESS" ${config_file})
local dataset_registry_address=$(echo ${config_file} | json ${network}.DATATSET_REGISTRY_ADDRESS)
# local workerpool_registry_address=$(jq -r ".${network}.WORKERPOOL_REGISTRY_ADDRESS" ${config_file})
local workerpool_registry_address=$(echo ${config_file} | json ${network}.WORKERPOOL_REGISTRY_ADDRESS)

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" \
Expand Down

0 comments on commit 151f94f

Please sign in to comment.