Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix krel stage for using custom k8s refs #2522

Merged
merged 1 commit into from
May 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pkg/anago/stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,10 @@ func (d *DefaultStage) TagRepository() error {
// If we are on master/main we do not create an empty commit,
// but we detach the head at the specified commit to avoid having
// commits merged between the BuildVersion commit and the tag:
if branch != "" && !strings.HasPrefix(branch, "release-") {
detachHead := release.IsDefaultK8sUpstream() &&
branch != "" &&
!strings.HasPrefix(branch, "release-")
if detachHead {
logrus.Infof("Detaching HEAD at commit %s to create tag %s", commit, version)
if err := d.impl.Checkout(repo, commit); err != nil {
return errors.Wrap(err, "checkout release commit")
Expand Down Expand Up @@ -535,7 +538,7 @@ func (d *DefaultStage) TagRepository() error {
// detached HEAD state. So we checkout the branch again.
// The next stage (build) will checkout the branch it needs, but
// let's not end this step with a detached HEAD
if branch != "" && !strings.HasPrefix(branch, "release-") {
if detachHead {
logrus.Infof("Checking out %s to reattach HEAD", d.options.ReleaseBranch)
if err := d.impl.Checkout(repo, d.options.ReleaseBranch); err != nil {
return errors.Wrapf(err, "checking out branch %s", d.options.ReleaseBranch)
Expand Down