@@ -19,21 +19,23 @@ import (
1919
2020// RecordReleaseRequest is the JSON body sent to the registry API.
2121type RecordReleaseRequest struct {
22- Org string `json:"org"`
23- Name string `json:"name"`
24- Version string `json:"version"`
25- RepositoryURL string `json:"repositoryUrl"`
26- CommitSha string `json:"commitSha"`
27- WorkflowRunID string `json:"workflowRunId"`
28- Documentation string `json:"documentation,omitempty"`
29- Changelog string `json:"changelog,omitempty"`
30- ConfigSchema string `json:"configSchema,omitempty"`
31- Capabilities string `json:"capabilities,omitempty"`
32- SignatureURL string `json:"signatureUrl,omitempty"`
33- CertificateURL string `json:"certificateUrl,omitempty"`
34- Assets map [string ]* ReleaseAsset `json:"assets,omitempty"`
35- Images map [string ]* ReleaseImage `json:"images,omitempty"`
36- ReleasedAt string `json:"releasedAt,omitempty"`
22+ Org string `json:"org"`
23+ Name string `json:"name"`
24+ Version string `json:"version"`
25+ RepositoryURL string `json:"repositoryUrl"`
26+ CommitSha string `json:"commitSha"`
27+ WorkflowRunID string `json:"workflowRunId"`
28+ Documentation string `json:"documentation,omitempty"`
29+ Changelog string `json:"changelog,omitempty"`
30+ ConfigSchema string `json:"configSchema,omitempty"`
31+ Capabilities string `json:"capabilities,omitempty"`
32+ SignatureURL string `json:"signatureUrl,omitempty"`
33+ CertificateURL string `json:"certificateUrl,omitempty"`
34+ ManifestURL string `json:"manifestUrl,omitempty"`
35+ SignatureBundleURL string `json:"signatureBundleUrl,omitempty"`
36+ Assets map [string ]* ReleaseAsset `json:"assets,omitempty"`
37+ Images map [string ]* ReleaseImage `json:"images,omitempty"`
38+ ReleasedAt string `json:"releasedAt,omitempty"`
3739}
3840
3941// ReleaseAsset is the transformed asset for the registry API.
@@ -92,6 +94,7 @@ func main() {
9294 changelogPath string
9395 configSchemaPath string
9496 capabilitiesPath string
97+ manifestURL string
9598 token string
9699 )
97100
@@ -107,6 +110,7 @@ func main() {
107110 flag .StringVar (& changelogPath , "changelog" , "" , "Path to a file containing release notes (optional)" )
108111 flag .StringVar (& configSchemaPath , "config-schema" , "" , "Path to config_schema.json file (optional)" )
109112 flag .StringVar (& capabilitiesPath , "capabilities" , "" , "Path to baton_capabilities.json file (optional)" )
113+ flag .StringVar (& manifestURL , "manifest-url" , "" , "Published manifest.json URL (required)" )
110114 var releasedAt string
111115 flag .StringVar (& releasedAt , "released-at" , "" , "Release publish timestamp in RFC 3339 format (optional, defaults to server time)" )
112116 flag .StringVar (& token , "token" , "" , "Bearer token (or set REGISTRY_API_TOKEN env var)" )
@@ -138,6 +142,9 @@ func main() {
138142 if registryURL == "" {
139143 missing = append (missing , "-registry-url" )
140144 }
145+ if manifestURL == "" {
146+ missing = append (missing , "-manifest-url" )
147+ }
141148 if len (missing ) > 0 {
142149 fmt .Fprintf (os .Stderr , "record-release: error: missing required flags: %s\n " , strings .Join (missing , ", " ))
143150 flag .Usage ()
@@ -168,6 +175,10 @@ func main() {
168175 fmt .Fprintf (os .Stderr , "record-release: error: parsing manifest: %v\n " , err )
169176 os .Exit (1 )
170177 }
178+ if manifest .GetSignatureBundleHref () == "" {
179+ fmt .Fprintf (os .Stderr , "record-release: error: manifest missing signatureBundleHref\n " )
180+ os .Exit (1 )
181+ }
171182
172183 // Read optional documentation
173184 var documentation string
@@ -220,21 +231,23 @@ func main() {
220231
221232 // Build request body
222233 req := & RecordReleaseRequest {
223- Org : org ,
224- Name : name ,
225- Version : version ,
226- RepositoryURL : repositoryURL ,
227- CommitSha : commitSha ,
228- WorkflowRunID : workflowRunID ,
229- Documentation : documentation ,
230- Changelog : changelog ,
231- ConfigSchema : configSchema ,
232- Capabilities : capabilities ,
233- SignatureURL : manifest .GetSignatureHref (),
234- CertificateURL : manifest .GetCertificateHref (),
235- Assets : assets ,
236- Images : images ,
237- ReleasedAt : releasedAt ,
234+ Org : org ,
235+ Name : name ,
236+ Version : version ,
237+ RepositoryURL : repositoryURL ,
238+ CommitSha : commitSha ,
239+ WorkflowRunID : workflowRunID ,
240+ Documentation : documentation ,
241+ Changelog : changelog ,
242+ ConfigSchema : configSchema ,
243+ Capabilities : capabilities ,
244+ SignatureURL : manifest .GetSignatureHref (),
245+ CertificateURL : manifest .GetCertificateHref (),
246+ ManifestURL : manifestURL ,
247+ SignatureBundleURL : manifest .GetSignatureBundleHref (),
248+ Assets : assets ,
249+ Images : images ,
250+ ReleasedAt : releasedAt ,
238251 }
239252
240253 bodyBytes , err := json .Marshal (req )
0 commit comments