node {
stage('Example') {
echo 'Hello World!'
}
}
Controller
Agents
Hello World!
node {
stage('Clone & Install') {
git(
credentialsId: 'github',
url: "git@github.com:lookiero/ejemplito.git",
branch: "master")
sh(script: 'npm install')
}
stage('Checks') {
parallel([
'Lint': { sh(script: 'npm run lint') }
'Test': { sh(script: 'npm run test') }
])
}
}
// vars/gitHub.groovy
def clone(String repository, String branch) {
git(
changelog: false,
credentialsId: 'github',
poll: false,
url: "git@github.com:${repository}.git",
branch: branch
)
}
node {
stage('Clone & Install') {
gitHub.clone('lookiero/ejemplito', 'master')
sh(script: 'npm install')
}
stage('Checks') {
parallel([
'Lint': { sh(script: 'npm run lint') }
'Test': { sh(script: 'npm run test') }
])
}
}
def names = ["Alice", "Bob", "Charles"]
names.each { name ->
pipelineJob("${name}-greeter") {
parameters {
booleanParam ("SHOUT", false, "I can shout if needed")
}
definition {
cps {
sandbox()
script("""
node {
stage('Greet ${name}') {
def text = '${name}'
if (params.SHOUT) {
text = text.toUpperCase()
}
echo(text)
}
}
""")
}
}
}
}
DevOps
Engineer
JobDSL
INTRODUCING:
DevOps
Engineer
Jenkiero
Jenkiero
aquí va una demo