-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
64 lines (62 loc) · 2.18 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env groovy
//import jenkins.model.Jenkins
pipeline {
//agent { docker { image 'python:3.5.1' } }
agent none
stages {
/* stage('fetch data from Vault') {
agent { docker { image 'python:3.5.1' } }
steps {
script {
// Assign Vault secrets to env variables
def secrets = [
[$class: 'VaultSecret', path: 'kv/woody/dev/ecr-api', secretValues: [
[$class: 'VaultSecretValue', envVar: 'registry_id', vaultKey: 'registry_id'],
[$class: 'VaultSecretValue', envVar: 'registry_url', vaultKey: 'registry_id']
]]
]
def configuration = [$class: 'VaultConfiguration',
vaultUrl: "${env.STRYBER_VAULT_URL}",
vaultCredentialId: 'vault-app-token']
// Wrapper to avail env variables
wrap([$class: 'VaultBuildWrapper', configuration: configuration, vaultSecrets: secrets]) {
sh 'echo $registry_id'
sh 'echo $registry_url'
}
}
}
}
*/
stage('pull_image') {
agent { node { label 'woody-agent' } }
steps {
sh 'ip a'
}
}
stage('set_version') {
agent { docker { image 'python:3.5.1' } }
steps {
// script {
// VAULT_ADDR = envVars['myVar']
// }
echo "THIS iS MY VAULT ADDR: ${env.STRYBER_VAULT_URL}"
}
}
stage('push_registry') {
agent { docker { image 'python:3.5.1' } }
steps {
sh 'python --version'
}
}
}
}
//def envVars = Jenkins.instance.getGlobalNodeProperties()[0].getEnvVars()
def notifySlack(text, channel) {
withCredentials([string(credentialsId: 'slack-webhook-url', variable: 'slackHook')]) {
def payload = "{\"text\":\"${text}\","
payload += "\"channel\":\"${channel}\","
payload += "\"username\":\"${Jenkins}\","
payload += "\"attachments\":[]}"
sh "curl -X POST --data-urlencode \'payload=${payload}\' ${slackHook}"
}
}