forked from gravitational/teleport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpromote.go
125 lines (112 loc) · 4.15 KB
/
promote.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
* Teleport
* Copyright (C) 2023 Gravitational, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package main
import "time"
func promoteBuildPipelines() []pipeline {
promotePipelines := make([]pipeline, 0)
promotePipelines = append(promotePipelines, promoteBuildOsRepoPipeline())
ociPipeline := ghaBuildPipeline(ghaBuildType{
buildType: buildType{os: "linux", fips: false},
trigger: triggerPromote,
pipelineName: "promote-teleport-oci-distroless-images",
workflows: []ghaWorkflow{
{
name: "promote-teleport-oci-distroless.yml",
timeout: 150 * time.Minute,
ref: "${DRONE_TAG}",
shouldTagWorkflow: true,
inputs: map[string]string{
"release-source-tag": "${DRONE_TAG}",
},
},
},
})
ociPipeline.Trigger.Target.Include = append(ociPipeline.Trigger.Target.Include, "promote-distroless")
promotePipelines = append(promotePipelines, ociPipeline)
amiPipeline := ghaBuildPipeline(ghaBuildType{
buildType: buildType{os: "linux", fips: false},
trigger: triggerPromote,
pipelineName: "promote-teleport-hardened-amis",
workflows: []ghaWorkflow{
{
name: "promote-teleport-hardened-amis.yaml",
timeout: 150 * time.Minute,
ref: "${DRONE_TAG}",
srcRefVar: "DRONE_TAG",
shouldTagWorkflow: true,
inputs: map[string]string{
"release-source-tag": "${DRONE_TAG}",
},
},
},
})
amiPipeline.Trigger.Target.Include = append(amiPipeline.Trigger.Target.Include, "promote-hardened-amis")
promotePipelines = append(promotePipelines, amiPipeline)
updaterPipeline := ghaBuildPipeline(ghaBuildType{
buildType: buildType{os: "linux", fips: false},
trigger: triggerPromote,
pipelineName: "promote-teleport-kube-agent-updater-oci-images",
workflows: []ghaWorkflow{
{
name: "promote-teleport-kube-agent-updater-oci.yml",
timeout: 150 * time.Minute,
ref: "${DRONE_TAG}",
shouldTagWorkflow: true,
inputs: map[string]string{
"release-source-tag": "${DRONE_TAG}",
},
},
},
})
updaterPipeline.Trigger.Target.Include = append(updaterPipeline.Trigger.Target.Include, "promote-updater")
promotePipelines = append(promotePipelines, updaterPipeline)
teleportSpaceliftRunnerPipeline := ghaBuildPipeline(ghaBuildType{
buildType: buildType{os: "linux", fips: false},
trigger: triggerPromote,
pipelineName: "promote-teleport-spacelift-runner-oci-images",
workflows: []ghaWorkflow{
{
name: "promote-teleport-spacelift-runner-oci.yml",
timeout: 150 * time.Minute,
ref: "${DRONE_TAG}",
shouldTagWorkflow: true,
inputs: map[string]string{
"release-source-tag": "${DRONE_TAG}",
},
},
},
})
teleportSpaceliftRunnerPipeline.Trigger.Target.Include = append(teleportSpaceliftRunnerPipeline.Trigger.Target.Include, "promote-teleport-spacelift-runner")
promotePipelines = append(promotePipelines, teleportSpaceliftRunnerPipeline)
return promotePipelines
}
func publishReleasePipeline() pipeline {
p := relcliPipeline(triggerPromote, "publish-rlz", "Publish in Release API", "auto_publish -f -v 6")
p.DependsOn = []string{"promote-build"} // Manually written pipeline
for _, dep := range buildContainerImagePipelines() {
for _, event := range dep.Trigger.Event.Include {
if event == "promote" {
p.DependsOn = append(p.DependsOn, dep.Name)
}
}
}
for _, dep := range promoteBuildPipelines() {
p.DependsOn = append(p.DependsOn, dep.Name)
}
return p
}