36 Star 414 Fork 76

GVPrancher/rancher

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
sync.go 1.05 KB
一键复制 编辑 原始数据 按行查看 历史
Daishan Peng 提交于 7年前 . more helm improvements
package manager
import (
"github.com/pkg/errors"
"github.com/rancher/types/apis/management.cattle.io/v3"
"github.com/sirupsen/logrus"
)
func (m *Manager) Sync(key string, catalog *v3.Catalog) error {
// if catalog was deleted, do nothing
if catalog == nil || catalog.DeletionTimestamp != nil {
return nil
}
catalogCopy := catalog.DeepCopy()
repoPath, commit, catalogType, err := m.prepareRepoPath(*catalogCopy, true)
if commit == catalogCopy.Status.Commit {
logrus.Debugf("Catalog %s is already up to date", catalog.Name)
return nil
}
catalogCopy.Status.Commit = commit
templates, errs, err := traverseFiles(repoPath, catalogCopy, catalogType)
if err != nil {
return errors.Wrap(err, "Repo traversal failed")
}
if len(errs) != 0 {
logrus.Errorf("Errors while parsing repo: %v", errs)
}
logrus.Infof("Updating catalog %s", catalog.Name)
// since helm catalog is purely additive, we add update only flag
updateOnly := false
if catalogType == CatalogTypeHelmObjectRepo {
updateOnly = true
}
return m.update(catalogCopy, templates, updateOnly)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/rancher/rancher.git
git@gitee.com:rancher/rancher.git
rancher
rancher
rancher
v2.0.0-alpha16

搜索帮助