Skip to content

Commit 4949035

Browse files
committed
Improve Jenkinsfile examples
Show more complete examples, including running commands on labelled nodes.
1 parent 0b1435e commit 4949035

File tree

4 files changed

+71
-38
lines changed

4 files changed

+71
-38
lines changed

app/styles/_forms.less

+4-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@
2727
padding: 19px;
2828
margin-bottom: 20px;
2929
border: 1px solid @color-pf-black-300;
30-
.copy-to-clipboard {
31-
margin-top: 3px;
32-
}
30+
}
31+
32+
.jenkinsfile-examples .copy-to-clipboard {
33+
margin-top: 3px;
3334
}
3435

3536
.compute-resource {

app/views/edit/jenkinsfile-examples.html

+35-20
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,57 @@
1-
<div>
1+
<div class="jenkinsfile-examples">
22
<p>
33
A Jenkinsfile is a Groovy script that defines your pipeline. In the Jenkinsfile, you can declare
44
pipeline stages and run one or more steps within each stage. Here are some examples you can use
55
in your pipelines.
66
</p>
77
<p>
8-
Declare a new pipeline stage called <var>Build:</var>
8+
Checkout source code and run the shell command <var>make:</var>
99
<copy-to-clipboard
10-
display-wide="true"
11-
clipboard-text="'stage \'Build\''">
10+
display-wide="true"
11+
clipboard-text="'node {
12+
stage \'Checkout\'
13+
checkout scm
14+
stage \'Build\'
15+
sh \'make\'
16+
}
17+
'" multiline="true">
1218
</copy-to-clipboard>
1319
</p>
1420
<p>
15-
Start a build for build config <var>my-build-config:</var>
21+
Run an OpenShift build and deployment:
1622
<copy-to-clipboard
17-
display-wide="true"
18-
clipboard-text="'openshiftBuild(buildConfig: \'my-build-config\', showBuildLogs: \'true\')'">
23+
display-wide="true"
24+
clipboard-text="'node {
25+
stage \'Build\'
26+
openshiftBuild(buildConfig: \'my-build-config\', showBuildLogs: \'true\')
27+
stage \'Deploy\'
28+
openshiftDeploy(deploymentConfig: \'my-deployment-config\')
29+
}
30+
'" multiline="true">
1931
</copy-to-clipboard>
2032
</p>
2133
<p>
22-
Start a deployment for deployment config <var>my-deployment-config:</var>
23-
<copy-to-clipboard
24-
display-wide="true"
25-
clipboard-text="'openshiftDeploy(deploymentConfig: \'my-deployment-config\')'">
26-
</copy-to-clipboard>
27-
</p>
28-
<p>
29-
Run the shell command <var>make test:</var>
34+
Prompt for manual input:
3035
<copy-to-clipboard
31-
display-wide="true"
32-
clipboard-text="'sh \'make test\''">
36+
display-wide="true"
37+
clipboard-text="'node {
38+
stage \'Approve\'
39+
input \'Promote to production?\'
40+
}
41+
'" multiline="true">
3342
</copy-to-clipboard>
3443
</p>
3544
<p>
36-
Prompt for manual input:
45+
Run stages on a node labelled <var>maven:</var>
3746
<copy-to-clipboard
38-
display-wide="true"
39-
clipboard-text="'input \'Promote to production?\''">
47+
display-wide="true"
48+
clipboard-text="'node(\'maven\') {
49+
stage \'Checkout\'
50+
checkout scm
51+
stage \'Unit Test\'
52+
sh \'mvn test\'
53+
}
54+
'" multiline="true">
4055
</copy-to-clipboard>
4156
</p>
4257
<p>

dist/scripts/templates.js

+31-14
Original file line numberDiff line numberDiff line change
@@ -9251,33 +9251,50 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
92519251

92529252

92539253
$templateCache.put('views/edit/jenkinsfile-examples.html',
9254-
"<div>\n" +
9254+
"<div class=\"jenkinsfile-examples\">\n" +
92559255
"<p>\n" +
92569256
"A Jenkinsfile is a Groovy script that defines your pipeline. In the Jenkinsfile, you can declare pipeline stages and run one or more steps within each stage. Here are some examples you can use in your pipelines.\n" +
92579257
"</p>\n" +
92589258
"<p>\n" +
9259-
"Declare a new pipeline stage called <var>Build:</var>\n" +
9260-
"<copy-to-clipboard display-wide=\"true\" clipboard-text=\"'stage \\'Build\\''\">\n" +
9261-
"</copy-to-clipboard>\n" +
9262-
"</p>\n" +
9263-
"<p>\n" +
9264-
"Start a build for build config <var>my-build-config:</var>\n" +
9265-
"<copy-to-clipboard display-wide=\"true\" clipboard-text=\"'openshiftBuild(buildConfig: \\'my-build-config\\', showBuildLogs: \\'true\\')'\">\n" +
9259+
"Checkout source code and run the shell command <var>make:</var>\n" +
9260+
"<copy-to-clipboard display-wide=\"true\" clipboard-text=\"'node {\n" +
9261+
" stage \\'Checkout\\'\n" +
9262+
" checkout scm\n" +
9263+
" stage \\'Build\\'\n" +
9264+
" sh \\'make\\'\n" +
9265+
"}\n" +
9266+
"'\" multiline=\"true\">\n" +
92669267
"</copy-to-clipboard>\n" +
92679268
"</p>\n" +
92689269
"<p>\n" +
9269-
"Start a deployment for deployment config <var>my-deployment-config:</var>\n" +
9270-
"<copy-to-clipboard display-wide=\"true\" clipboard-text=\"'openshiftDeploy(deploymentConfig: \\'my-deployment-config\\')'\">\n" +
9270+
"Run an OpenShift build and deployment:\n" +
9271+
"<copy-to-clipboard display-wide=\"true\" clipboard-text=\"'node {\n" +
9272+
" stage \\'Build\\'\n" +
9273+
" openshiftBuild(buildConfig: \\'my-build-config\\', showBuildLogs: \\'true\\')\n" +
9274+
" stage \\'Deploy\\'\n" +
9275+
" openshiftDeploy(deploymentConfig: \\'my-deployment-config\\')\n" +
9276+
"}\n" +
9277+
"'\" multiline=\"true\">\n" +
92719278
"</copy-to-clipboard>\n" +
92729279
"</p>\n" +
92739280
"<p>\n" +
9274-
"Run the shell command <var>make test:</var>\n" +
9275-
"<copy-to-clipboard display-wide=\"true\" clipboard-text=\"'sh \\'make test\\''\">\n" +
9281+
"Prompt for manual input:\n" +
9282+
"<copy-to-clipboard display-wide=\"true\" clipboard-text=\"'node {\n" +
9283+
" stage \\'Approve\\'\n" +
9284+
" input \\'Promote to production?\\'\n" +
9285+
"}\n" +
9286+
"'\" multiline=\"true\">\n" +
92769287
"</copy-to-clipboard>\n" +
92779288
"</p>\n" +
92789289
"<p>\n" +
9279-
"Prompt for manual input:\n" +
9280-
"<copy-to-clipboard display-wide=\"true\" clipboard-text=\"'input \\'Promote to production?\\''\">\n" +
9290+
"Run stages on a node labelled <var>maven:</var>\n" +
9291+
"<copy-to-clipboard display-wide=\"true\" clipboard-text=\"'node(\\'maven\\') {\n" +
9292+
" stage \\'Checkout\\'\n" +
9293+
" checkout scm\n" +
9294+
" stage \\'Unit Test\\'\n" +
9295+
" sh \\'mvn test\\'\n" +
9296+
"}\n" +
9297+
"'\" multiline=\"true\">\n" +
92819298
"</copy-to-clipboard>\n" +
92829299
"</p>\n" +
92839300
"<p>\n" +

dist/styles/main.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -3585,7 +3585,7 @@ to{transform:rotate(359deg)}
35853585
.copy-to-clipboard-multiline pre{background-color:#fff;max-width:100%;overflow-x:auto}
35863586
.input-group-addon.wildcard-prefix{padding-left:10px}
35873587
.editor-examples{padding:19px;margin-bottom:20px;border:1px solid #d1d1d1}
3588-
.editor-examples .copy-to-clipboard{margin-top:3px}
3588+
.jenkinsfile-examples .copy-to-clipboard{margin-top:3px}
35893589
.compute-resource{margin-bottom:5px}
35903590
@media (max-width:767px){.compute-resource .inline-select{margin-top:5px}
35913591
}

0 commit comments

Comments
 (0)