Some checks failed
Build and Release / Build Binaries (arm64, linux) (push) Has been skipped
Build and Release / Create Release (push) Has been skipped
Build and Release / Lint (push) Failing after 3s
Build and Release / Build Binaries (amd64, darwin) (push) Has been skipped
Build and Release / Build Binaries (amd64, linux) (push) Has been skipped
Build and Release / Build Binaries (amd64, windows) (push) Has been skipped
Build and Release / Build Binaries (arm64, darwin) (push) Has been skipped
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 51s
Build and Release / Unit Tests (push) Has been cancelled
- Add DistroInfo struct to parse Linux distribution from capabilities
- Add runner label management endpoints (add/remove/use-suggested)
- Update runner edit UI with:
- Clickable labels with X to remove
- Suggested labels with + to add individually
- Use All Suggested Labels button
- Buttons moved to full-width row below columns
- Suggested labels derived from OS and distro (linux, linux-latest, debian, debian-latest, etc)
🤖 Generated with Claude Code
123 lines
4.8 KiB
Go
123 lines
4.8 KiB
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package structs
|
|
|
|
import "time"
|
|
|
|
// BandwidthInfo holds network bandwidth test results
|
|
type BandwidthInfo struct {
|
|
DownloadMbps float64 `json:"download_mbps"`
|
|
UploadMbps float64 `json:"upload_mbps,omitempty"`
|
|
Latency float64 `json:"latency_ms,omitempty"`
|
|
TestedAt time.Time `json:"tested_at"`
|
|
}
|
|
|
|
// DiskInfo holds disk space information for a runner
|
|
type DiskInfo struct {
|
|
Total uint64 `json:"total_bytes"`
|
|
Free uint64 `json:"free_bytes"`
|
|
Used uint64 `json:"used_bytes"`
|
|
UsedPercent float64 `json:"used_percent"`
|
|
}
|
|
|
|
// DistroInfo holds Linux distribution information
|
|
type DistroInfo struct {
|
|
ID string `json:"id,omitempty"` // e.g., "ubuntu", "debian", "fedora"
|
|
VersionID string `json:"version_id,omitempty"` // e.g., "24.04", "12"
|
|
PrettyName string `json:"pretty_name,omitempty"` // e.g., "Ubuntu 24.04 LTS"
|
|
}
|
|
|
|
// RunnerCapability represents the detailed capabilities of a runner
|
|
type RunnerCapability struct {
|
|
OS string `json:"os"`
|
|
Arch string `json:"arch"`
|
|
Distro *DistroInfo `json:"distro,omitempty"`
|
|
Docker bool `json:"docker"`
|
|
DockerCompose bool `json:"docker_compose"`
|
|
ContainerRuntime string `json:"container_runtime,omitempty"`
|
|
Shell []string `json:"shell,omitempty"`
|
|
Tools map[string][]string `json:"tools,omitempty"`
|
|
Features *CapabilityFeatures `json:"features,omitempty"`
|
|
Limitations []string `json:"limitations,omitempty"`
|
|
Disk *DiskInfo `json:"disk,omitempty"`
|
|
Bandwidth *BandwidthInfo `json:"bandwidth,omitempty"`
|
|
SuggestedLabels []string `json:"suggested_labels,omitempty"`
|
|
}
|
|
|
|
// CapabilityFeatures represents feature support flags
|
|
type CapabilityFeatures struct {
|
|
ArtifactsV4 bool `json:"artifacts_v4"`
|
|
Cache bool `json:"cache"`
|
|
Services bool `json:"services"`
|
|
CompositeActions bool `json:"composite_actions"`
|
|
}
|
|
|
|
// ActionSupport represents version support for an action
|
|
type ActionSupport struct {
|
|
Versions []string `json:"versions"`
|
|
Notes string `json:"notes,omitempty"`
|
|
}
|
|
|
|
// PlatformInfo represents Gitea platform capabilities
|
|
type PlatformInfo struct {
|
|
Type string `json:"type"`
|
|
Version string `json:"version"`
|
|
ActionsVersion string `json:"actions_version,omitempty"`
|
|
DefaultActionsURL string `json:"default_actions_url"`
|
|
SupportedActions map[string]ActionSupport `json:"supported_actions,omitempty"`
|
|
UnsupportedFeatures []string `json:"unsupported_features,omitempty"`
|
|
}
|
|
|
|
// WorkflowHints provides hints for AI workflow generation
|
|
type WorkflowHints struct {
|
|
PreferredCheckout string `json:"preferred_checkout,omitempty"`
|
|
ArtifactUploadAlternative string `json:"artifact_upload_alternative,omitempty"`
|
|
SecretAccess string `json:"secret_access,omitempty"`
|
|
}
|
|
|
|
// RunnerWithCapabilities represents a runner with its capabilities for API response
|
|
type RunnerWithCapabilities struct {
|
|
ID int64 `json:"id"`
|
|
Name string `json:"name"`
|
|
Status string `json:"status"`
|
|
Labels []string `json:"labels"`
|
|
Capabilities *RunnerCapability `json:"capabilities,omitempty"`
|
|
}
|
|
|
|
// ActionsCapabilitiesResponse is the response for the capabilities endpoint
|
|
type ActionsCapabilitiesResponse struct {
|
|
Runners []*RunnerWithCapabilities `json:"runners"`
|
|
Platform *PlatformInfo `json:"platform"`
|
|
WorkflowHints *WorkflowHints `json:"workflow_hints,omitempty"`
|
|
}
|
|
|
|
// WorkflowValidationRequest is the request for workflow validation
|
|
type WorkflowValidationRequest struct {
|
|
Content string `json:"content" binding:"Required"`
|
|
}
|
|
|
|
// WorkflowValidationWarning represents a validation warning
|
|
type WorkflowValidationWarning struct {
|
|
Line int `json:"line,omitempty"`
|
|
Action string `json:"action,omitempty"`
|
|
Severity string `json:"severity"`
|
|
Message string `json:"message"`
|
|
Suggestion string `json:"suggestion,omitempty"`
|
|
}
|
|
|
|
// RunnerMatch represents job-to-runner matching result
|
|
type RunnerMatch struct {
|
|
Job string `json:"job"`
|
|
RunsOn []string `json:"runs_on"`
|
|
MatchedRunners []string `json:"matched_runners,omitempty"`
|
|
CapabilitiesMet bool `json:"capabilities_met"`
|
|
}
|
|
|
|
// WorkflowValidationResponse is the response for workflow validation
|
|
type WorkflowValidationResponse struct {
|
|
Valid bool `json:"valid"`
|
|
Warnings []*WorkflowValidationWarning `json:"warnings,omitempty"`
|
|
RunnerMatch []*RunnerMatch `json:"runner_match,omitempty"`
|
|
}
|