allow to define remote branches as recipe source
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
04aec8232f
commit
161f2127d6
@ -95,6 +95,7 @@ func (r Recipe) GetVersionLabelLocal() (string, error) {
|
|||||||
|
|
||||||
for _, service := range config.Services {
|
for _, service := range config.Services {
|
||||||
for label, value := range service.Deploy.Labels {
|
for label, value := range service.Deploy.Labels {
|
||||||
|
log.Debugf("checking deploy label '%s'", label)
|
||||||
if strings.HasPrefix(label, "coop-cloud") && strings.Contains(label, "version") {
|
if strings.HasPrefix(label, "coop-cloud") && strings.Contains(label, "version") {
|
||||||
return value, nil
|
return value, nil
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,7 @@ func (r Recipe) EnsureExists() error {
|
|||||||
// EnsureVersion checks whether a specific version exists for a recipe.
|
// EnsureVersion checks whether a specific version exists for a recipe.
|
||||||
func (r Recipe) EnsureVersion(version string) (bool, error) {
|
func (r Recipe) EnsureVersion(version string) (bool, error) {
|
||||||
isChaosCommit := false
|
isChaosCommit := false
|
||||||
|
log.Debugf("Ensuring version '%s'", version)
|
||||||
|
|
||||||
if err := gitPkg.EnsureGitRepo(r.Dir); err != nil {
|
if err := gitPkg.EnsureGitRepo(r.Dir); err != nil {
|
||||||
return isChaosCommit, err
|
return isChaosCommit, err
|
||||||
@ -78,7 +79,7 @@ func (r Recipe) EnsureVersion(version string) (bool, error) {
|
|||||||
return isChaosCommit, err
|
return isChaosCommit, err
|
||||||
}
|
}
|
||||||
|
|
||||||
tags, err := repo.Tags()
|
tags, err := repo.References()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return isChaosCommit, err
|
return isChaosCommit, err
|
||||||
}
|
}
|
||||||
@ -117,11 +118,11 @@ func (r Recipe) EnsureVersion(version string) (bool, error) {
|
|||||||
|
|
||||||
worktree, err := repo.Worktree()
|
worktree, err := repo.Worktree()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return isChaosCommit, nil
|
return isChaosCommit, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := worktree.Checkout(opts); err != nil {
|
if err := worktree.Checkout(opts); err != nil {
|
||||||
return isChaosCommit, nil
|
return isChaosCommit, err
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("successfully checked %s out to %s in %s", r.Name, tagRef.Short(), r.Dir)
|
log.Debugf("successfully checked %s out to %s in %s", r.Name, tagRef.Short(), r.Dir)
|
||||||
@ -216,7 +217,7 @@ func (r Recipe) EnsureUpToDate() error {
|
|||||||
opts := &git.PullOptions{
|
opts := &git.PullOptions{
|
||||||
Force: true,
|
Force: true,
|
||||||
ReferenceName: branch,
|
ReferenceName: branch,
|
||||||
SingleBranch: true,
|
SingleBranch: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := worktree.Pull(opts); err != nil {
|
if err := worktree.Pull(opts); err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user