0

Team, my situation is to trigger based on topic and file paths. so is there a regex that will help me reduce my lookup lines of code? like i have 6 compareType. can i make it one with regex?

    triggers {
        gerrit serverName: 'git.com',
        gerritProjects: [[
            compareType: 'PLAIN',
            pattern: 'product',
            branches: [[ compareType: 'PLAIN', pattern: "main" ]],
            filePaths: [
                [compareType: 'ANT', pattern: '*.go'],
                [compareType: 'ANT', pattern: '*.py'],
                [compareType: 'ANT', pattern: 'src/**/*.go'],
                [compareType: 'ANT', pattern: 'src/**/*.py'],
                [compareType: 'ANT', pattern: 'src/**/*.ts'],
                [compareType: 'ANT', pattern: 'src/**/*.js'],
                ],
            disableStrictForbiddenFileVerification: false
        ]],
        silentMode: true,
        topics: [
            [compareType: 'ANT', pattern: 'bazel-stuff-starts'],
        ],
        triggerOnEvents: [commentAddedContains('!build'), patchsetCreated(excludeDrafts: true, excludeNoCodeChange: true, excludeTrivialRebase: true)]
        ]]
    }
AhmFM
  • 1,552
  • 3
  • 23
  • 53

0 Answers0