Skip to content

Commit 0bebdef

Browse files
committed
Remove stripIndent from examples
1 parent c32c86e commit 0bebdef

10 files changed

+22
-27
lines changed

README.md

+13-16
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ It is not required to run the Jenkins controller inside Kubernetes.
3434
## Configuration
3535

3636
Fill in the Kubernetes plugin configuration.
37-
In order to do that, you will open the Jenkins UI and navigate to
38-
**Manage Jenkins -> Manage Nodes and Clouds -> Configure Clouds -> Add a new cloud -> Kubernetes** and enter
39-
the *Kubernetes URL* and *Jenkins URL* appropriately, unless Jenkins is running in Kubernetes in which case
40-
the defaults work.
37+
In order to do that, you will open the Jenkins UI and navigate to **Manage Jenkins -> Manage Nodes and Clouds -> Configure Clouds -> Add a new cloud -> Kubernetes** and enter the *Kubernetes URL* and *Jenkins URL* appropriately, unless Jenkins is running in Kubernetes in which case the defaults work.
4138

4239
Supported credentials include:
4340

@@ -95,7 +92,7 @@ Jenkins agent.
9592
It should be noted that the main reason to use the global pod template definition is to migrate a huge corpus of
9693
existing projects (including freestyle) to run on Kubernetes without changing job definitions.
9794
New users setting up new Kubernetes builds should use the `podTemplate` step as shown in the example snippets
98-
[here](https://github.com/jenkinsci/kubernetes-plugin/pull/707).
95+
[here](examples).
9996

10097
## Using the pipeline step
10198

@@ -196,7 +193,7 @@ podTemplate(containers: [
196193
or
197194
198195
```groovy
199-
podTemplate(yaml: '''\
196+
podTemplate(yaml: '''
200197
apiVersion: v1
201198
kind: Pod
202199
spec:
@@ -213,7 +210,7 @@ podTemplate(yaml: '''\
213210
- sleep
214211
args:
215212
- 99d
216-
'''.stripIndent()) {
213+
''') {
217214
node(POD_LABEL) {
218215
stage('Get a Maven project') {
219216
git 'https://github.com/jenkinsci/kubernetes-plugin.git'
@@ -325,7 +322,7 @@ In order to support any possible value in Kubernetes `Pod` object, we can pass a
325322
for the template. If any other properties are set outside the YAML, they will take precedence.
326323

327324
```groovy
328-
podTemplate(yaml: '''\
325+
podTemplate(yaml: '''
329326
apiVersion: v1
330327
kind: Pod
331328
metadata:
@@ -339,7 +336,7 @@ podTemplate(yaml: '''\
339336
- sleep
340337
args:
341338
- 99d
342-
'''.stripIndent()) {
339+
''') {
343340
node(POD_LABEL) {
344341
container('busybox') {
345342
echo POD_CONTAINER // displays 'busybox'
@@ -437,7 +434,7 @@ pipeline {
437434
containers:
438435
- name: maven
439436
image: maven:3.8.1-jdk-11
440-
'''.stripIndent()
437+
'''
441438
442439
}
443440
}
@@ -542,7 +539,7 @@ Declarative agents can be defined from yaml
542539
pipeline {
543540
agent {
544541
kubernetes {
545-
yaml '''\
542+
yaml '''
546543
apiVersion: v1
547544
kind: Pod
548545
metadata:
@@ -560,7 +557,7 @@ pipeline {
560557
command:
561558
- cat
562559
tty: true
563-
'''.stripIndent()
560+
'''
564561
}
565562
}
566563
stages {
@@ -671,7 +668,7 @@ In the following example, `nested-pod` will only contain the `maven` container.
671668
pipeline {
672669
agent {
673670
kubernetes {
674-
yaml '''\
671+
yaml '''
675672
spec:
676673
containers:
677674
- name: golang
@@ -680,14 +677,14 @@ pipeline {
680677
- sleep
681678
args:
682679
- 99d
683-
'''.stripIndent()
680+
'''
684681
}
685682
}
686683
stages {
687684
stage('Run maven') {
688685
agent {
689686
kubernetes {
690-
yaml '''\
687+
yaml '''
691688
spec:
692689
containers:
693690
- name: maven
@@ -696,7 +693,7 @@ pipeline {
696693
- sleep
697694
args:
698695
- 99d
699-
'''.stripIndent()
696+
'''
700697
}
701698
}
702699
steps {

examples/containerLog.groovy

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ podTemplate(yaml: '''
1515
tty: true
1616
- name: mongo
1717
image: mongo
18-
'''.stripIndent()
19-
) {
18+
''') {
2019
node(POD_LABEL) {
2120
stage('Integration Test') {
2221
try {

examples/dind.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ podTemplate(yaml: '''
3030
volumeMounts:
3131
- name: docker-socket
3232
mountPath: /var/run
33-
'''.stripIndent()) {
33+
''') {
3434
node(POD_LABEL) {
3535
writeFile file: 'Dockerfile', text: 'FROM scratch'
3636
container('docker') {

examples/dood.groovy

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ podTemplate(yaml: '''
1919
- name: dockersock
2020
hostPath:
2121
path: /var/run/docker.sock
22-
'''.stripIndent()
23-
) {
22+
''') {
2423
node(POD_LABEL) {
2524
stage('Build Docker image') {
2625
git 'https://github.com/jenkinsci/docker-inbound-agent.git'

examples/kaniko-declarative.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pipeline {
3939
items:
4040
- key: .dockerconfigjson
4141
path: config.json
42-
'''.stripIndent()
42+
'''
4343
}
4444
}
4545
stages {

examples/kaniko-gcr.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ podTemplate(yaml: '''
2929
- name: kaniko-secret
3030
secret:
3131
secretName: kaniko-secret
32-
'''.stripIndent()
32+
'''
3333
) {
3434

3535
node(POD_LABEL) {

examples/kaniko.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ podTemplate(yaml: '''
3131
items:
3232
- key: .dockerconfigjson
3333
path: config.json
34-
'''.stripIndent()
34+
'''
3535
) {
3636

3737
node(POD_LABEL) {

examples/multi-container.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ podTemplate(yaml: '''
1919
- sleep
2020
args:
2121
- 99d
22-
'''.stripIndent()
22+
'''
2323
) {
2424

2525
node(POD_LABEL) {

examples/openshift-home-yaml.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ podTemplate(yaml:'''
3333
volumes:
3434
- name: home-volume
3535
emptyDir: {}
36-
'''.stripIndent()) {
36+
''') {
3737
node(POD_LABEL) {
3838
stage('Build a Maven project') {
3939
container('maven') {

examples/selenium.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ podTemplate(yaml: '''
4444
value: :98.0
4545
- name: SE_OPTS
4646
value: -port 5557
47-
'''.stripIndent()) {
47+
''') {
4848

4949
node(POD_LABEL) {
5050
stage('Checkout') {

0 commit comments

Comments
 (0)