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

Commit 2476123

Browse files
committed
rename
1 parent c2cca9e commit 2476123

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

local/configs/jenkins.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ 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"
113112
- file: "/var/pipeline-library/src/test/resources/jobs/getBuildInfoJsonFiles/abort.dsl"
114113
- file: "/var/pipeline-library/src/test/resources/jobs/getBuildInfoJsonFiles/connectionRefused.dsl"
115114
- file: "/var/pipeline-library/src/test/resources/jobs/getBuildInfoJsonFiles/error.dsl"
116115
- file: "/var/pipeline-library/src/test/resources/jobs/getBuildInfoJsonFiles/success.dsl"
117116
- file: "/var/pipeline-library/src/test/resources/jobs/getBuildInfoJsonFiles/unstable.dsl"
117+
- file: "/var/pipeline-library/src/test/resources/jobs/getGitMatchingGroup.dsl"
118118
- file: "/var/pipeline-library/src/test/resources/jobs/git.dsl"
119119
- file: "/var/pipeline-library/src/test/resources/jobs/gitBaseCommit.dsl"
120120
- file: "/var/pipeline-library/src/test/resources/jobs/gitCheckout.dsl"

src/test/groovy/GetBeatsModuleStepTests.groovy renamed to src/test/groovy/GetGitMatchingGroupStepTests.groovy

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import static org.junit.Assert.assertFalse
2121
import static org.junit.Assert.assertEquals
2222
import static org.junit.Assert.assertTrue
2323

24-
class GetBeatsModuleStepTests extends ApmBasePipelineTest {
25-
String scriptName = 'vars/getBeatsModule.groovy'
24+
class GetGitMatchingGroupStepTests extends ApmBasePipelineTest {
25+
String scriptName = 'vars/getGitMatchingGroup.groovy'
2626

2727
def realData = '''CHANGELOG.next.asciidoc
2828
metricbeat/docs/modules/zookeeper.asciidoc
@@ -53,7 +53,7 @@ metricbeat/module/zookeeper/server/_meta/docs.asciidoc'''.stripMargin().stripInd
5353
//NOOP
5454
}
5555
printCallStack()
56-
assertTrue(assertMethodCallContainsPattern('error', 'getBeatsModule: Missing pattern argument.'))
56+
assertTrue(assertMethodCallContainsPattern('error', 'Missing pattern argument.'))
5757
assertJobStatusFailure()
5858
}
5959

@@ -65,7 +65,7 @@ metricbeat/module/zookeeper/server/_meta/docs.asciidoc'''.stripMargin().stripInd
6565
def module = script.call(pattern: 'foo')
6666
printCallStack()
6767
assertEquals('', module)
68-
assertTrue(assertMethodCallContainsPattern('log', 'getBeatsModule: CHANGE_TARGET or GIT_PREVIOUS_COMMIT and GIT_BASE_COMMIT env variables are required to evaluate the changes.'))
68+
assertTrue(assertMethodCallContainsPattern('log', 'CHANGE_TARGET or GIT_PREVIOUS_COMMIT and GIT_BASE_COMMIT env variables are required to evaluate the changes.'))
6969
assertJobStatusSuccess()
7070
}
7171

@@ -124,7 +124,7 @@ bar/foo/subfolder'''.stripMargin().stripIndent()
124124
helper.registerAllowedMethod('readFile', [String.class], { return changeset })
125125
def module = script.call(pattern: '([^\\/]+)\\/.*')
126126
assertEquals('', module)
127-
assertTrue(assertMethodCallContainsPattern('log', 'getBeatsModule: not found'))
127+
assertTrue(assertMethodCallContainsPattern('log', 'not found'))
128128
assertJobStatusSuccess()
129129
}
130130

@@ -136,7 +136,7 @@ bar/foo/subfolder'''.stripMargin().stripIndent()
136136
def module = script.call(pattern: '^unknown.txt')
137137
printCallStack()
138138
assertEquals('', module)
139-
assertTrue(assertMethodCallContainsPattern('log', 'getBeatsModule: not found with regex ^unknown.txt'))
139+
assertTrue(assertMethodCallContainsPattern('log', 'not found with regex ^unknown.txt'))
140140
assertJobStatusSuccess()
141141
}
142142

@@ -150,7 +150,7 @@ bar/foo/subfolder'''.stripMargin().stripIndent()
150150
//NOOP
151151
}
152152
printCallStack()
153-
assertTrue(assertMethodCallContainsPattern('error', 'getBeatsModule: windows is not supported yet.'))
153+
assertTrue(assertMethodCallContainsPattern('error', 'windows is not supported yet.'))
154154
assertJobStatusFailure()
155155
}
156156

@@ -218,7 +218,7 @@ bar/foo/subfolder'''.stripMargin().stripIndent()
218218
def module = script.call(pattern: '^foo/.*/file.txt', from: '', to: '')
219219
printCallStack()
220220
assertEquals('', module)
221-
assertTrue(assertMethodCallContainsPattern('log', 'getBeatsModule: CHANGE_TARGET or GIT_PREVIOUS_COMMIT and GIT_BASE_COMMIT env variables are required to evaluate the changes.'))
221+
assertTrue(assertMethodCallContainsPattern('log', 'CHANGE_TARGET or GIT_PREVIOUS_COMMIT and GIT_BASE_COMMIT env variables are required to evaluate the changes.'))
222222
assertJobStatusSuccess()
223223
}
224224

@@ -228,7 +228,7 @@ bar/foo/subfolder'''.stripMargin().stripIndent()
228228
def module = script.call(pattern: '^foo/.*/file.txt', to: '')
229229
printCallStack()
230230
assertEquals('', module)
231-
assertTrue(assertMethodCallContainsPattern('log', 'getBeatsModule: CHANGE_TARGET or GIT_PREVIOUS_COMMIT and GIT_BASE_COMMIT env variables are required to evaluate the changes.'))
231+
assertTrue(assertMethodCallContainsPattern('log', 'CHANGE_TARGET or GIT_PREVIOUS_COMMIT and GIT_BASE_COMMIT env variables are required to evaluate the changes.'))
232232
assertJobStatusSuccess()
233233
}
234234

vars/getBeatsModule.groovy renamed to vars/getGitMatchingGroup.groovy

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@
2222
- When exact match then all the files should match those patterns then it
2323
returns the region otherwise and empty string.
2424
25-
def module = getBeatsModule(pattern: '([^\\/]+)\\/.*')
25+
def module = getGitMatchingGroup(pattern: '([^\\/]+)\\/.*')
2626
whenTrue(module.trim()) {
2727
// ...
2828
}
2929
3030
// Exclude the asciidoc files from the search.
31-
def module = getBeatsModule(pattern: '([^\\/]+)\\/.*', exclude: '.*\\.asciidoc')
31+
def module = getGitMatchingGroup(pattern: '([^\\/]+)\\/.*', exclude: '.*\\.asciidoc')
3232
3333
3434
NOTE: This particular implementation requires to checkout with the step gitCheckout
3535
3636
*/
3737
def call(Map params = [:]) {
3838
if(!isUnix()){
39-
error('getBeatsModule: windows is not supported yet.')
39+
error('getGitMatchingGroup: windows is not supported yet.')
4040
}
41-
def pattern = params.containsKey('pattern') ? params.pattern : error('getBeatsModule: Missing pattern argument.')
41+
def pattern = params.containsKey('pattern') ? params.pattern : error('getGitMatchingGroup: Missing pattern argument.')
4242
def exclude = params.get('exclude', '')
4343
def from = params.get('from', env.CHANGE_TARGET?.trim() ? "origin/${env.CHANGE_TARGET}" : env.GIT_PREVIOUS_COMMIT)
4444
def to = params.get('to', env.GIT_BASE_COMMIT)
@@ -48,9 +48,9 @@ def call(Map params = [:]) {
4848
if (from?.trim() && to?.trim()) {
4949
def changes = sh(script: "git diff --name-only ${from}...${to} > ${gitDiffFile}", returnStdout: true)
5050
group = getGroup(gitDiffFile, pattern, exclude)
51-
log(level: 'INFO', text: "getBeatsModule: ${group.trim() ?: 'not found'} with regex ${pattern}")
51+
log(level: 'INFO', text: "getGitMatchingGroup: ${group.trim() ?: 'not found'} with regex ${pattern}")
5252
} else {
53-
log(level: 'INFO', text: 'getBeatsModule: CHANGE_TARGET or GIT_PREVIOUS_COMMIT and GIT_BASE_COMMIT env variables are required to evaluate the changes. Or the from/to arguments are required.')
53+
log(level: 'INFO', text: 'getGitMatchingGroup: CHANGE_TARGET or GIT_PREVIOUS_COMMIT and GIT_BASE_COMMIT env variables are required to evaluate the changes. Or the from/to arguments are required.')
5454
}
5555
return group
5656
}

vars/getBeatsModule.txt renamed to vars/getGitMatchingGroup.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ evaluates the change list and returns the module name.
77
NOTE: This particular implementation requires to checkout with the step gitCheckout
88

99
```
10-
def module = getBeatsModule(pattern: '([^\\/]+)\\/.*')
10+
def module = getGitMatchingGroup(pattern: '([^\\/]+)\\/.*')
1111
whenTrue(module.trim()) {
1212
// ...
1313
}
1414

1515
// Exclude the asciidoc files from the search.
16-
def module = getBeatsModule(pattern: '([^\\/]+)\\/.*', exclude: '.*\\.asciidoc')
16+
def module = getGitMatchingGroup(pattern: '([^\\/]+)\\/.*', exclude: '.*\\.asciidoc')
1717
```
1818

1919
* pattern: the regex pattern with the group to look for. Mandatory

0 commit comments

Comments
 (0)