forked from openshift/assisted-test-infra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.download_logs
60 lines (50 loc) · 1.89 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
pipeline {
agent { label 'download_logs' }
parameters {
string(name: 'REMOTE_SERVICE_URL', defaultValue: 'https://api.openshift.com', description: 'Service URL')
string(name: 'ASSISTED_INSTALLER_DEPLOYMENT_BRANCH', defaultValue: 'master', description: 'Branch on assisted-installer-deployment repo to use')
}
triggers { cron('H/30 * * * *') }
environment {
SKIPPER_PARAMS = " "
LOGS_DEST = "/var/ai-logs/triage_logs"
// Credentials
OFFLINE_TOKEN = credentials('admin_offline_token')
JIRA_ACCESS_TOKEN = credentials('assisted-installer-bot-jira-access-token')
SLACK_TOKEN = credentials('slack-token')
}
options {
timeout(time: 90, unit: 'MINUTES')
}
stages {
stage('Init') {
steps {
sh "scripts/install_environment.sh install_skipper"
sh "make image_build"
}
}
stage('Cluster-logs') {
steps {
sh "make download_cluster_logs"
}
}
stage('Create tickets') {
steps {
sh "rm -rf assisted-installer-deployment"
sh "git clone https://github.com/openshift-assisted/assisted-installer-deployment --branch ${ASSISTED_INSTALLER_DEPLOYMENT_BRANCH}"
dir ('assisted-installer-deployment') {
sh "skipper run ./tools/create_triage_tickets.py --jira-access-token ${JIRA_ACCESS_TOKEN} -v"
}
}
}
}
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}'''
}
}
}