From 9387f22add7ecbf72118a4892ec7e90764c96dd1 Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Wed, 26 Mar 2025 15:32:34 +0100 Subject: [PATCH 01/19] test new deploySubGraph workflow inputs --- Jenkinsfile_Subgraph | 12 +++++ networks.json | 110 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 Jenkinsfile_Subgraph diff --git a/Jenkinsfile_Subgraph b/Jenkinsfile_Subgraph new file mode 100644 index 0000000..8ec91a9 --- /dev/null +++ b/Jenkinsfile_Subgraph @@ -0,0 +1,12 @@ +//Readme @ http://gitlab.iex.ec:30000/iexec/jenkins-library + +@Library('global-jenkins-library@feature/subgraph-networks') _ +deploySubGraph( + targetRemoteHostGraphNode : 'azubgrpbx-thegraph-staging.public.az2.internal', + targetRemoteHostIPFS : 'ipfs-upload.stagingv8.iex.ec', + subgraphFolder: './', + networkName: 'bellcour', + deployEnv: 'staging' + subgraphName: 'poco-v5' + subgraphVersionLabel: 'v1.1.0', +) diff --git a/networks.json b/networks.json index 9497c64..cd11679 100644 --- a/networks.json +++ b/networks.json @@ -42,5 +42,115 @@ "address": "0xC76A18c78B7e530A165c5683CB1aB134E21938B4", "startBlock": 4543300 } + }, + "c13": { + "ERC1538": { + "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", + "startBlock": 4543300 + }, + "Core": { + "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", + "startBlock": 4543300 + }, + "AppRegistry": { + "address": "0xB1C52075b276f87b1834919167312221d50c9D16", + "startBlock": 4543300 + }, + "DatasetRegistry": { + "address": "0x799DAa22654128d0C64d5b79eac9283008158730", + "startBlock": 4543300 + }, + "WorkerpoolRegistry": { + "address": "0xC76A18c78B7e530A165c5683CB1aB134E21938B4", + "startBlock": 4543300 + } + }, + "goerli": { + "ERC1538": { + "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", + "startBlock": 2564000 + }, + "Core": { + "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", + "startBlock": 2564000 + }, + "AppRegistry": { + "address": "0xB1C52075b276f87b1834919167312221d50c9D16", + "startBlock": 2564000 + }, + "DatasetRegistry": { + "address": "0x799DAa22654128d0C64d5b79eac9283008158730", + "startBlock": 2564000 + }, + "WorkerpoolRegistry": { + "address": "0xC76A18c78B7e530A165c5683CB1aB134E21938B4", + "startBlock": 2564000 + } + }, + "mainnet": { + "ERC1538": { + "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", + "startBlock": 9917600 + }, + "Core": { + "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", + "startBlock": 9917600 + }, + "AppRegistry": { + "address": "0xB1C52075b276f87b1834919167312221d50c9D16", + "startBlock": 9917600 + }, + "DatasetRegistry": { + "address": "0x799DAa22654128d0C64d5b79eac9283008158730", + "startBlock": 9917600 + }, + "WorkerpoolRegistry": { + "address": "0xC76A18c78B7e530A165c5683CB1aB134E21938B4", + "startBlock": 9917600 + } + }, + "rinkeby": { + "ERC1538": { + "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", + "startBlock": 6355862 + }, + "Core": { + "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", + "startBlock": 6355862 + }, + "AppRegistry": { + "address": "0xB1C52075b276f87b1834919167312221d50c9D16", + "startBlock": 6355862 + }, + "DatasetRegistry": { + "address": "0x799DAa22654128d0C64d5b79eac9283008158730", + "startBlock": 6355862 + }, + "WorkerpoolRegistry": { + "address": "0xC76A18c78B7e530A165c5683CB1aB134E21938B4", + "startBlock": 6355862 + } + }, + "viviani": { + "ERC1538": { + "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", + "startBlock": 5556000 + }, + "Core": { + "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", + "startBlock": 5556000 + }, + "AppRegistry": { + "address": "0xB1C52075b276f87b1834919167312221d50c9D16", + "startBlock": 5556000 + }, + "DatasetRegistry": { + "address": "0x799DAa22654128d0C64d5b79eac9283008158730", + "startBlock": 5556000 + }, + "WorkerpoolRegistry": { + "address": "0xC76A18c78B7e530A165c5683CB1aB134E21938B4", + "startBlock": 5556000 + } } } From b6ba760ef2cbaede45b01fadaf8e9381c374c409 Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Wed, 26 Mar 2025 15:47:34 +0100 Subject: [PATCH 02/19] Fix syntax in Jenkinsfile_Subgraph for deploySubGraph parameters --- Jenkinsfile_Subgraph | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_Subgraph b/Jenkinsfile_Subgraph index 8ec91a9..54f84a5 100644 --- a/Jenkinsfile_Subgraph +++ b/Jenkinsfile_Subgraph @@ -6,7 +6,7 @@ deploySubGraph( targetRemoteHostIPFS : 'ipfs-upload.stagingv8.iex.ec', subgraphFolder: './', networkName: 'bellcour', - deployEnv: 'staging' - subgraphName: 'poco-v5' + deployEnv: 'staging', + subgraphName: 'poco-v5', subgraphVersionLabel: 'v1.1.0', ) From 20f6f4343b79c2c30e44c3033f4bcc9f618ab599 Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Wed, 26 Mar 2025 16:14:03 +0100 Subject: [PATCH 03/19] add subgraph.yaml --- subgraph.yaml | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 subgraph.yaml diff --git a/subgraph.yaml b/subgraph.yaml new file mode 100644 index 0000000..5367360 --- /dev/null +++ b/subgraph.yaml @@ -0,0 +1,194 @@ +# SPDX-FileCopyrightText: 2020-2024 IEXEC BLOCKCHAIN TECH +# SPDX-License-Identifier: Apache-2.0 + +specVersion: 0.0.4 +description: iExecPoCoV5 +repository: https://github.com/iExecBlockchainComputing/PoCo-subgraph +schema: + file: ./schema.graphql +dataSources: + - name: ERC1538 + kind: ethereum/contract + source: + abi: ERC1538 + mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - ERC1538Module + - ERC1538Function + - ERC1538FunctionUpdateEvent + - ERC1538CommitMessageEvent + abis: + - name: ERC1538 + file: node_modules/@iexec/solidity/build/contracts/IERC1538.json + eventHandlers: + - event: CommitMessage(string) + handler: handleCommitMessage + - event: FunctionUpdate(indexed bytes4,indexed address,indexed address,string) + handler: handleFunctionUpdate + file: ./src/ERC1538/ERC1538.ts + + - name: Core + kind: ethereum/contract + source: + abi: IexecInterfaceToken + mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Category + - Account + - AppOrder + - DatasetOrder + - WorkerpoolOrder + - RequesterOrder + - Deal + - SchedulerNotice + - Task + - Contribution + - TaskInitialize + - TaskContribute + - TaskConsensus + - TaskReveal + - TaskReopen + - TaskFinalize + - TaskClaimed + - AccurateContribution + - FaultyContribution + - Transfer + - Reward + - Seize + - Lock + - Unlock + abis: + - name: IexecInterfaceToken + file: node_modules/@iexec/poco/artifacts/contracts/IexecInterfaceNative.sol/IexecInterfaceNative.json + eventHandlers: + - event: CreateCategory(uint256,string,string,uint256) + handler: handleCreateCategory + - event: OrdersMatched(bytes32,bytes32,bytes32,bytes32,bytes32,uint256) + handler: handleOrdersMatched + - event: SchedulerNotice(indexed address,bytes32) + handler: handleSchedulerNotice + - event: TaskInitialize(indexed bytes32,indexed address) + handler: handleTaskInitialize + - event: TaskContribute(indexed bytes32,indexed address,bytes32) + handler: handleTaskContribute + - event: TaskConsensus(indexed bytes32,bytes32) + handler: handleTaskConsensus + - event: TaskReveal(indexed bytes32,indexed address,bytes32) + handler: handleTaskReveal + - event: TaskReopen(indexed bytes32) + handler: handleTaskReopen + - event: TaskFinalize(indexed bytes32,bytes) + handler: handleTaskFinalize + - event: TaskClaimed(indexed bytes32) + handler: handleTaskClaimed + - event: AccurateContribution(indexed address,indexed bytes32) + handler: handleAccurateContribution + - event: FaultyContribution(indexed address,indexed bytes32) + handler: handleFaultyContribution + - event: Transfer(indexed address,indexed address,uint256) + handler: handleTransfer + - event: Reward(address,uint256,bytes32) + handler: handleReward + - event: Seize(address,uint256,bytes32) + handler: handleSeize + - event: Lock(address,uint256) + handler: handleLock + - event: Unlock(address,uint256) + handler: handleUnlock + callHandlers: # require trace_filter access + - function: matchOrders((address,uint256,uint256,bytes32,address,address,address,bytes32,bytes),(address,uint256,uint256,bytes32,address,address,address,bytes32,bytes),(address,uint256,uint256,bytes32,uint256,uint256,address,address,address,bytes32,bytes),(address,uint256,address,uint256,address,uint256,address,uint256,bytes32,uint256,uint256,address,address,string,bytes32,bytes)) + handler: handleMatchOrders + file: ./src/Modules/index.ts + + # =============================== App registry ================================ + - name: AppRegistry + kind: ethereum/contract + source: + abi: AppRegistry + mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - App + - AppTransfer + abis: + - name: App + file: node_modules/@iexec/poco/build/contracts/App.json + - name: AppRegistry + file: node_modules/@iexec/poco/build/contracts/AppRegistry.json + eventHandlers: + - event: Transfer(indexed address,indexed address,indexed uint256) + handler: handleTransferApp + file: ./src/Registries/index.ts + + # ============================= Dataset registry ============================== + - name: DatasetRegistry + kind: ethereum/contract + source: + abi: DatasetRegistry + mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Dataset + - DatasetTransfer + abis: + - name: Dataset + file: node_modules/@iexec/poco/build/contracts/Dataset.json + - name: DatasetRegistry + file: node_modules/@iexec/poco/build/contracts/DatasetRegistry.json + eventHandlers: + - event: Transfer(indexed address,indexed address,indexed uint256) + handler: handleTransferDataset + file: ./src/Registries/index.ts + + # ============================ Workerpool registry ============================ + - name: WorkerpoolRegistry + kind: ethereum/contract + source: + abi: WorkerpoolRegistry + mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Workerpool + - WorkerpoolTransfer + abis: + - name: Workerpool + file: node_modules/@iexec/poco/build/contracts/Workerpool.json + - name: WorkerpoolRegistry + file: node_modules/@iexec/poco/build/contracts/WorkerpoolRegistry.json + eventHandlers: + - event: Transfer(indexed address,indexed address,indexed uint256) + handler: handleTransferWorkerpool + file: ./src/Registries/index.ts + +# ============================ Workerpool template ============================ +templates: + - name: Workerpool + kind: ethereum/contract + source: + abi: Workerpool + mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Workerpool + - PolicyChange + abis: + - name: Workerpool + file: node_modules/@iexec/poco/build/contracts/Workerpool.json + eventHandlers: + - event: PolicyUpdate(uint256,uint256,uint256,uint256) + handler: handlePolicyUpdate + file: ./src/Registries/index.ts From e118d42d64fb89619174bf81ae90401624675259 Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Wed, 26 Mar 2025 16:15:10 +0100 Subject: [PATCH 04/19] update gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 37c75ed..bd5172e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,4 @@ build generated yarn.lock test/.bin -subgraph.yaml subgraph.test.yaml From a0941e5671790b72b14d953644fdf253fce9615a Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Wed, 26 Mar 2025 16:30:26 +0100 Subject: [PATCH 05/19] typo --- Jenkinsfile_Subgraph | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_Subgraph b/Jenkinsfile_Subgraph index 54f84a5..7d76c87 100644 --- a/Jenkinsfile_Subgraph +++ b/Jenkinsfile_Subgraph @@ -5,7 +5,7 @@ deploySubGraph( targetRemoteHostGraphNode : 'azubgrpbx-thegraph-staging.public.az2.internal', targetRemoteHostIPFS : 'ipfs-upload.stagingv8.iex.ec', subgraphFolder: './', - networkName: 'bellcour', + networkName: 'bellecour', deployEnv: 'staging', subgraphName: 'poco-v5', subgraphVersionLabel: 'v1.1.0', From 67156cc553547059fcef379714ab19644408f137 Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Wed, 26 Mar 2025 17:22:58 +0100 Subject: [PATCH 06/19] use user inputs --- Jenkinsfile_Subgraph | 71 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile_Subgraph b/Jenkinsfile_Subgraph index 7d76c87..6296d97 100644 --- a/Jenkinsfile_Subgraph +++ b/Jenkinsfile_Subgraph @@ -1,12 +1,61 @@ -//Readme @ http://gitlab.iex.ec:30000/iexec/jenkins-library +def userInput -@Library('global-jenkins-library@feature/subgraph-networks') _ -deploySubGraph( - targetRemoteHostGraphNode : 'azubgrpbx-thegraph-staging.public.az2.internal', - targetRemoteHostIPFS : 'ipfs-upload.stagingv8.iex.ec', - subgraphFolder: './', - networkName: 'bellecour', - deployEnv: 'staging', - subgraphName: 'poco-v5', - subgraphVersionLabel: 'v1.1.0', -) +node { + stage('Choose deployment parameters') { + timeout(time: 5, unit: 'MINUTES') { + userInput = input( + id: 'deployment-params', + message: 'Select deployment parameters', + parameters: [ + choice( + name: 'networkName', + choices: ['bellecour', 'goerli', 'mainnet'], + description: 'Select the target network' + ), + choice( + name: 'environment', + choices: ['staging','tmp','prod'], + description: 'Select deployment environment' + ), + string( + name: 'versionLabel', + defaultValue: 'v1.0.0', + description: 'Version label for the deployment' + ), + string( + name: 'subgraphName', + defaultValue: 'poco-v5', + description: 'Name of the subgraph' + ) + ] + ) + } + + // Define host mappings + def hosts = [ + 'staging': [ + 'graphNode': 'azubgrpbx-thegraph-staging.public.az2.internal', + 'ipfs': 'ipfs-upload.stagingv8.iex.ec' + ], + 'tmp': [ + 'graphNode': 'azubgrpbx-thegraph-staging.public.az2.internal', + 'ipfs': 'ipfs-upload.stagingv8.iex.ec' + ], + 'prod': [ + 'graphNode': 'azubgrpbp-thegraph.public.az2.internal', + 'ipfs': 'ipfs-upload.v8-bellecour.iex.ec' + ] + ] + + // Call deploySubGraph with user inputs + deploySubGraph( + targetRemoteHostGraphNode: hosts[userInput.environment].graphNode, + targetRemoteHostIPFS: hosts[userInput.environment].ipfs, + subgraphFolder: './', + networkName: userInput.networkName, + deployEnv: userInput.environment, + subgraphName: userInput.subgraphName, + subgraphVersionLabel: userInput.versionLabel + ) + } +} From 66a9053653f353ad2a823c531bcdcb8853a27fba Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Wed, 26 Mar 2025 17:24:28 +0100 Subject: [PATCH 07/19] point tmp to prod --- Jenkinsfile_Subgraph | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_Subgraph b/Jenkinsfile_Subgraph index 6296d97..1c3d3f5 100644 --- a/Jenkinsfile_Subgraph +++ b/Jenkinsfile_Subgraph @@ -38,8 +38,8 @@ node { 'ipfs': 'ipfs-upload.stagingv8.iex.ec' ], 'tmp': [ - 'graphNode': 'azubgrpbx-thegraph-staging.public.az2.internal', - 'ipfs': 'ipfs-upload.stagingv8.iex.ec' + 'graphNode': 'azubgrpbp-thegraph.public.az2.internal', + 'ipfs': 'ipfs-upload.v8-bellecour.iex.ec' ], 'prod': [ 'graphNode': 'azubgrpbp-thegraph.public.az2.internal', From 81999a3d64185a23aae98044f55747596589485c Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Wed, 26 Mar 2025 17:31:05 +0100 Subject: [PATCH 08/19] just consle log --- Jenkinsfile_Subgraph | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Jenkinsfile_Subgraph b/Jenkinsfile_Subgraph index 1c3d3f5..16555e6 100644 --- a/Jenkinsfile_Subgraph +++ b/Jenkinsfile_Subgraph @@ -47,6 +47,20 @@ node { ] ] + // Print user inputs and resolved hosts + println """ + ========== Deployment Parameters ========== + Network Name: ${userInput.networkName} + Environment: ${userInput.environment} + Version Label: ${userInput.versionLabel} + Subgraph Name: ${userInput.subgraphName} + + ========== Resolved Hosts ========== + Graph Node: ${hosts[userInput.environment].graphNode} + IPFS: ${hosts[userInput.environment].ipfs} + ======================================= + """ + // Call deploySubGraph with user inputs deploySubGraph( targetRemoteHostGraphNode: hosts[userInput.environment].graphNode, From e353d7fa8e0e7b516689c9d1b42453029428ce80 Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Wed, 26 Mar 2025 17:35:12 +0100 Subject: [PATCH 09/19] get back the library --- Jenkinsfile_Subgraph | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Jenkinsfile_Subgraph b/Jenkinsfile_Subgraph index 16555e6..0dad9f7 100644 --- a/Jenkinsfile_Subgraph +++ b/Jenkinsfile_Subgraph @@ -1,3 +1,7 @@ + +//Readme @ http://gitlab.iex.ec:30000/iexec/jenkins-library + +@Library('global-jenkins-library@feature/subgraph-networks') _ def userInput node { From b73e3b567d628ca8b16e3e43fed5ccd986d6a4d5 Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Wed, 26 Mar 2025 17:35:26 +0100 Subject: [PATCH 10/19] remove logs --- Jenkinsfile_Subgraph | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/Jenkinsfile_Subgraph b/Jenkinsfile_Subgraph index 0dad9f7..40b6dd3 100644 --- a/Jenkinsfile_Subgraph +++ b/Jenkinsfile_Subgraph @@ -50,21 +50,7 @@ node { 'ipfs': 'ipfs-upload.v8-bellecour.iex.ec' ] ] - - // Print user inputs and resolved hosts - println """ - ========== Deployment Parameters ========== - Network Name: ${userInput.networkName} - Environment: ${userInput.environment} - Version Label: ${userInput.versionLabel} - Subgraph Name: ${userInput.subgraphName} - ========== Resolved Hosts ========== - Graph Node: ${hosts[userInput.environment].graphNode} - IPFS: ${hosts[userInput.environment].ipfs} - ======================================= - """ - // Call deploySubGraph with user inputs deploySubGraph( targetRemoteHostGraphNode: hosts[userInput.environment].graphNode, From 948c49514153a181ea26a3c1004ad1bdc1e77e68 Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Wed, 26 Mar 2025 17:54:10 +0100 Subject: [PATCH 11/19] update name --- Jenkinsfile | 115 +++++++++++++++++++++++++++------------------------- 1 file changed, 60 insertions(+), 55 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c2d0824..182f1a7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,63 +1,68 @@ -@Library('global-jenkins-library@2.7.7') _ +//Readme @ http://gitlab.iex.ec:30000/iexec/jenkins-library + +@Library('global-jenkins-library@feature/subgraph-networks') _ def userInput node { - docker.image('node:20-alpine').inside('--user root') { - stage('Setup') { - checkout scm - } - - stage('Choose network and host') { - timeout(time: 5, unit: 'MINUTES') { - userInput = input( - id: 'select-deployment', - message: 'Select environment & service', - parameters: [ - string(name: 'network', description: 'Target network name of the subgraph'), - string(name: 'targetRemoteHost', description: 'Hostname where to deploy the subgraph') - ] - ) - } - echo "Selected network: '${userInput.network}'" - echo "Selected hostname: '${userInput.targetRemoteHost}'" - } - - stage('Setup Docker Image') { - sh 'apk add jq bash' + stage('Choose deployment parameters') { + timeout(time: 5, unit: 'MINUTES') { + userInput = input( + id: 'deployment-params', + message: 'Select deployment parameters', + parameters: [ + choice( + name: 'networkName', + choices: ['bellecour', 'goerli', 'mainnet'], + description: 'Select the target network' + ), + choice( + name: 'environment', + choices: ['staging','tmp','prod'], + description: 'Select deployment environment' + ), + string( + name: 'versionLabel', + defaultValue: 'v1.0.0', + description: 'Version label for the deployment' + ), + string( + name: 'subgraphName', + defaultValue: 'poco-v5', + description: 'Name of the subgraph' + ) + ] + ) } - stage('Generate subgraph file') { - sh """ - bash generate_subgraph_file.sh '${userInput.network}' - """ - - // Validate subgraph file generation - sh """ - FILE=./subgraph.${userInput.network}.yaml - if test -f "\$FILE"; then - echo "Subgraph file generated successfully" - else - echo "Failed to generate subgraph file" - exit 1 - fi - """ - } - - stage('Build') { - sh """ - yarn global add @graphprotocol/graph-cli && - cd ./ && - yarn install && - graph codegen subgraph.${userInput.network}.yaml && - graph build subgraph.${userInput.network}.yaml && - graph create ${userInput.network}/poco-v5 --node http://${userInput.targetRemoteHost}:8020 && - graph deploy ${userInput.network}/poco-v5 subgraph.${userInput.network}.yaml --node http://${userInput.targetRemoteHost}:8020 --ipfs http://${userInput.targetRemoteHost}:5001 --version-label v1.0.0-rc.1 - """ - } - - stage('The End') { - echo 'The end.' - } + // Define host mappings + def hosts = [ + 'staging': [ + 'graphNode': 'azubgrpbx-thegraph-staging.public.az2.internal', + 'ipfs': 'ipfs-upload.stagingv8.iex.ec', + 'env' : 'staging-' + ], + 'tmp': [ + 'graphNode': 'azubgrpbp-thegraph.public.az2.internal', + 'ipfs': 'ipfs-upload.v8-bellecour.iex.ec' + 'env' : 'tmp-' + ], + 'prod': [ + 'graphNode': 'azubgrpbp-thegraph.public.az2.internal', + 'ipfs': 'ipfs-upload.v8-bellecour.iex.ec' + 'env' : '' + ] + ] + + // Call deploySubGraph with user inputs + deploySubGraph( + targetRemoteHostGraphNode: hosts[userInput.environment].graphNode, + targetRemoteHostIPFS: hosts[userInput.environment].ipfs, + subgraphFolder: './', + networkName: userInput.networkName, + deployEnv: hosts[userInput.environment].env, + subgraphName: userInput.subgraphName, + subgraphVersionLabel: userInput.versionLabel + ) } } From a6fd3753b1321794385881ae9e9521afd7c3e034 Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Wed, 26 Mar 2025 17:55:43 +0100 Subject: [PATCH 12/19] add , --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 182f1a7..c6e3225 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -44,12 +44,12 @@ node { ], 'tmp': [ 'graphNode': 'azubgrpbp-thegraph.public.az2.internal', - 'ipfs': 'ipfs-upload.v8-bellecour.iex.ec' + 'ipfs': 'ipfs-upload.v8-bellecour.iex.ec', 'env' : 'tmp-' ], 'prod': [ 'graphNode': 'azubgrpbp-thegraph.public.az2.internal', - 'ipfs': 'ipfs-upload.v8-bellecour.iex.ec' + 'ipfs': 'ipfs-upload.v8-bellecour.iex.ec', 'env' : '' ] ] From af78b7ac33b4adf895fde5009b4563a6d21c4cdc Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Thu, 27 Mar 2025 09:32:21 +0100 Subject: [PATCH 13/19] Remove --- Jenkinsfile_Subgraph | 65 -------------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 Jenkinsfile_Subgraph diff --git a/Jenkinsfile_Subgraph b/Jenkinsfile_Subgraph deleted file mode 100644 index 40b6dd3..0000000 --- a/Jenkinsfile_Subgraph +++ /dev/null @@ -1,65 +0,0 @@ - -//Readme @ http://gitlab.iex.ec:30000/iexec/jenkins-library - -@Library('global-jenkins-library@feature/subgraph-networks') _ -def userInput - -node { - stage('Choose deployment parameters') { - timeout(time: 5, unit: 'MINUTES') { - userInput = input( - id: 'deployment-params', - message: 'Select deployment parameters', - parameters: [ - choice( - name: 'networkName', - choices: ['bellecour', 'goerli', 'mainnet'], - description: 'Select the target network' - ), - choice( - name: 'environment', - choices: ['staging','tmp','prod'], - description: 'Select deployment environment' - ), - string( - name: 'versionLabel', - defaultValue: 'v1.0.0', - description: 'Version label for the deployment' - ), - string( - name: 'subgraphName', - defaultValue: 'poco-v5', - description: 'Name of the subgraph' - ) - ] - ) - } - - // Define host mappings - def hosts = [ - 'staging': [ - 'graphNode': 'azubgrpbx-thegraph-staging.public.az2.internal', - 'ipfs': 'ipfs-upload.stagingv8.iex.ec' - ], - 'tmp': [ - 'graphNode': 'azubgrpbp-thegraph.public.az2.internal', - 'ipfs': 'ipfs-upload.v8-bellecour.iex.ec' - ], - 'prod': [ - 'graphNode': 'azubgrpbp-thegraph.public.az2.internal', - 'ipfs': 'ipfs-upload.v8-bellecour.iex.ec' - ] - ] - - // Call deploySubGraph with user inputs - deploySubGraph( - targetRemoteHostGraphNode: hosts[userInput.environment].graphNode, - targetRemoteHostIPFS: hosts[userInput.environment].ipfs, - subgraphFolder: './', - networkName: userInput.networkName, - deployEnv: userInput.environment, - subgraphName: userInput.subgraphName, - subgraphVersionLabel: userInput.versionLabel - ) - } -} From cf058a7c79e916c1d6b4e62e862d9e91a20bcf1a Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Thu, 27 Mar 2025 09:32:31 +0100 Subject: [PATCH 14/19] remove line --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c6e3225..05efa81 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,4 +1,3 @@ - //Readme @ http://gitlab.iex.ec:30000/iexec/jenkins-library @Library('global-jenkins-library@feature/subgraph-networks') _ From 2e5f7c66916971f80546b56489c921024b6bdb13 Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Thu, 27 Mar 2025 09:34:42 +0100 Subject: [PATCH 15/19] add 1 removed file for diff --- Jenkinsfile_Subgraph_bellecour_stagingv8 | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 Jenkinsfile_Subgraph_bellecour_stagingv8 diff --git a/Jenkinsfile_Subgraph_bellecour_stagingv8 b/Jenkinsfile_Subgraph_bellecour_stagingv8 deleted file mode 100644 index 8208816..0000000 --- a/Jenkinsfile_Subgraph_bellecour_stagingv8 +++ /dev/null @@ -1,11 +0,0 @@ -//Readme @ http://gitlab.iex.ec:30000/iexec/jenkins-library - -@Library('global-jenkins-library@2.8.1') _ -deploySubGraph( - targetRemoteHostGraphNode : 'azubgrpbx-thegraph-staging.public.az2.internal', - targetRemoteHostIPFS : 'ipfs-upload.stagingv8.iex.ec', - subgraphFolder: './', - subgraphFilename: 'subgraph.bellecour.yaml', - subgraphVersionLabel: 'v1.1.0', - subgraphLabel: 'bellecour/poco-v5' -) From 20a39490710e34e6c73b0d57219458dacf2903eb Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Thu, 27 Mar 2025 09:36:28 +0100 Subject: [PATCH 16/19] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a3ea43..2a60463 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## vNEXT +- Rewrite Jenkins CI for future migration (#36) + ## v1.1.0 - Support deal sponsor - Add `sponsor` to `deal`. (#31) - Update deployment hosts: From e7626ccb71bdd5d08c3dbc8217d416f0028aebbc Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Thu, 27 Mar 2025 09:49:57 +0100 Subject: [PATCH 17/19] update readme --- README.md | 75 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 2240884..2261e09 100644 --- a/README.md +++ b/README.md @@ -62,45 +62,70 @@ _NB_: other blockchains setups are availables in [docker/README.md](./docker/REA --- -## Generating Subgraph and Jenkins Configuration Files +Here's the revised "Generating Subgraph and Jenkins Configuration Files" section for your README: -This project includes a bash script, `generate_subgraph.sh`, to automate the creation of subgraph YAML configuration files and Jenkinsfiles based on the network settings in `config.json`. +## Deployment Configuration -**Run the script with the network name**: -```bash -bash generate_subgraph_file.sh -``` +### Jenkins Pipeline Deployment + +The project uses a Jenkins pipeline for automated deployment of the subgraph. The deployment can be triggered through Jenkins with interactive parameter selection. + +#### Available Parameters + +- **Network**: Choose the target blockchain network +- **Environment**: Select deployment environment + - `staging`: Deploy to staging environment + - `tmp`: Deploy to temporary environment + - `prod`: Deploy to production environment +- **Version Label**: Specify the version of the deployment (e.g., `v1.0.0`) +- **Subgraph Name**: Name of the subgraph (default: `poco-v5`) + +#### Environment-specific Configurations -### Configuration +Each environment has specific host configurations: -Ensure `config.json` is populated with the required values. Example: +### Adding New Networks + +To add support for a new network, update the `networks.json` file with the network configuration: ```json { - "bellecour": { - "START_BLOCK": 4543300, - "ERC1538_ADDRESS": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", - "IEXECE_INTERFACE_TOKEN_CORE_ADDRESS": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", - "APP_REGISTRY_ADDRESS": "0xB1C52075b276f87b1834919167312221d50c9D16", - "DATATSET_REGISTRY_ADDRESS": "0x799DAa22654128d0C64d5b79eac9283008158730", - "WORKERPOOL_REGISTRY_ADDRESS": "0xC76A18c78B7e530A165c5683CB1aB134E21938B4" + "network-name": { + "ERC1538": { + "address": "0x...", + "startBlock": 1234567 + }, + "Core": { + "address": "0x...", + "startBlock": 1234567 + }, + "AppRegistry": { + "address": "0x...", + "startBlock": 1234567 + }, + "DatasetRegistry": { + "address": "0x...", + "startBlock": 1234567 + }, + "WorkerpoolRegistry": { + "address": "0x...", + "startBlock": 1234567 + } } } ``` -### Files Generated - -- **subgraph..yaml**: Subgraph configuration with placeholders replaced. - -#### Example Command - -```bash -bash generate_subgraph_file.sh bellecour +Also, update the Jenkins pipeline choices to include the new network: +```groovy +choice( + name: 'networkName', + choices: ['bellecour', 'new-network'], + description: 'Select the target network' +) ``` -This command generates `subgraph.bellecour.yaml`. - +The deployment process will automatically generate the appropriate subgraph configuration using the network-specific addresses and start blocks from `networks.json`. ## Resources From 06c9ae5c06be533621cfe791204d0ef4762e4d87 Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Thu, 27 Mar 2025 16:38:36 +0100 Subject: [PATCH 18/19] remove useless networks --- networks.json | 88 --------------------------------------------------- 1 file changed, 88 deletions(-) diff --git a/networks.json b/networks.json index cd11679..7b7d1d3 100644 --- a/networks.json +++ b/networks.json @@ -43,50 +43,6 @@ "startBlock": 4543300 } }, - "c13": { - "ERC1538": { - "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", - "startBlock": 4543300 - }, - "Core": { - "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", - "startBlock": 4543300 - }, - "AppRegistry": { - "address": "0xB1C52075b276f87b1834919167312221d50c9D16", - "startBlock": 4543300 - }, - "DatasetRegistry": { - "address": "0x799DAa22654128d0C64d5b79eac9283008158730", - "startBlock": 4543300 - }, - "WorkerpoolRegistry": { - "address": "0xC76A18c78B7e530A165c5683CB1aB134E21938B4", - "startBlock": 4543300 - } - }, - "goerli": { - "ERC1538": { - "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", - "startBlock": 2564000 - }, - "Core": { - "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", - "startBlock": 2564000 - }, - "AppRegistry": { - "address": "0xB1C52075b276f87b1834919167312221d50c9D16", - "startBlock": 2564000 - }, - "DatasetRegistry": { - "address": "0x799DAa22654128d0C64d5b79eac9283008158730", - "startBlock": 2564000 - }, - "WorkerpoolRegistry": { - "address": "0xC76A18c78B7e530A165c5683CB1aB134E21938B4", - "startBlock": 2564000 - } - }, "mainnet": { "ERC1538": { "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", @@ -108,49 +64,5 @@ "address": "0xC76A18c78B7e530A165c5683CB1aB134E21938B4", "startBlock": 9917600 } - }, - "rinkeby": { - "ERC1538": { - "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", - "startBlock": 6355862 - }, - "Core": { - "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", - "startBlock": 6355862 - }, - "AppRegistry": { - "address": "0xB1C52075b276f87b1834919167312221d50c9D16", - "startBlock": 6355862 - }, - "DatasetRegistry": { - "address": "0x799DAa22654128d0C64d5b79eac9283008158730", - "startBlock": 6355862 - }, - "WorkerpoolRegistry": { - "address": "0xC76A18c78B7e530A165c5683CB1aB134E21938B4", - "startBlock": 6355862 - } - }, - "viviani": { - "ERC1538": { - "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", - "startBlock": 5556000 - }, - "Core": { - "address": "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", - "startBlock": 5556000 - }, - "AppRegistry": { - "address": "0xB1C52075b276f87b1834919167312221d50c9D16", - "startBlock": 5556000 - }, - "DatasetRegistry": { - "address": "0x799DAa22654128d0C64d5b79eac9283008158730", - "startBlock": 5556000 - }, - "WorkerpoolRegistry": { - "address": "0xC76A18c78B7e530A165c5683CB1aB134E21938B4", - "startBlock": 5556000 - } } } From b0762c7b1b9f9a63ab626503b88fdbaa292aceb6 Mon Sep 17 00:00:00 2001 From: gfournieriExec Date: Thu, 27 Mar 2025 16:39:55 +0100 Subject: [PATCH 19/19] only use bellecour in choice --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 05efa81..bf291ae 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ node { parameters: [ choice( name: 'networkName', - choices: ['bellecour', 'goerli', 'mainnet'], + choices: ['bellecour'], description: 'Select the target network' ), choice(