-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathJenkinsfile
More file actions
77 lines (76 loc) · 2.38 KB
/
Jenkinsfile
File metadata and controls
77 lines (76 loc) · 2.38 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
library 'magic-butler-catalogue'
def PROJECT_NAME = 'logdna-rust'
def TRIGGER_PATTERN = '.*@logdnabot.*'
def publishImage = false
pipeline {
agent {
node {
label "rust-x86_64"
customWorkspace("/tmp/workspace/${env.BUILD_TAG}")
}
}
options {
timestamps()
ansiColor 'xterm'
}
triggers {
issueCommentTrigger(TRIGGER_PATTERN)
cron(env.BRANCH_NAME ==~ /\d\.\d/ ? 'H H 1,15 * *' : '')
}
environment {
RUST_IMAGE_REPO = 'us.gcr.io/logdna-k8s/rust'
RUST_IMAGE_TAG = 'bullseye-1-stable-x86_64'
SCCACHE_BUCKET = 'logdna-sccache-us-west-2'
SCCACHE_REGION = 'us-west-2'
CARGO_INCREMENTAL = 'false'
}
stages {
stage('Validate PR Source') {
when {
expression { env.CHANGE_FORK }
not {
triggeredBy 'issueCommentCause'
}
}
steps {
error("A maintainer needs to approve this PR for CI by commenting")
}
}
stage('Pull Build Image') {
steps {
sh "docker pull ${RUST_IMAGE_REPO}:${RUST_IMAGE_TAG}"
}
}
stage ("Lint and Test"){
environment {
CREDS_FILE = credentials('pipeline-e2e-creds')
LOGDNA_HOST = "logs.use.stage.logdna.net"
}
steps {
script {
def creds = readJSON file: CREDS_FILE
// Assumes the pipeline-e2e-creds format remains the same. Chase
// refer to the e2e tests's README's authorization docs for the
// current structure
LOGDNA_INGESTION_KEY = creds["packet-stage"]["account"]["ingestionkey"]
}
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: 'aws',
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]){
sh """
make lint
make LOGDNA_INGESTION_KEY=${LOGDNA_INGESTION_KEY} test
"""
}
}
post {
success {
sh "make clean"
}
}
}
}
}