新增learn-kubernetes(https://github.com/yyong-brs/learn-kubernetes)相关文件
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
#!groovy
|
||||
|
||||
import jenkins.install.*;
|
||||
import jenkins.model.*
|
||||
import jenkins.security.s2m.AdminWhitelistRule
|
||||
import hudson.security.*
|
||||
import hudson.util.*;
|
||||
|
||||
def instance = Jenkins.getInstance()
|
||||
|
||||
def username = "kiamol"
|
||||
def password = "kiamol"
|
||||
|
||||
def hudsonRealm = new HudsonPrivateSecurityRealm(false)
|
||||
hudsonRealm.createAccount(username, password)
|
||||
instance.setSecurityRealm(hudsonRealm)
|
||||
|
||||
def strategy = new FullControlOnceLoggedInAuthorizationStrategy()
|
||||
instance.setAuthorizationStrategy(strategy)
|
||||
instance.setInstallState(InstallState.INITIAL_SETUP_COMPLETED)
|
||||
instance.save()
|
||||
|
||||
Jenkins.instance.getInjector().getInstance(AdminWhitelistRule.class).setMasterKillSwitch(false)
|
||||
@@ -0,0 +1,15 @@
|
||||
#!groovy
|
||||
|
||||
import jenkins.model.Jenkins;
|
||||
|
||||
pm = Jenkins.instance.pluginManager
|
||||
uc = Jenkins.instance.updateCenter
|
||||
|
||||
pm.doCheckUpdatesServer()
|
||||
|
||||
["git", "workflow-aggregator"].each {
|
||||
if (! pm.getPlugin(it)) {
|
||||
deployment = uc.getPlugin(it).deploy(true)
|
||||
deployment.get()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import jenkins.*
|
||||
import jenkins.model.*
|
||||
import hudson.*
|
||||
import hudson.model.*
|
||||
|
||||
import hudson.plugins.git.*;
|
||||
import hudson.triggers.SCMTrigger;
|
||||
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
|
||||
import org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition;
|
||||
|
||||
def gitUser = "kiamol"
|
||||
def gitRepo = "kiamol"
|
||||
def gitUrl = "http://gogs:3000/${gitUser}/${gitRepo}.git"
|
||||
|
||||
def jenkins = Jenkins.instance;
|
||||
|
||||
def scm = new GitSCM(gitUrl)
|
||||
scm.branches = [new BranchSpec("*/master")];
|
||||
def workflowJob = new WorkflowJob(jenkins, "${gitRepo}");
|
||||
workflowJob.definition = new CpsScmFlowDefinition(scm, "ch11/bulletin-board/Jenkinsfile");
|
||||
def gitTrigger = new SCMTrigger("* * * * *");
|
||||
workflowJob.addTrigger(gitTrigger);
|
||||
workflowJob.disabled = true;
|
||||
workflowJob.save();
|
||||
|
||||
jenkins.reload()
|
||||
Reference in New Issue
Block a user