Changes for page Jenkinsfile
Last modified by Gábor Mándity on 2025/09/18 08:09
To version 2.1
edited by Gábor Mándity
on 2025/09/18 08:09
on 2025/09/18 08:09
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -xwiki:XWiki. sdcloud-admin-01 +xwiki:XWiki.gabormandityt-systemscom - Content
-
... ... @@ -23,8 +23,7 @@ 23 23 24 24 At the top of the Jenkinsfile add a buildDiscarder to the properties to let Jenkins delete old artifacts or complete job executions: 25 25 26 -{{code language="groovy" title="ℹ **Example** 27 - "}} 26 +{{code language="groovy" title="ℹ **Example**"}} 28 28 properties([ 29 29 buildDiscarder(logRotator(numToKeepStr: '50', artifactNumToKeepStr: '5')) 30 30 ]) ... ... @@ -41,8 +41,7 @@ 41 41 42 42 Instead of having pipelines just triggered on source code changes you can also use cron syntax to define dates and times that shoud automatically trigger the pipeline. 43 43 44 -{{code language="groovy" title="**ℹ Example** 45 - "}} 43 +{{code language="groovy" title="**ℹ Example**"}} 46 46 properties([ 47 47 pipelineTriggers([cron('TZ=Europe/Berlin \n 00 08 * * 1-5')]) 48 48 ]) ... ... @@ -56,8 +56,7 @@ 56 56 57 57 At the top of the Jenkinsfile add a durabilityHint to the properties: 58 58 59 -{{code language="groovy" title="**ℹ Example** 60 - "}} 57 +{{code language="groovy" title="**ℹ Example**"}} 61 61 properties([ 62 62 durabilityHint('PERFORMANCE_OPTIMIZED') 63 63 ]) ... ... @@ -83,8 +83,7 @@ 83 83 84 84 Supported symbolic name is 'maven'. The exact version can be looked up at the start page of your Jenkins, e.g. [[https:~~/~~/CUSTOMER.devops.t-systems.net/jenkins/>>url:https://CUSTOMER.devops.t-systems.net/jenkins/||shape="rect"]] 85 85 86 -{{code language="groovy" title="ℹ **Scripted Pipeline** 87 - "}} 83 +{{code language="groovy" title="ℹ **Scripted Pipeline**"}} 88 88 withMaven(maven: 'maven') 89 89 { 90 90 sh 'mvn --version' ... ... @@ -99,8 +99,7 @@ 99 99 100 100 The following examples use jdk17. 101 101 102 -{{code language="groovy" title="**ℹ Scripted Pipeline** 103 - "}} 98 +{{code language="groovy" title="**ℹ Scripted Pipeline**"}} 104 104 env.JAVA_HOME = "${tool 'jdk17'}" 105 105 env.PATH="${env.JAVA_HOME}/bin:${env.PATH}" 106 106 sh 'java -version' ... ... @@ -108,8 +108,7 @@ 108 108 109 109 When you use the [[doc:Jenkins.Jenkins Shared Library.WebHome]] you simply do 110 110 111 -{{code language="groovy" title="**ℹ Scripted Pipeline** 112 - "}} 106 +{{code language="groovy" title="**ℹ Scripted Pipeline**"}} 113 113 @Library('sdcloud') _ 114 114 115 115 sdcPipeline(jdk: 'jdk17') ... ... @@ -123,8 +123,7 @@ 123 123 124 124 The following examples use 'nodejs18'. 125 125 126 -{{code language="groovy" title="**ℹ Scripted Pipeline** 127 - "}} 120 +{{code language="groovy" title="**ℹ Scripted Pipeline**"}} 128 128 env.NODEJS_HOME = "${tool 'nodejs18'}" 129 129 env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}" 130 130 sh 'node --version' ... ... @@ -133,8 +133,7 @@ 133 133 134 134 When you use the [[doc:Jenkins.Jenkins Shared Library.WebHome]] you simply do 135 135 136 -{{code language="groovy" title="**ℹ Scripted Pipeline** 137 - "}} 129 +{{code language="groovy" title="**ℹ Scripted Pipeline**"}} 138 138 @Library('sdcloud') _ 139 139 140 140 sdcPipeline(nodejs: 'nodejs18') ... ... @@ -141,3 +141,26 @@ 141 141 {{/code}} 142 142 143 143 to use the nodejs version of your choice. See [[doc:Jenkins.Jenkins Shared Library.WebHome||anchor="PipelineCustomization"]] for more information. 136 + 137 +== Golang == 138 + 139 +The supported symbolic names are listed at the start page of your Jenkins (e.g. [[https:~~/~~/CUSTOMER.devops.t-systems.net/jenkins/>>url:https://CUSTOMER.devops.t-systems.net/jenkins/||shape="rect"]]) and start with 'go'. As an example 'go1.25' would be referring to the latest release of Golang v1.25. The short name 'go' is usually set to the recommended LTS version of Golang. 140 + 141 +The following examples use 'go1.25'. 142 + 143 +{{code language="groovy" title="**ℹ Scripted Pipeline**"}} 144 +def root = tool type: 'go', name: go1.25 145 +withEnv(["GOROOT=${root}", "PATH+GO=${root}/bin"]) { 146 + sh 'go version' 147 +} 148 +{{/code}} 149 + 150 +When you use the [[doc:Jenkins.Jenkins Shared Library.WebHome]] you simply do 151 + 152 +{{code language="groovy" title="**ℹ Scripted Pipeline**"}} 153 +@Library('sdcloud') _ 154 + 155 +sdcPipeline(go: 'go1.25') 156 +{{/code}} 157 + 158 +to use the go version of your choice. See [[doc:Jenkins.Jenkins Shared Library.WebHome||anchor="PipelineCustomization"]] for more information.