2023-07-20 09:26:25 +00:00
|
|
|
package providers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2023-08-02 15:00:34 +00:00
|
|
|
"git.badhouseplants.net/allanger/shoebill/internal/utils/diff"
|
|
|
|
"git.badhouseplants.net/allanger/shoebill/internal/utils/githelper"
|
2023-10-20 11:31:30 +00:00
|
|
|
"git.badhouseplants.net/allanger/shoebill/pkg/lockfile"
|
2023-07-20 09:26:25 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Provider interface {
|
2023-10-20 11:31:30 +00:00
|
|
|
SyncState(diff.ReleasesDiffs, diff.RepositoriesDiffs) (lockfile.HashesPerReleases, error)
|
2023-07-20 09:26:25 +00:00
|
|
|
}
|
|
|
|
|
2023-10-11 12:14:20 +00:00
|
|
|
func NewProvider(provider, path, sopsBin string, gh githelper.Githelper) (Provider, error) {
|
2023-07-20 09:26:25 +00:00
|
|
|
switch provider {
|
|
|
|
case "flux":
|
2023-10-11 12:14:20 +00:00
|
|
|
return FluxProvider(path, sopsBin, gh), nil
|
2023-07-20 09:26:25 +00:00
|
|
|
default:
|
|
|
|
return nil, fmt.Errorf("provider is not supported: %s", provider)
|
|
|
|
}
|
|
|
|
}
|