mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
feat(oci): oci helm support [r8s-361] (#787)
This commit is contained in:
parent
b6a6ce9aaf
commit
2697d6c5d7
80 changed files with 4264 additions and 812 deletions
|
@ -62,3 +62,26 @@ func GetRegEffectiveCredential(registry *portainer.Registry) (username, password
|
|||
|
||||
return
|
||||
}
|
||||
|
||||
// PrepareRegistryCredentials consolidates the common pattern of ensuring valid ECR token
|
||||
// and setting effective credentials on the registry when authentication is enabled.
|
||||
// This function modifies the registry in-place by setting Username and Password to the effective values.
|
||||
func PrepareRegistryCredentials(tx dataservices.DataStoreTx, registry *portainer.Registry) error {
|
||||
if !registry.Authentication {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := EnsureRegTokenValid(tx, registry); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
username, password, err := GetRegEffectiveCredential(registry)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
registry.Username = username
|
||||
registry.Password = password
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue