Set up Jenkins jobs for web and mobile tests
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import jenkins.model.Jenkins
|
||||
import hudson.security.HudsonPrivateSecurityRealm
|
||||
import hudson.security.FullControlOnceLoggedInAuthorizationStrategy
|
||||
|
||||
def jenkins = Jenkins.instance
|
||||
def realm = new HudsonPrivateSecurityRealm(false)
|
||||
if (realm.getAllUsers().isEmpty()) {
|
||||
realm.createAccount("admin", "admin")
|
||||
}
|
||||
jenkins.setSecurityRealm(realm)
|
||||
|
||||
def strategy = new FullControlOnceLoggedInAuthorizationStrategy()
|
||||
strategy.setAllowAnonymousRead(true)
|
||||
jenkins.setAuthorizationStrategy(strategy)
|
||||
|
||||
jenkins.save()
|
||||
@@ -0,0 +1,24 @@
|
||||
import jenkins.model.Jenkins
|
||||
|
||||
def jenkins = Jenkins.instance
|
||||
def xmlDir = new File(jenkins.root, "job-xml")
|
||||
if (!xmlDir.exists()) {
|
||||
return
|
||||
}
|
||||
|
||||
xmlDir.eachFileMatch(~/.*\.xml/) { file ->
|
||||
def jobName = file.name.replaceFirst(/\.xml$/, "")
|
||||
def existing = jenkins.getItem(jobName)
|
||||
if (existing != null) {
|
||||
return
|
||||
}
|
||||
def fis = new FileInputStream(file)
|
||||
try {
|
||||
jenkins.createProjectFromXML(jobName, fis)
|
||||
println "Created job: ${jobName}"
|
||||
} finally {
|
||||
fis.close()
|
||||
}
|
||||
}
|
||||
|
||||
jenkins.save()
|
||||
@@ -0,0 +1,18 @@
|
||||
import jenkins.model.Jenkins
|
||||
import ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation
|
||||
import ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstaller
|
||||
import hudson.tools.InstallSourceProperty
|
||||
|
||||
def jenkins = Jenkins.instance
|
||||
def desc = jenkins.getDescriptorByType(AllureCommandlineInstallation.DescriptorImpl)
|
||||
def existing = desc.getInstallations()
|
||||
|
||||
def alreadyConfigured = existing.any { it.name == "allure" }
|
||||
if (!alreadyConfigured) {
|
||||
def installer = new AllureCommandlineInstaller("2.29.0")
|
||||
def prop = new InstallSourceProperty([installer])
|
||||
def installation = new AllureCommandlineInstallation("allure", "", [prop])
|
||||
desc.setInstallations(installation)
|
||||
desc.save()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user