Files
orchard/internal/imageconstant/imageconstant.go
T
Fedor Kororkov 461af8de47 Migrate CI from Cirrus CI to GitHub Actions (#447)
* Migrate CI to GitHub Actions

* Publish Orchard through the OpenAI Homebrew tap

* Scope release secrets to GoReleaser steps

* Separate release and snapshot trust paths

* Use GitHub-hosted macOS 26 runner

* Run macOS unit tests on hosted runner

* Update Homebrew install command

* Build Docker image with GoReleaser

* Use GitHub-hosted Linux runner

* Use smaller Vetu image for Linux tests

* Run Linux tests on hosted ARM runner

* Use host architecture for Linux integration tests

* Preinstall Cloud Hypervisor for Linux tests

* Select Linux test images by architecture

* Satisfy platform image lint rules

* Format platform image errors

* Enable KVM access for Linux tests

* Honor VM wait time in WebSocket requests

* Satisfy WebSocket client lint rules

* Allow hosted Linux integration tests more time
2026-07-16 17:57:06 -04:00

49 lines
1.1 KiB
Go

package imageconstant
import (
"errors"
"fmt"
v1 "github.com/cirruslabs/orchard/pkg/resource/v1"
)
var ErrUnsupportedPlatform = errors.New("unsupported platform")
const (
DefaultMacosImage = "ghcr.io/cirruslabs/macos-tahoe-base:latest"
DefaultLinuxAMD64Image = "ghcr.io/cirruslabs/ubuntu-amd64:24.04"
DefaultLinuxARM64Image = "ghcr.io/cirruslabs/ubuntu:24.04"
)
func DefaultImage(operatingSystem v1.OS, architecture v1.Architecture) (string, error) {
switch operatingSystem {
case v1.OSDarwin:
if architecture != v1.ArchitectureARM64 {
return "", fmt.Errorf(
"%w: %s/%s",
ErrUnsupportedPlatform,
operatingSystem,
architecture,
)
}
return DefaultMacosImage, nil
case v1.OSLinux:
switch architecture {
case v1.ArchitectureAMD64:
return DefaultLinuxAMD64Image, nil
case v1.ArchitectureARM64:
return DefaultLinuxARM64Image, nil
default:
return "", fmt.Errorf(
"%w: %s/%s",
ErrUnsupportedPlatform,
operatingSystem,
architecture,
)
}
default:
return "", fmt.Errorf("%w: %s/%s", ErrUnsupportedPlatform, operatingSystem, architecture)
}
}