コード例 #1
0
func NewInmemRegistryService() common.RegistryService {
	rs := &inmemRegistryService{
		registries: make(map[string]*common.Registry),
	}

	pFormat := fmt.Sprintf("%s;%s", common.UnversionedRegistry, common.OneLevelRegistry)
	rs.Create(&common.Registry{
		Name:           "charts",
		Type:           common.GithubRegistryType,
		URL:            "github.com/helm/charts",
		Format:         common.RegistryFormat(pFormat),
		CredentialName: "default",
	})

	tFormat := fmt.Sprintf("%s;%s", common.VersionedRegistry, common.CollectionRegistry)
	rs.Create(&common.Registry{
		Name:           "application-dm-templates",
		Type:           common.GithubRegistryType,
		URL:            "github.com/kubernetes/application-dm-templates",
		Format:         common.RegistryFormat(tFormat),
		CredentialName: "default",
	})

	return rs
}
コード例 #2
0
// ParseRegistryFormat creates a map from a registry format string.
func ParseRegistryFormat(rf common.RegistryFormat) map[common.RegistryFormat]bool {
	split := strings.Split(string(rf), ";")
	var result = map[common.RegistryFormat]bool{}
	for _, format := range split {
		result[common.RegistryFormat(format)] = true
	}

	return result
}
コード例 #3
0
ファイル: dm.go プロジェクト: jtblin/deployment-manager
func newRegistry(URL string) *common.Registry {
	tFormat := fmt.Sprintf("%s;%s", common.VersionedRegistry, common.CollectionRegistry)
	return &common.Registry{
		Name:           util.TrimURLScheme(URL),
		Type:           common.GithubRegistryType,
		URL:            URL,
		Format:         common.RegistryFormat(tFormat),
		CredentialName: "default",
	}
}
コード例 #4
0
// NewGithubTemplateRegistry creates a GithubTemplateRegistry.
func NewGithubTemplateRegistry(name, shortURL string, service GithubRepositoryService, client *github.Client) (*GithubTemplateRegistry, error) {
	format := fmt.Sprintf("%s;%s", common.VersionedRegistry, common.CollectionRegistry)
	if service == nil {
		service = client.Repositories
	}

	gr, err := newGithubRegistry(name, shortURL, common.RegistryFormat(format), service)
	if err != nil {
		return nil, err
	}

	return &GithubTemplateRegistry{githubRegistry: *gr}, nil
}
コード例 #5
0
// NewGithubPackageRegistry creates a GithubPackageRegistry.
func NewGithubPackageRegistry(name, shortURL string, service GithubRepositoryService, httpClient *http.Client, client *github.Client) (*GithubPackageRegistry, error) {
	format := fmt.Sprintf("%s;%s", common.UnversionedRegistry, common.OneLevelRegistry)
	if service == nil {
		if client == nil {
			service = github.NewClient(nil).Repositories
		} else {
			service = client.Repositories
		}
	}

	gr, err := newGithubRegistry(name, shortURL, common.RegistryFormat(format), httpClient, service)
	if err != nil {
		return nil, err
	}

	return &GithubPackageRegistry{githubRegistry: *gr}, nil
}