Skip to content

Commit baeb6cb

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

File tree

4 files changed

+56
-43
lines changed

4 files changed

+56
-43
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

+27-23
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,46 @@
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+
Run an OpenShift build and deployment:
99
<copy-to-clipboard
10-
display-wide="true"
11-
clipboard-text="'stage \'Build\''">
10+
display-wide="true"
11+
clipboard-text="'node {
12+
stage \'Build\'
13+
openshiftBuild(buildConfig: \'my-build-config\', showBuildLogs: \'true\')
14+
stage \'Deploy\'
15+
openshiftDeploy(deploymentConfig: \'my-deployment-config\')
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+
Checkout source code and run shell commands on a node labelled <var>maven:</var>
1622
<copy-to-clipboard
17-
display-wide="true"
18-
clipboard-text="'openshiftBuild(buildConfig: \'my-build-config\', showBuildLogs: \'true\')'">
19-
</copy-to-clipboard>
20-
</p>
21-
<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>
30-
<copy-to-clipboard
31-
display-wide="true"
32-
clipboard-text="'sh \'make test\''">
23+
display-wide="true"
24+
clipboard-text="'node(\'maven\') {
25+
stage \'Checkout\'
26+
checkout scm
27+
stage \'Build\'
28+
sh \'mvn install\'
29+
stage \'Unit Test\'
30+
sh \'mvn test\'
31+
}
32+
'" multiline="true">
3333
</copy-to-clipboard>
3434
</p>
3535
<p>
3636
Prompt for manual input:
3737
<copy-to-clipboard
38-
display-wide="true"
39-
clipboard-text="'input \'Promote to production?\''">
38+
display-wide="true"
39+
clipboard-text="'node {
40+
stage \'Approve\'
41+
input \'Promote to production?\'
42+
}
43+
'" multiline="true">
4044
</copy-to-clipboard>
4145
</p>
4246
<p>

dist/scripts/templates.js

+24-16
Original file line numberDiff line numberDiff line change
@@ -9251,33 +9251,41 @@ 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" +
9266-
"</copy-to-clipboard>\n" +
9267-
"</p>\n" +
9268-
"<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" +
9259+
"Run an OpenShift build and deployment:\n" +
9260+
"<copy-to-clipboard display-wide=\"true\" clipboard-text=\"'node {\n" +
9261+
" stage \\'Build\\'\n" +
9262+
" openshiftBuild(buildConfig: \\'my-build-config\\', showBuildLogs: \\'true\\')\n" +
9263+
" stage \\'Deploy\\'\n" +
9264+
" openshiftDeploy(deploymentConfig: \\'my-deployment-config\\')\n" +
9265+
"}\n" +
9266+
"'\" multiline=\"true\">\n" +
92719267
"</copy-to-clipboard>\n" +
92729268
"</p>\n" +
92739269
"<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" +
9270+
"Checkout source code and run shell commands on a node labelled <var>maven:</var>\n" +
9271+
"<copy-to-clipboard display-wide=\"true\" clipboard-text=\"'node(\\'maven\\') {\n" +
9272+
" stage \\'Checkout\\'\n" +
9273+
" checkout scm\n" +
9274+
" stage \\'Build\\'\n" +
9275+
" sh \\'mvn install\\'\n" +
9276+
" stage \\'Unit Test\\'\n" +
9277+
" sh \\'mvn test\\'\n" +
9278+
"}\n" +
9279+
"'\" multiline=\"true\">\n" +
92769280
"</copy-to-clipboard>\n" +
92779281
"</p>\n" +
92789282
"<p>\n" +
92799283
"Prompt for manual input:\n" +
9280-
"<copy-to-clipboard display-wide=\"true\" clipboard-text=\"'input \\'Promote to production?\\''\">\n" +
9284+
"<copy-to-clipboard display-wide=\"true\" clipboard-text=\"'node {\n" +
9285+
" stage \\'Approve\\'\n" +
9286+
" input \\'Promote to production?\\'\n" +
9287+
"}\n" +
9288+
"'\" multiline=\"true\">\n" +
92819289
"</copy-to-clipboard>\n" +
92829290
"</p>\n" +
92839291
"<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)