Skip to content

Commit

Permalink
feat: release specific build container (#86)
Browse files Browse the repository at this point in the history
Co-authored-by: raphaelcoeffic <[email protected]>
  • Loading branch information
raphaelcoeffic and raphaelcoeffic authored Jan 28, 2025
1 parent 894282d commit 80c9b05
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
7 changes: 6 additions & 1 deletion artifactory/artifactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,19 @@ func (artifactory *Artifactory) CreateBuildJob(
return nil, fmt.Errorf("failed to marshal build flags: %w", err)
}

buildContainer := request.GetBuildContainerImage()
if len(buildContainer) == 0 {
buildContainer = artifactory.BuildContainerImage
}

job, err = artifactory.BuildJobsRepository.Create(BuildJobModel{
Status: WaitingForBuild,
CommitRef: request.Release,
CommitHash: request.GetCommitHash(),
Target: request.Target,
Flags: optFlagsJSON,
BuildFlags: buildFlagsJSON,
ContainerImage: artifactory.BuildContainerImage,
ContainerImage: buildContainer,
BuildFlagsHash: request.HashTargetAndFlags(),
AuditLogs: []AuditLogModel{
{
Expand Down
4 changes: 4 additions & 0 deletions artifactory/build_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ func (req *BuildRequest) GetBuildFlags() (*[]firmware.BuildFlag, error) {
return &buildFlags, nil
}

func (req *BuildRequest) GetBuildContainerImage() string {
return req.defs.GetBuildContainer(req.Release)
}

func (req *BuildRequest) GetCommitHash() string {
return req.defs.GetCommitHashByRef(req.Release)
}
13 changes: 11 additions & 2 deletions targets.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,58 @@
}
},
"v2.10.6": {
"sha": "14adf0474ccedbd935fac7d71958946680b5fdfc"
"sha": "14adf0474ccedbd935fac7d71958946680b5fdfc",
"build_container": "ghcr.io/edgetx/edgetx-builder:2.10"
},
"v2.10.5": {
"sha": "6b539d03c66061e431d9090531ac192f7550a102"
"sha": "6b539d03c66061e431d9090531ac192f7550a102",
"build_container": "ghcr.io/edgetx/edgetx-builder:2.10"
},
"v2.10.4": {
"sha": "9b901689fbd84fb4027b4f898460314d76b1f69a",
"build_container": "ghcr.io/edgetx/edgetx-builder:2.10",
"exclude_targets": [
"bumblebee"
]
},
"v2.10.3": {
"sha": "2fc5a9acab767b7b3f4861d85dffd359d6ad28f6",
"build_container": "ghcr.io/edgetx/edgetx-builder:2.10",
"exclude_targets": [
"bumblebee"
]
},
"v2.10.2": {
"sha": "1de06000cdfe3398840a8d28f7bf5de7fbedc899",
"build_container": "ghcr.io/edgetx/edgetx-builder:2.10",
"exclude_targets": [
"t12max", "tpros", "bumblebee"
]
},
"v2.10.1": {
"sha": "839b60f6cc88d22383a6f686862b3fba4108884e",
"build_container": "ghcr.io/edgetx/edgetx-builder:2.10",
"exclude_targets": [
"f16", "t12max", "tpros", "bumblebee"
]
},
"v2.10.0": {
"sha": "22ce06d3423fdb265c6c7bce6031f1003027bf0c",
"build_container": "ghcr.io/edgetx/edgetx-builder:2.10",
"exclude_targets": [
"f16", "t12max", "t15", "tpros", "bumblebee"
]
},
"v2.9.4": {
"sha": "77884b6a22e20ad91ba6c6656b96bcb2adc86768",
"build_container": "ghcr.io/edgetx/edgetx-builder:2.10",
"exclude_targets": [
"pl18", "pl18ev", "t20", "tprov2", "mt12", "pocket", "f16", "t12max", "t14", "t15", "t20v2", "tpros", "bumblebee"
]
},
"v2.8.5": {
"sha": "cbac1063eb8637457d2a63c367863c6bfd6f0c31",
"build_container": "ghcr.io/edgetx/edgetx-builder:2.10",
"exclude_targets": [
"pl18", "pl18ev", "t20", "tprov2", "mt12", "pocket", "f16", "t12max", "t14", "t15", "t20v2", "tpros", "bumblebee"
]
Expand Down
9 changes: 9 additions & 0 deletions targets/targets_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type Release struct {
SHA string `json:"sha"`
Remote *RemoteSHA `json:"remote,omitempty"`
ExcludeTargets []string `json:"exclude_targets,omitempty"`
BuildContainer string `json:"build_container,omitempty"`
}

type OptionFlag struct {
Expand Down Expand Up @@ -168,6 +169,14 @@ func (def *TargetsDef) GetOptionBuildFlag(target, name string) string {
return ""
}

func (def *TargetsDef) GetBuildContainer(ref string) string {
release, ok := def.Releases[ref]
if !ok {
return ""
}
return release.BuildContainer
}

func SetTargets(defs *TargetsDef) {
targetsDef.Store(defs)
}
Expand Down

0 comments on commit 80c9b05

Please sign in to comment.