From 7548bfb595d853c682653c0dc21bb3bf17af80d5 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Sun, 12 Apr 2026 21:17:24 -0500 Subject: feat: add build artifact listing Implements: https://todo.sr.ht/~ccleberg/hutch/31 --- Hutch/Models/Builds.swift | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'Hutch/Models') diff --git a/Hutch/Models/Builds.swift b/Hutch/Models/Builds.swift index 8de4235..d666398 100644 --- a/Hutch/Models/Builds.swift +++ b/Hutch/Models/Builds.swift @@ -122,10 +122,29 @@ struct JobDetail: Codable, Sendable, Equatable { let image: String? let manifest: String? var tasks: [BuildTask] + let artifacts: [BuildArtifact] let log: BuildLog? let owner: Entity } +/// A downloadable artifact emitted by a build job. +struct BuildArtifact: Codable, Sendable, Identifiable, Equatable { + let id: Int + let created: Date + let path: String + let size: Int + let url: URL? + + var filename: String { + let pathComponents = path.split(separator: "/") + return pathComponents.last.map(String.init) ?? path + } + + var isDownloadable: Bool { + url != nil + } +} + /// The log associated with a build job. struct BuildLog: Codable, Sendable, Equatable { let fullURL: String -- cgit v1.2.3