Skip to content

Commit 2cd0cbd

Browse files
authored
Added ci configuration (#6)
Added ci configuration
2 parents db93633 + 6116089 commit 2cd0cbd

File tree

4 files changed

+146
-2
lines changed

4 files changed

+146
-2
lines changed

.ci/Jenkinsfile

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/usr/bin/env groovy
2+
3+
@Library('apm@current') _
4+
5+
pipeline {
6+
agent { label 'linux && immutable' }
7+
environment {
8+
REPO = 'ecs-logging-js'
9+
BASE_DIR = "src/go.elastic.co/apm/${env.REPO}"
10+
NOTIFY_TO = credentials('notify-to')
11+
JOB_GCS_BUCKET = credentials('gcs-bucket')
12+
}
13+
options {
14+
timeout(time: 1, unit: 'HOURS')
15+
buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '20', daysToKeepStr: '30'))
16+
timestamps()
17+
ansiColor('xterm')
18+
disableResume()
19+
durabilityHint('PERFORMANCE_OPTIMIZED')
20+
rateLimitBuilds(throttle: [count: 60, durationName: 'hour', userBoost: true])
21+
quietPeriod(10)
22+
}
23+
triggers {
24+
issueCommentTrigger('(?i).*jenkins\\W+run\\W+(?:the\\W+)?tests(?:\\W+please)?.*')
25+
}
26+
stages {
27+
stage('Checkout') {
28+
options { skipDefaultCheckout() }
29+
steps {
30+
pipelineManager([ cancelPreviousRunningBuilds: [ when: 'PR' ] ])
31+
deleteDir()
32+
gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: true)
33+
stash allowEmpty: true, name: 'source', useDefaultExcludes: false
34+
}
35+
}
36+
stage('Parallel'){
37+
options { skipDefaultCheckout() }
38+
parallel {
39+
stage('Test - Node.js v10') {
40+
steps {
41+
buildWithGitHubNotification('node:10-alpine')
42+
}
43+
}
44+
stage('Test - Node.js v12') {
45+
agent { label 'linux && immutable' }
46+
options { skipDefaultCheckout() }
47+
steps {
48+
buildWithGitHubNotification('node:12-alpine')
49+
}
50+
}
51+
stage('Test - Node.js v13') {
52+
agent { label 'linux && immutable' }
53+
options { skipDefaultCheckout() }
54+
steps {
55+
buildWithGitHubNotification('node:13-alpine')
56+
}
57+
}
58+
}
59+
}
60+
}
61+
post {
62+
cleanup {
63+
notifyBuildResult()
64+
}
65+
}
66+
}
67+
68+
def runTest(version){
69+
deleteDir()
70+
unstash 'source'
71+
dir("${BASE_DIR}"){
72+
docker.image("${version}").inside("-e HOME=${WORKSPACE}/${BASE_DIR}") {
73+
sh(label: 'Run tests', script: 'sh utils/run-test.sh')
74+
}
75+
}
76+
}
77+
78+
def buildWithGitHubNotification(version){
79+
withGithubNotify(context: "${version}") {
80+
runTest(version)
81+
}
82+
}

.ci/jobs/defaults.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
3+
##### GLOBAL METADATA
4+
5+
- meta:
6+
cluster: apm-ci
7+
8+
##### JOB DEFAULTS
9+
10+
- job:
11+
view: APM-CI
12+
project-type: multibranch
13+
logrotate:
14+
daysToKeep: 30
15+
numToKeep: 100
16+
number-to-keep: '5'
17+
days-to-keep: '1'
18+
concurrent: true
19+
node: linux
20+
script-path: .ci/Jenkinsfile
21+
scm:
22+
- github:
23+
branch-discovery: no-pr
24+
discover-pr-forks-strategy: merge-current
25+
discover-pr-forks-trust: permission
26+
discover-pr-origin: merge-current
27+
discover-tags: true
28+
repo: ecs-logging-js
29+
repo-owner: elastic
30+
credentials-id: 2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken
31+
ssh-checkout:
32+
credentials: f6c7695a-671e-4f4f-a331-acdce44ff9ba
33+
build-strategies:
34+
- tags:
35+
ignore-tags-older-than: -1
36+
ignore-tags-newer-than: -1
37+
- regular-branches: true
38+
- change-request:
39+
ignore-target-only-changes: false
40+
clean:
41+
after: true
42+
before: true
43+
prune: true
44+
shallow-clone: true
45+
depth: 3
46+
do-not-fetch-tags: true
47+
submodule:
48+
disable: false
49+
recursive: true
50+
parent-credentials: true
51+
timeout: 100
52+
timeout: '15'
53+
use-author: true
54+
wipe-workspace: 'True'
55+
periodic-folder-trigger: 1w
56+
prune-dead-branches: true
57+
publishers:
58+
- email:
59+
recipients: infra-root+build@elastic.co

.ci/jobs/ecs-logging-js-mbp.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- job:
3+
name: apm-agent-nodejs/ecs-logging-js-mbp
4+
display-name: ecs-logging-js
5+
description: Centralized logging for Node.js applications with the Elastic stack

utils/run-test.sh

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env bash
2-
31
set -euxo pipefail
42
ROOT=$PWD
53

0 commit comments

Comments
 (0)