Skip to content

Commit

Permalink
targets: Handle OrigUri and OrigUriApps when adding targets
Browse files Browse the repository at this point in the history
For custom apps targets, origUri must be set, while uri and origUriApps
must be empty.
For custom ostree targets, origUriApps must be set, while uri and
origUri must be empty.

Signed-off-by: Andre Detsch <andre.detsch@foundries.io>
  • Loading branch information
detsch committed Nov 14, 2024
1 parent 8f5d958 commit ba0553b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions subcommands/targets/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ func createAppTargets(factory string, tags []string, srcTag string, appUris []st
return deriveTargets(factory, nil, srcTag, func(target *client.Target) error {
target.Custom.Tags = tags
target.Custom.ComposeApps = newTargetApps
if target.Custom.OrigUri == "" {
target.Custom.OrigUri = target.Custom.Uri
}
target.Custom.Uri = ""
target.Custom.OrigUriApps = ""

Check failure on line 114 in subcommands/targets/add.go

View workflow job for this annotation

GitHub Actions / golangci-lint

target.Custom.OrigUriApps undefined (type *client.TufCustom has no field or method OrigUriApps)

Check failure on line 114 in subcommands/targets/add.go

View workflow job for this annotation

GitHub Actions / golangci-lint

target.Custom.OrigUriApps undefined (type *client.TufCustom has no field or method OrigUriApps)

Check failure on line 114 in subcommands/targets/add.go

View workflow job for this annotation

GitHub Actions / Build Binaries

target.Custom.OrigUriApps undefined (type *client.TufCustom has no field or method OrigUriApps)
return nil
})
}
Expand Down Expand Up @@ -134,6 +139,11 @@ func createOstreeTarget(factory string, tags []string, srcTag string, hwIdToHash
return deriveTargets(factory, hwIdToHash, srcTag, func(target *client.Target) error {
target.Custom.Tags = tags
err := target.SetHash(hwIdToHash[target.HardwareId()].(string))
if target.Custom.OrigUriApps == "" {

Check failure on line 142 in subcommands/targets/add.go

View workflow job for this annotation

GitHub Actions / golangci-lint

target.Custom.OrigUriApps undefined (type *client.TufCustom has no field or method OrigUriApps)

Check failure on line 142 in subcommands/targets/add.go

View workflow job for this annotation

GitHub Actions / golangci-lint

target.Custom.OrigUriApps undefined (type *client.TufCustom has no field or method OrigUriApps)

Check failure on line 142 in subcommands/targets/add.go

View workflow job for this annotation

GitHub Actions / Build Binaries

target.Custom.OrigUriApps undefined (type *client.TufCustom has no field or method OrigUriApps)
target.Custom.OrigUriApps = target.Custom.Uri

Check failure on line 143 in subcommands/targets/add.go

View workflow job for this annotation

GitHub Actions / golangci-lint

target.Custom.OrigUriApps undefined (type *client.TufCustom has no field or method OrigUriApps) (typecheck)

Check failure on line 143 in subcommands/targets/add.go

View workflow job for this annotation

GitHub Actions / golangci-lint

target.Custom.OrigUriApps undefined (type *client.TufCustom has no field or method OrigUriApps)) (typecheck)

Check failure on line 143 in subcommands/targets/add.go

View workflow job for this annotation

GitHub Actions / Build Binaries

target.Custom.OrigUriApps undefined (type *client.TufCustom has no field or method OrigUriApps)
}
target.Custom.Uri = ""
target.Custom.OrigUri = ""
return err
})
}
Expand Down

0 comments on commit ba0553b

Please sign in to comment.