Skip to content
This repository was archived by the owner on Oct 28, 2024. It is now read-only.

Commit c2cca9e

Browse files
committed
test: ITs
1 parent 8972e1b commit c2cca9e

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

local/configs/jenkins.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ jobs:
109109
- file: "/var/pipeline-library/src/test/resources/jobs/cancelPreviousRunningBuilds.dsl"
110110
- file: "/var/pipeline-library/src/test/resources/jobs/dockerLogin.dsl"
111111
- file: "/var/pipeline-library/src/test/resources/jobs/downstream.dsl"
112+
- file: "/var/pipeline-library/src/test/resources/jobs/getBeatsModule.dsl"
112113
- file: "/var/pipeline-library/src/test/resources/jobs/getBuildInfoJsonFiles/abort.dsl"
113114
- file: "/var/pipeline-library/src/test/resources/jobs/getBuildInfoJsonFiles/connectionRefused.dsl"
114115
- file: "/var/pipeline-library/src/test/resources/jobs/getBuildInfoJsonFiles/error.dsl"
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
NAME = 'it/getBeatsModule'
2+
DSL = '''pipeline {
3+
agent any
4+
environment {
5+
PIPELINE_LOG_LEVEL = 'DEBUG'
6+
}
7+
stages {
8+
stage('checkout') {
9+
steps {
10+
gitCheckout(credentialsId: '2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken',
11+
repo: 'https://github.com/elastic/apm-pipeline-library.git',
12+
branch: 'master',
13+
basedir: 'sub-folder',
14+
shallow: false)
15+
}
16+
}
17+
stage('match') {
18+
steps {
19+
dir('sub-folder') {
20+
script {
21+
def module = getBeatsModule(pattern: '^\\\\.ci\\\\/([^\\\\/]+)\\\\/.*',
22+
from: '347185bd7e2b402ba8f6befa5ef4428ad417fbbc',
23+
to: '4d9fc25d258622c767ec4d38df38520647cc7dda')
24+
whenFalse(module.equals('jobs')){
25+
error("Expected module name 'jobs'")
26+
}
27+
}
28+
}
29+
}
30+
}
31+
stage('no_match') {
32+
steps {
33+
dir('sub-folder') {
34+
script {
35+
def module = getBeatsModule(pattern: '^\\\\ci\\\\/([^\\\\/]+)\\\\/.*',
36+
from: '347185bd7e2b402ba8f6befa5ef4428ad417fbbc',
37+
to: '4d9fc25d258622c767ec4d38df38520647cc7dda')
38+
whenFalse(module.equals('')){
39+
error("Expected module name ''")
40+
}
41+
}
42+
}
43+
}
44+
}
45+
stage('match_with_exclude') {
46+
steps {
47+
dir('sub-folder') {
48+
script {
49+
def module = getBeatsModule(pattern: '^test-infra\\\\/([^\\\\/]+)\\\\/.*',
50+
from: 'b0de59d0ec1e2ae52103a238a2e9cb5b0d7fd9b8',
51+
to: '641fd600836abafa51def05260d63fab6eed4707',
52+
exclude: '^resources.*')
53+
whenFalse(module.equals('apm-ci')){
54+
error("Expected module name 'apm-ci'")
55+
}
56+
}
57+
}
58+
}
59+
}
60+
}
61+
}'''
62+
63+
pipelineJob(NAME) {
64+
definition {
65+
cps {
66+
script(DSL.stripIndent())
67+
}
68+
}
69+
}

0 commit comments

Comments
 (0)