forked from openshift/assisted-test-infra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile.download_logs
61 lines (51 loc) · 1.99 KB
/
Jenkinsfile.download_logs
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
agentLabel = "${AGENT}"
pipeline {
agent { label agentLabel }
parameters {
string(name: 'REMOTE_SERVICE_URL', defaultValue: 'https://api.openshift.com', description: 'Service URL')
string(name: 'DOWNLOAD_ALL', defaultValue: params.DOWNLOAD_ALL ?:'', description: 'Collect all logs (not only from failed clusters)')
string(name: 'MUST_GATHER', defaultValue: params.MUST_GATHER ?:'--must-gather', description: 'Collect must-gather logs')
string(name: 'AGENT', defaultValue: params.AGENT ?:'download_logs', description: 'Agent to use')
booleanParam(name: 'OPEN_TRIAGE_TICKETS', defaultValue: params.OPEN_TRIAGE_TICKETS ?:'true', description: 'Open triage tickets for failing installations')
}
triggers { cron('H/30 * * * *') }
environment {
SKIPPER_PARAMS = " "
OFFLINE_TOKEN = credentials('admin_offline_token')
JIRA_CREDS = credentials('Ronnie-jira')
LOGS_DEST = "build"
SLACK_TOKEN = credentials('slack-token')
}
options {
timeout(time: 30, unit: 'MINUTES')
}
stages {
stage('Init') {
steps {
sh "make image_build"
}
}
stage('Download logs') {
steps {
sh "make download_logs ${DOWNLOAD_ALL} ${MUST_GATHER}"
}
}
stage('Open triage tickets') {
when {
expression {${params.OPEN_TRIAGE_TICKETS}}
}
steps{
sh "skipper run discovery-infra/create_triage_tickets.py -up ${JIRA_CREDS}"
}
}
}
post {
failure {
script {
def data = [text: "Attention! ${BUILD_TAG} job failed, see: ${BUILD_URL}"]
writeJSON(file: 'data.txt', json: data, pretty: 4)
}
sh '''curl -X POST -H 'Content-type: application/json' --data-binary "@data.txt" https://hooks.slack.com/services/${SLACK_TOKEN}'''
}
}
}