/
config.go
74 lines (63 loc) · 2.59 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package jenkins
import "encoding/xml"
type Config struct {
RAW string `xml:"-"`
XMLName xml.Name `xml:"project"`
KeepDependencies bool `xml:"keepDependencies"`
Properties []interface{} `xml:"properties>ignored"`
Scm interface{} `xml:"scm"`
CanRoam bool `xml:"canRoam"` // true</canRoam>
Disabled bool `xml:"disabled"` // false</disabled>
BlockBuildWhenDownstreamBuilding bool `xml:"blockBuildWhenDownstreamBuilding"` // false</blockBuildWhenDownstreamBuilding>
BlockBuildWhenUpstreamBuilding bool `xml:"blockBuildWhenUpstreamBuilding"` // false</blockBuildWhenUpstreamBuilding>
ConcurrentBuild bool `xml:"concurrentBuild"`
//Triggers []interface{} `xml:"triggers>trigger"`
// Builders []interface{} `xml:"builders>builder"`
SCMTrigger []*SCMTrigger `xml:"triggers>hudson.triggers.SCMTrigger"`
ShellBuilders []*ShellBuilder `xml:"builders>hudson.tasks.Shell"`
TimerTriggers []*TimerTrigger `xml:"triggers>hudson.triggers.TimerTrigger"`
AssignedToNode string `xml:"assignedNode,omitempty"`
Publishers []interface{} `xml:"publishers>ignored"`
LogRotator *LogRotator `xml:"logRotator,omitempty"`
}
type ShellBuilder struct {
Command string `xml:"command"`
}
type LogRotator struct {
Class string `xml:"class,attr"`
DaysToKeep int `xml:"daysToKeep"`
NumToKeep int `xml:"numToKeep"`
ArtifactDaysToKeep int `xml:"artifactDaysToKeep"`
ArtifactNumToKeep int `xml:"artifactNumToKeep"`
}
func NewLogRotator(n int) *LogRotator {
return &LogRotator{
Class: "hudson.tasks.LogRotator",
DaysToKeep: -1,
NumToKeep: n,
ArtifactDaysToKeep: -1,
ArtifactNumToKeep: -1,
}
}
type Builders struct {
Tasks []interface{} `xml:""`
}
type ShellTask struct {
XMLName xml.Name `xml:"hudson.tasks.Shell"`
Command string `xml:"command"`
}
type TimerTrigger struct {
XMLName xml.Name `xml:"hudson.triggers.TimerTrigger"`
Spec string `xml:"spec"`
}
func NullScm() *Scm {
return &Scm{Class: "hudson.scm.NullSCM"}
}
type SCMTrigger struct {
XMLName xml.Name `xml:"hudson.triggers.SCMTrigger"`
}
type Scm struct {
Class string `xml:"class,attr"`
Plugin string `xml:"plugin,attr,omitempty"`
ConfigVersion int `xml:"configVersion,omitempty"`
}