mirror of
https://github.com/rancher/types.git
synced 2025-04-27 18:25:05 +00:00
fix namespace_reference mapper on update handler
This commit is contained in:
parent
30c4b554a2
commit
6a993793e3
@ -149,7 +149,7 @@ type PipelineSpec struct {
|
||||
TriggerWebhookTag bool `json:"triggerWebhookTag,omitempty" yaml:"triggerWebhookTag,omitempty"`
|
||||
|
||||
RepositoryURL string `json:"repositoryUrl,omitempty" yaml:"repositoryUrl,omitempty"`
|
||||
SourceCodeCredentialName string `json:"sourceCodeCredentialName,omitempty" yaml:"sourceCodeCredentialName,omitempty" norman:"type=reference[sourceCodeCredential]"`
|
||||
SourceCodeCredentialName string `json:"sourceCodeCredentialName,omitempty" yaml:"sourceCodeCredentialName,omitempty" norman:"type=reference[sourceCodeCredential],noupdate"`
|
||||
}
|
||||
|
||||
type PipelineConfig struct {
|
||||
|
@ -32,13 +32,10 @@ func (n *NamespaceReference) FromInternal(data map[string]interface{}) {
|
||||
|
||||
func (n *NamespaceReference) ToInternal(data map[string]interface{}) error {
|
||||
namespaceID, ok := data["namespaceId"]
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
for _, path := range n.fields {
|
||||
convert.Transform(data, path, func(input interface{}) interface{} {
|
||||
parts := strings.SplitN(convert.ToString(input), ":", 2)
|
||||
if len(parts) == 2 && (parts[0] == namespaceID) {
|
||||
if len(parts) == 2 && (!ok || parts[0] == namespaceID) {
|
||||
return parts[1]
|
||||
}
|
||||
return input
|
||||
|
Loading…
Reference in New Issue
Block a user