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

replacing build configuration causes "An error occurred while starting the build. Reason: builds.build.openshift.io "php-2" already exists " #16177

Closed
djdevin opened this issue Sep 6, 2017 · 5 comments

Comments

@djdevin
Copy link

djdevin commented Sep 6, 2017

If replacing a build configuration through oc replace, the next build will fail because the "lastVersion" is set to 1 in the build configuration.

Version

oc v3.6.0+c4dd4cf
kubernetes v1.6.1+5115d708d7
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://xyz:8443
openshift v3.6.0+c4dd4cf
kubernetes v1.6.1+5115d708d7

Steps To Reproduce
  1. Create a build configuration (anything will do)
  2. Build a few times - get to build 5 for example
  3. Export, delete, and re-import the build configuration.
  4. Try to start a new build
Current Result

An error occurred while starting the build. Reason: builds.build.openshift.io "php-2" already exists

Expected Result

Build is started.

Additional Information

This is happening because the old builds exist. You can get it to build by clicking "Build" a bunch of times.

Sub-issue: I noticed that through the UI, if you try and delete the build configuration it says "This will delete the build config and all build history. It cannot be undone. Make sure this is something you really want to do!" But, it doesn't actually delete the build history. You can still see it through the UI and also CLI.

The CLI does have a suggestion here, and says "error: builds.build.openshift.io "php-4" already exists. Retry building BuildConfig "php" or delete the conflicting builds."

Now I suppose I can run oc delete builds --all to fix it, but I'd also expect one of these to happen:

  1. Creating/replacing a build configuration when builds already exist should increment the latestVersion
  2. Replacing/deleting the build configuration should, as the warning says, delete all existing builds.
@bparees
Copy link
Contributor

bparees commented Sep 11, 2017

This is working as designed. You must either delete the old builds, or set the lastVersion value in your BC that you're using to replace things, to a higher value than the highest existing build.

Agree that the UI warning is incorrect, though. I'm not sure what CLI warning you're referring to, though. oc delete bc foo deletes the bc+builds, and if you don't want the builds to be deleted, you specify --cascade=false. (cascade is on by default). I don't see any warning.

Over to @spadgett to address the UI warning.

@bparees bparees assigned spadgett and unassigned bparees Sep 11, 2017
@spadgett
Copy link
Member

@bparees My opinion: it would be better fix garbage collection so it deletes all old builds. Right now it deletes any created after 3.6, but not anything older. It's not a good user experience no matter what message we add to that dialog.

@spadgett
Copy link
Member

I opened openshift/origin-web-console#2052 to remove the incorrect warning from the delete build config dialog.

@djdevin
Copy link
Author

djdevin commented Sep 13, 2017

sounds good, thanks

@bparees the CLI warning comes from oc start-build

return fmt.Errorf("%s. Retry building BuildConfig \"%s\" or delete the conflicting builds.", err.Error(), buildConfigName)

@bparees
Copy link
Contributor

bparees commented Sep 13, 2017

@bparees the CLI warning comes from oc start-build

ok that warning is appropriate.. I read your statement of:

if you try and delete the build configuration it says "This will delete the build config and all build history. It cannot be undone. Make sure this is something you really want to do!" But, it doesn't actually delete the build history. You can still see it through the UI and also CLI.

as saying that the message was seen in the CLI. I see now you meant that you can see the build history (old builds) in the CLI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants