2025-01-17 08:25:04 +00:00
|
|
|
package com.freeleaps.devops
|
|
|
|
|
|
|
|
|
|
class SourceFetcher {
|
|
|
|
|
def steps
|
|
|
|
|
|
|
|
|
|
SourceFetcher(steps) {
|
|
|
|
|
this.steps = steps
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-22 07:42:56 +00:00
|
|
|
def fetch(configurations) {
|
|
|
|
|
if (configurations.serviceGitRepo == null || configurations.serviceGitRepo.isEmpty()) {
|
|
|
|
|
steps.error("serviceGitRepo is required")
|
2025-01-21 09:01:31 +00:00
|
|
|
}
|
|
|
|
|
|
2025-01-22 07:42:56 +00:00
|
|
|
if (configurations.serviceGitBranch == null || configurations.serviceGitBranch.isEmpty()) {
|
|
|
|
|
steps.error("serviceGitBranch is required")
|
2025-01-21 09:01:31 +00:00
|
|
|
}
|
|
|
|
|
|
2025-02-04 03:22:48 +00:00
|
|
|
steps.env.workspace = "${steps.env.WORKSPACE}/devops-workspace/${configurations.serviceName}"
|
2025-02-04 02:23:25 +00:00
|
|
|
|
2025-02-04 03:02:16 +00:00
|
|
|
steps.dir(steps.env.workspace) {
|
2025-02-04 02:23:25 +00:00
|
|
|
steps.git branch: configurations.serviceGitBranch, credentialsId: 'git-bot-credentials', url: configurations.serviceGitRepo
|
|
|
|
|
}
|
2025-01-17 08:25:04 +00:00
|
|
|
}
|
|
|
|
|
}
|