forked from yerramreddyuday/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
38 lines (38 loc) · 1.7 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
pipeline {
agent any
tools {
dockerTool 'Docker'
}
environment {
IMAGENAME = 'magic-dashboard' // Set the credentials ID as an environment variable
}
parameters {
choice(name: 'BUILD_TYPE', choices: ['patch', 'minor', 'major' ], description: 'select version to build in develop')
choice(name: 'NET', choices: ['testnet', 'stagenet', 'mainnet'], description: 'select net type to build')
}
stages {
stage('Release') {
environment {
INCREMENT_TYPE="${params.BUILD_TYPE}"
TAG="${params.NET}"
GCR="asia-south1-docker.pkg.dev/prod-dojima/${params.NET}"
}
steps {
script {
withCredentials([ sshUserPrivateKey(credentialsId: 'dojimanetwork', keyFileVariable: 'SSH_KEY'), \
string(credentialsId: 'gcloud-access-token', variable: 'GCLOUD_ACCESS_TOKEN'), \
string(credentialsId: 'ci-registry-user', variable: 'CI_REGISTRY_USER'), \
string(credentialsId: 'ci-registry', variable: 'CI_REGISTRY'), \
string(credentialsId: 'ci-pat', variable: 'CR_PAT')]) {
// Set the SSH key for authentication
withEnv(["GIT_SSH_COMMAND=ssh -o StrictHostKeyChecking=no -i ${env.SSH_KEY}"]) {
echo "Selected action: $INCREMENT_TYPE, $TAG, $GCR"
sh 'gcloud auth print-access-token | docker login -u oauth2accesstoken --password-stdin --password-stdin https://$GCR'
sh 'make release'
}
}
}
}
}
}
}