-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile_Setup
42 lines (42 loc) · 1.65 KB
/
Jenkinsfile_Setup
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
39
40
41
42
pipeline {
agent {
docker {
image 'python-build'
args '-u root:root'
}
}
environment {
ZONE_NAME = "comquent.academy"
SSH_KEY_NAME = '[email protected]'
JOB_NAME = 'docker-test'
SSL_EMAIL = '[email protected]'
SUBDOMAIN = "${params.SUBDOMAIN}"
CONFIG_REPO = "${params.CONFIG_REPO}"
NUM_INSTANCES = "${params.NUM_INSTANCES}"
SERVER_TYPE = "${params.SERVER_TYPE}"
}
stages {
stage('Setup Environment') {
steps {
withCredentials([
sshUserPrivateKey(credentialsId: 'ssh-private-key', keyFileVariable: 'H_SSH_PRIVATE_KEY'),
usernamePassword(credentialsId: 'jenkins-admin-credentials', usernameVariable: 'JENKINS_USER', passwordVariable: 'JENKINS_PASS'),
string(credentialsId: 'hetzner-api-token', variable: 'H_API_TOKEN'),
string(credentialsId: 'hetzner-dns-api-token', variable: 'H_DNS_API_TOKEN')
]) {
script {
def branchParam = params.BRANCH ?: ''
def branchOption = branchParam ? "--branch ${branchParam}" : ""
def command = """
set -e
echo "Setting up the environment"
pip install -e .
python scripts/create_environment.py --config-repo ${env.CONFIG_REPO} ${branchOption}
"""
sh command
}
}
}
}
}
}