|
| 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