-
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.
- Loading branch information
1 parent
fe90abe
commit e57165d
Showing
1 changed file
with
34 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,59 @@ | ||
//Readme @ http://gitlab.iex.ec:30000/iexec/jenkins-library | ||
|
||
@Library('[email protected]') _ | ||
|
||
def userInput | ||
|
||
node { | ||
docker.image('node:20-alpine').inside('--user root') { | ||
// stage('Setup') { | ||
// checkout scm | ||
// } | ||
stage('Deployement form') { | ||
stage('Setup') { | ||
checkout scm | ||
} | ||
stage('Deployment form') { | ||
timeout(time: 5, unit: 'MINUTES') { | ||
userInput = input( | ||
id: 'select-deployment', | ||
message: 'Select environment & service', | ||
parameters: [ | ||
string(name: 'network', description: 'The network name you want to deploy your subgraph'), | ||
string(name: 'targetRemoteHost', description: 'The host you want to deploy the subgraph'), | ||
|
||
] | ||
) | ||
} | ||
println "Selected network: '$userInput.network'" | ||
println "Selected service name: '$userInput.targetRemoteHost'" | ||
println "Selected network: '${userInput.network}'" | ||
println "Selected service name: '${userInput.targetRemoteHost}'" | ||
} | ||
stage('Setup Docker image') { | ||
sh 'apk add jq' | ||
} | ||
stage('Building subgraph') { | ||
checkout scm | ||
sh "./generate_subgraph.sh '$userInput.network'" | ||
stage('Building subgraph') { | ||
// Print working directory and list files for debugging | ||
sh 'pwd' | ||
sh 'ls -la' | ||
|
||
// Ensure the script is executable | ||
sh 'chmod +x ./generate_subgraph.sh' | ||
|
||
// Run the script | ||
sh "./generate_subgraph.sh '${userInput.network}'" | ||
|
||
// Check if the subgraph file was generated | ||
sh """ | ||
FILE=./subgraph.'$userInput.network}'.yaml | ||
if test -f "$FILE"; then | ||
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('Deploy SubGraph') { | ||
deploySubGraph( | ||
targetRemoteHost: "${userInput.targetRemoteHost}", | ||
subgraphFolder: './', | ||
subgraphFilename: "subgraph.${userInput.network}.yaml", | ||
subgraphVersionLabel: 'v1.0.0-rc.1', | ||
subgraphLabel: "${userInput.network}/poco-v5" | ||
) | ||
} | ||
deploySubGraph( | ||
targetRemoteHost : "'$userInput.targetRemoteHost}'", | ||
subgraphFolder: './', | ||
subgraphFilename: "subgraph.'$userInput.network}'.yaml", | ||
subgraphVersionLabel: 'v1.0.0-rc.1', | ||
subgraphLabel: "'$userInput.network}'/poco-v5" | ||
) | ||
} | ||
} | ||
} |