43 lines
1.0 KiB
Groovy
43 lines
1.0 KiB
Groovy
#!/usr/bin/env groovy
|
|
|
|
package modules
|
|
|
|
import javaposse.jobdsl.dsl.Job
|
|
|
|
public class Utils {
|
|
static Job createJob(
|
|
String jobName,
|
|
String jobDescription,
|
|
jobDslCtx
|
|
) {
|
|
Job job = jobDslCtx.pipelineJob(jobName)
|
|
job.with {
|
|
description(jobDescription)
|
|
}
|
|
return job
|
|
}
|
|
|
|
static void addGiteaRepository(
|
|
Job job,
|
|
String giteaRepositoryURL,
|
|
String jenkinsFilePath
|
|
) {
|
|
job.with {
|
|
definition {
|
|
cpsScm {
|
|
lightweight(false)
|
|
scm {
|
|
git {
|
|
branch('main')
|
|
remote {
|
|
url(giteaRepositoryURL)
|
|
credentials('77c771b9-20f4-426d-8f1e-ed901afe9eb9')
|
|
}
|
|
}
|
|
}
|
|
scriptPath(jenkinsFilePath)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |