From b83d94a13c509bdb2f60901c38cbf9bff6c80595 Mon Sep 17 00:00:00 2001 From: "Claude Code (ReARM Agent)" Date: Fri, 5 Jun 2026 01:47:39 +0000 Subject: [PATCH 1/2] feat(addrelease): ship ReARM-native device-identity fields programmatically Adds optional flags to `rearm addrelease` so a release created via addReleaseProgrammatic can carry the Distribution-module device-identity fields (UDI-DI etc.), even on a manual / non-CI release: --rearmidentifiers TYPE:VALUE (repeatable; TYPE in UDI|UDI_DI|UDI_PI) --gudid-record '' --gudid-status NOT_SUBMITTED|SUBMITTED|PUBLISHED --eos --eol Fields are only attached to the request when supplied, so existing usage is unaffected and they no-op against servers that don't yet accept them. Co-Authored-By: Claude Opus 4.7 --- cmd/addRelease.go | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/cmd/addRelease.go b/cmd/addRelease.go index b852363..7893a0d 100644 --- a/cmd/addRelease.go +++ b/cmd/addRelease.go @@ -53,6 +53,13 @@ var ( createComponentName string rebuildRelease bool vcsDisplayName string + + // Distribution module — device-identity fields on a release. + rearmIdentifiers []string + gudidRecord string + gudidStatus string + eos string + eol string ) type Identifier struct { @@ -463,6 +470,41 @@ var addreleaseCmd = &cobra.Command{ body["fsBom"] = RawBomInput{RawBom: ReadBomJsonFromFile(fsBomPath), BomType: "APPLICATION"} } + // Distribution module: ReARM-native device-identity fields. Only sent + // when supplied, so existing usage is unaffected and they no-op against + // older servers that don't yet accept them. + if len(rearmIdentifiers) > 0 { + var ri []Identifier + for _, pair := range rearmIdentifiers { + kv := strings.SplitN(pair, ":", 2) + if len(kv) == 2 { + ri = append(ri, Identifier{IdType: kv[0], IdValue: kv[1]}) + } else { + fmt.Println("Skipping malformed --rearmidentifiers entry (expected TYPE:VALUE): " + pair) + } + } + if len(ri) > 0 { + body["rearmIdentifiers"] = ri + } + } + if len(gudidRecord) > 0 { + var gr map[string]interface{} + if err := json.Unmarshal([]byte(gudidRecord), &gr); err != nil { + fmt.Println("Error parsing --gudid-record JSON: " + err.Error()) + os.Exit(1) + } + body["gudidRecord"] = gr + } + if len(gudidStatus) > 0 { + body["gudidStatus"] = strings.ToUpper(gudidStatus) + } + if len(eos) > 0 { + body["eos"] = eos + } + if len(eol) > 0 { + body["eol"] = eol + } + // `--scearts` artifacts are attached to the source-code entry via // buildCommitMap above (which puts them on // `variables.releaseInputProg.sourceCodeEntry.artifacts`). The @@ -577,5 +619,11 @@ func init() { addreleaseCmd.PersistentFlags().StringVar(&prSourceBranchName, "pr-source-branch-name", "", "(Optional) Source branch name (the branch the PR is being merged from).") addreleaseCmd.PersistentFlags().StringVar(&prTargetBranchName, "pr-target-branch-name", "", "(Optional) Target branch name (the branch the PR is being merged into, e.g. \"main\").") addreleaseCmd.PersistentFlags().StringVar(&prEndpoint, "pr-endpoint", "", "(Optional) URL of the PR in the upstream SCM.") + // Distribution module — device-identity fields shipped via addReleaseProgrammatic. + addreleaseCmd.PersistentFlags().StringArrayVar(&rearmIdentifiers, "rearmidentifiers", []string{}, "(Optional) Release ReARM-native identifiers as Type:Value pairs (multiple allowed). Type is one of UDI, UDI_DI, UDI_PI. E.g. --rearmidentifiers UDI_DI:00366012345678") + addreleaseCmd.PersistentFlags().StringVar(&gudidRecord, "gudid-record", "", "(Optional) GUDID record as a JSON object string, e.g. '{\"brandName\":\"X\",\"versionModel\":\"v1\"}'.") + addreleaseCmd.PersistentFlags().StringVar(&gudidStatus, "gudid-status", "", "(Optional) GUDID submission status: NOT_SUBMITTED | SUBMITTED | PUBLISHED.") + addreleaseCmd.PersistentFlags().StringVar(&eos, "eos", "", "(Optional) End-of-support date (ISO-8601, e.g. 2027-01-31).") + addreleaseCmd.PersistentFlags().StringVar(&eol, "eol", "", "(Optional) End-of-life date (ISO-8601, e.g. 2028-01-31).") rootCmd.AddCommand(addreleaseCmd) } From 492579260adc7cf6897a8819da9e7bb2bd5674b6 Mon Sep 17 00:00:00 2001 From: "Claude Code (ReARM Agent)" Date: Thu, 11 Jun 2026 20:34:41 +0000 Subject: [PATCH 2/2] refactor: rename --rearmidentifiers to --relidentifiers on unified field The backend now carries one identifiers list per release (PURL/CPE/TEI plus UDI/UDI_DI/UDI_PI/SERIAL/LOT), so the flag posts to the unified identifiers key and accepts all types. Co-Authored-By: Claude Opus 4.7 --- cmd/addRelease.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/addRelease.go b/cmd/addRelease.go index 7893a0d..c1d91ee 100644 --- a/cmd/addRelease.go +++ b/cmd/addRelease.go @@ -55,7 +55,7 @@ var ( vcsDisplayName string // Distribution module — device-identity fields on a release. - rearmIdentifiers []string + releaseIdentifiers []string gudidRecord string gudidStatus string eos string @@ -470,21 +470,21 @@ var addreleaseCmd = &cobra.Command{ body["fsBom"] = RawBomInput{RawBom: ReadBomJsonFromFile(fsBomPath), BomType: "APPLICATION"} } - // Distribution module: ReARM-native device-identity fields. Only sent + // Distribution module: release-level identity fields. Only sent // when supplied, so existing usage is unaffected and they no-op against // older servers that don't yet accept them. - if len(rearmIdentifiers) > 0 { + if len(releaseIdentifiers) > 0 { var ri []Identifier - for _, pair := range rearmIdentifiers { + for _, pair := range releaseIdentifiers { kv := strings.SplitN(pair, ":", 2) if len(kv) == 2 { ri = append(ri, Identifier{IdType: kv[0], IdValue: kv[1]}) } else { - fmt.Println("Skipping malformed --rearmidentifiers entry (expected TYPE:VALUE): " + pair) + fmt.Println("Skipping malformed --relidentifiers entry (expected TYPE:VALUE): " + pair) } } if len(ri) > 0 { - body["rearmIdentifiers"] = ri + body["identifiers"] = ri } } if len(gudidRecord) > 0 { @@ -620,7 +620,7 @@ func init() { addreleaseCmd.PersistentFlags().StringVar(&prTargetBranchName, "pr-target-branch-name", "", "(Optional) Target branch name (the branch the PR is being merged into, e.g. \"main\").") addreleaseCmd.PersistentFlags().StringVar(&prEndpoint, "pr-endpoint", "", "(Optional) URL of the PR in the upstream SCM.") // Distribution module — device-identity fields shipped via addReleaseProgrammatic. - addreleaseCmd.PersistentFlags().StringArrayVar(&rearmIdentifiers, "rearmidentifiers", []string{}, "(Optional) Release ReARM-native identifiers as Type:Value pairs (multiple allowed). Type is one of UDI, UDI_DI, UDI_PI. E.g. --rearmidentifiers UDI_DI:00366012345678") + addreleaseCmd.PersistentFlags().StringArrayVar(&releaseIdentifiers, "relidentifiers", []string{}, "(Optional) Release identifiers as Type:Value pairs (multiple allowed). Type is one of PURL, CPE, TEI, UDI, UDI_DI, UDI_PI, SERIAL, LOT. E.g. --relidentifiers UDI_DI:00366012345678") addreleaseCmd.PersistentFlags().StringVar(&gudidRecord, "gudid-record", "", "(Optional) GUDID record as a JSON object string, e.g. '{\"brandName\":\"X\",\"versionModel\":\"v1\"}'.") addreleaseCmd.PersistentFlags().StringVar(&gudidStatus, "gudid-status", "", "(Optional) GUDID submission status: NOT_SUBMITTED | SUBMITTED | PUBLISHED.") addreleaseCmd.PersistentFlags().StringVar(&eos, "eos", "", "(Optional) End-of-support date (ISO-8601, e.g. 2027-01-31).")