Wire runner caches and forge secrets through agenix
This commit is contained in:
parent
afc3e79eb0
commit
ed247b2f5e
20 changed files with 299 additions and 64 deletions
|
|
@ -206,12 +206,8 @@ func (d *Dispatcher) launchMacOSRunner(ctx context.Context, runnerName string, r
|
|||
for k, v := range req.ExtraEnv {
|
||||
env[k] = v
|
||||
}
|
||||
// Best-effort caching: workflows call Scripts/nscloud-cache.sh, which is a
|
||||
// no-op unless NSC_CACHE_PATH is set. This may still be skipped if spacectl
|
||||
// lacks credentials, but setting the path is harmless and keeps behavior
|
||||
// consistent across macOS / Linux runners.
|
||||
if _, ok := env["NSC_CACHE_PATH"]; !ok {
|
||||
env["NSC_CACHE_PATH"] = "/Users/runner/.cache/nscloud"
|
||||
env["NSC_CACHE_PATH"] = d.opts.MacosCachePath
|
||||
}
|
||||
|
||||
deadline := timestamppb.New(time.Now().Add(ttl))
|
||||
|
|
@ -243,10 +239,15 @@ func (d *Dispatcher) launchMacOSRunner(ctx context.Context, runnerName string, r
|
|||
},
|
||||
},
|
||||
}
|
||||
experimental := &computev1beta.CreateInstanceRequest_ExperimentalFeatures{}
|
||||
if imageID := macosComputeBaseImageID(d.opts.MacosBaseImageID); imageID != "" {
|
||||
createReq.Experimental = &computev1beta.CreateInstanceRequest_ExperimentalFeatures{
|
||||
MacosBaseImageId: imageID,
|
||||
}
|
||||
experimental.MacosBaseImageId = imageID
|
||||
}
|
||||
if volumes := computeCacheVolumeRequests(d.opts.MacosCacheVolumes); len(volumes) > 0 {
|
||||
experimental.Volumes = volumes
|
||||
}
|
||||
if experimental.MacosBaseImageId != "" || len(experimental.Volumes) > 0 {
|
||||
createReq.Experimental = experimental
|
||||
}
|
||||
|
||||
d.log.Info("launching Namespace macos runner",
|
||||
|
|
@ -572,6 +573,22 @@ func (d *Dispatcher) destroyComputeInstance(ctx context.Context, client computev
|
|||
d.log.Info("macos runner destroyed", "runner", runnerName, "instance", instanceID)
|
||||
}
|
||||
|
||||
func computeCacheVolumeRequests(volumes []CacheVolume) []*computev1beta.VolumeRequest {
|
||||
var out []*computev1beta.VolumeRequest
|
||||
for _, volume := range volumes {
|
||||
if strings.TrimSpace(volume.Tag) == "" || strings.TrimSpace(volume.MountPoint) == "" || volume.SizeGb <= 0 {
|
||||
continue
|
||||
}
|
||||
out = append(out, &computev1beta.VolumeRequest{
|
||||
MountPoint: volume.MountPoint,
|
||||
Tag: volume.Tag,
|
||||
SizeMb: volume.SizeGb * 1024,
|
||||
PersistencyKind: computev1beta.VolumeRequest_CACHE,
|
||||
})
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func macosBootstrapScript() string {
|
||||
// Keep this script self-contained: it runs on a fresh macOS VM base image.
|
||||
var b strings.Builder
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue