freeleaps-ops/first-class-pipeline/src/com/freeleaps/devops/SourceFetcher.groovy

22 lines
625 B
Groovy
Raw Normal View History

package com.freeleaps.devops
class SourceFetcher {
def steps
SourceFetcher(steps) {
this.steps = steps
}
def fetch(Map configurations) {
echo configurations
if (configurations.SERVICE_GIT_REPO == null || configurations.SERVICE_GIT_REPO.isEmpty()) {
steps.error("SERVICE_GIT_REPO is required")
}
if (configurations.SERVICE_GIT_BRANCH == null || configurations.SERVICE_GIT_BRANCH.isEmpty()) {
steps.error("SERVICE_GIT_BRANCH is required")
}
steps.git branch: configurations.SERVICE_GIT_BRANCH, credentialsId: 'git-bot-credentials', url: configurations.SERVICE_GIT_REPO
}
}