Class Job
- All Implemented Interfaces:
Configurable
,KeyVal.Mixin
,UtilsMixin
/*
* Copyright 2022 Thoughtworks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
job('build') {
tasks {
exec {
commandLine = ['make', '-j3', 'doc', 'install']
}
}
}
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionThe list of artifacts generated by this job.boolean
A job can be configured to run on an elastic agent by specifying this attribute, which maps to the id of an existing<profile>
defined in the main config xml.Specifies the list of resources that will be matched against jobs.The number of agents this job should run on.The job hung timeout (in minutes).int
hashCode()
properties
(Closure cl) The list of properties published by this jobvoid
setElasticProfileId
(String elasticProfileId) A job can be configured to run on an elastic agent by specifying this attribute, which maps to the id of an existing<profile>
defined in the main config xml.void
setResources
(List<String> resources) Specifies the list of resources that will be matched against jobs.void
setRunInstanceCount
(Object runInstanceCount) The number of agents this job should run on.void
setTimeout
(Integer timeout) The job hung timeout (in minutes).The list of tabs displayed on the job detail page.The sequence of tasks executed by this job.toString()
Methods inherited from class cd.go.contrib.plugins.configrepo.groovy.dsl.HasEnvironmentVariables
getEnvironmentVariables, getSecureEnvironmentVariables, setEnvironmentVariables, setSecureEnvironmentVariables
Methods inherited from interface cd.go.contrib.plugins.configrepo.groovy.dsl.mixins.Configurable
configure
Methods inherited from interface cd.go.contrib.plugins.configrepo.groovy.dsl.mixins.KeyVal.Mixin
lookup, lookup
Methods inherited from interface cd.go.contrib.plugins.configrepo.groovy.dsl.mixins.UtilsMixin
sanitizeName
-
Constructor Details
-
Job
public Job() -
Job
-
Job
-
-
Method Details
-
artifacts
The list of artifacts generated by this job./*
* Copyright 2022 Thoughtworks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
job('build') {
artifacts {
build {
source = 'target/jcoverage'
destination = 'Jcoverage'
}
test {
source = 'target/reports/junit/**/*.xml'
destination = 'junit-xml'
}
external {
id = 'docker-release-candidate'
storeId = 'dockerhub'
configuration = [
image: 'gocd/gocd-server',
tag : 'latest'
]
secureConfiguration = [
DB_PASSWORD: 'AES:yBk975e1rJiuRnAx9AZ6Og==:ee6yi/2sEh5/TUlbmNWelg=='
]
}
}
}
-
tasks
The sequence of tasks executed by this job./*
* Copyright 2022 Thoughtworks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
job('build') {
tasks {
exec {
commandLine = ['./gradlew', 'clean', 'assemble', 'check']
}
bash {
commandString = "scp foo.jar [email protected]:"
}
}
}
-
tabs
The list of tabs displayed on the job detail page./*
* Copyright 2022 Thoughtworks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
job('build') {
tabs {
tab('JCoverage') {
path = 'Jcoverage/index.html'
}
tab('JUnit') {
path = 'junit/index.html'
}
}
}
-
properties
The list of properties published by this job/*
* Copyright 2022 Thoughtworks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
job('build') {
properties {
property('coverage-percentage') {
source = 'jcoverage.xml'
xpath = '//report/coverage'
}
property('error-count') {
source = 'junit-rport.xml'
xpath = 'string(/testsuite/@errors)'
}
}
}
-
getRunInstanceCount
The number of agents this job should run on. Defaults to1
. Set to string"all"
to run on all agents. -
getTimeout
The job hung timeout (in minutes). If there is no console output for within this interval of time, the job is assumed to be jung and will be terminated by GoCD.Defaults to
0
to never timeout. -
getElasticProfileId
A job can be configured to run on an elastic agent by specifying this attribute, which maps to the id of an existing<profile>
defined in the main config xml. MUST NOT be specified along withresources
-
getResources
Specifies the list of resources that will be matched against jobs. An Agent must have all the Resources specified for a Job to be able to run this job. MUST NOT be specified along withelasticProfileId
-
setRunInstanceCount
The number of agents this job should run on. Defaults to1
. Set to string"all"
to run on all agents. -
setTimeout
The job hung timeout (in minutes). If there is no console output for within this interval of time, the job is assumed to be jung and will be terminated by GoCD.Defaults to
0
to never timeout. -
setElasticProfileId
A job can be configured to run on an elastic agent by specifying this attribute, which maps to the id of an existing<profile>
defined in the main config xml. MUST NOT be specified along withresources
-
setResources
Specifies the list of resources that will be matched against jobs. An Agent must have all the Resources specified for a Job to be able to run this job. MUST NOT be specified along withelasticProfileId
-
equals
- Overrides:
equals
in classHasEnvironmentVariables<Job>
-
hashCode
public int hashCode()- Overrides:
hashCode
in classHasEnvironmentVariables<Job>
-
toString
- Overrides:
toString
in classHasEnvironmentVariables<Job>
-