forked from go-vela/types
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_package.go
62 lines (49 loc) · 1.29 KB
/
build_package.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
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
package types
import (
"github.com/go-vela/types/library"
"github.com/go-vela/types/pipeline"
)
// BuildPackage is the library representation of a build for a pipeline.
//
// swagger:model BuildPackage
type BuildPackage struct {
Build *library.Build `json:"build,omitempty"`
Secrets []*library.Secret `json:"secrets,omitempty"`
Pipeline *pipeline.Build `json:"pipeline,omitempty"`
Repo *library.Repo `json:"repo,omitempty"`
User *library.User `json:"user,omitempty"`
Token string `json:"token,omitempty"`
}
func (b *BuildPackage) WithBuild(build *library.Build) *BuildPackage {
if build != nil {
b.Build = build
}
return b
}
func (b *BuildPackage) WithPipeline(pipeline *pipeline.Build) *BuildPackage {
if pipeline != nil {
b.Pipeline = pipeline
}
return b
}
func (b *BuildPackage) WithRepo(repo *library.Repo) *BuildPackage {
if repo != nil {
b.Repo = repo
}
return b
}
func (b *BuildPackage) WithUser(user *library.User) *BuildPackage {
if user != nil {
b.User = user
}
return b
}
func (b *BuildPackage) WithToken(token string) *BuildPackage {
if len(token) != 0 {
b.Token = token
}
return b
}