-
Notifications
You must be signed in to change notification settings - Fork 5
/
deployment.Jenkinsfile
49 lines (49 loc) · 1.26 KB
/
deployment.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
pipeline {
agent{
kubernetes {
cloud params.JENKINS_AGENT_CLOUD_NAME
label "jenkins-slave-${UUID.randomUUID().toString()}"
serviceAccount "jenkins"
defaultContainer 'jnlp'
yaml """
apiVersion: v1
kind: Pod
metadata:
labels:
app: "jenkins-${env.JOB_BASE_NAME}"
spec:
containers:
- name: jnlp
image: quay.io/kaine/indy-stress-tester:latest
imagePullPolicy: Always
tty: true
env:
- name: HOME
value: /home/jenkins
- name: USER
value: 'jenkins-k8s-config'
resources:
requests:
memory: 1500Mi
cpu: 2000m
limits:
memory: 3000Mi
cpu: 4000m
"""
}
}
stages {
stage('run Ansible Tower template'){
steps{
withCredentials([usernamePassword(credentialsId:'Tower_Auth', passwordVariable:'PASSWORD', usernameVariable:'USERNAME')]) {
sh """#!/bin/bash
curl -u ${USERNAME}:${PASSWORD} \
-H 'Content-Type: application/json' \
--data '{}' \
-X POST ${params.TOWER_HOST}api/v2/job_templates/${params.TEMPLATE_ID}/launch/
"""
}
}
}
}
}