What if the user had GitLab 7.10 on server A and GitLab CI 7.10 on server B. How does a preinstall script that runs on server A detect that there was a GitLab CI server somewhere else?
Keep in mind that if the user upgrades from GitLab 7.10 to GitLab 8.5 (making up 8.5, it does not exist yet) they may end up with their GitLab DB in a state where they can no longer import CI data, and also no way to roll back. They may only find out a day later, when trying to upgrade their GitLab CI server, that they need to migrate their CI data.
@sytses perhaps, but my gut feeling is it would be expensive (loading the Rails app) and fragile (we cannot count on the database being available when the apt/rpm preinstall script runs).
To be frank, saying 'in 8.0 we allow ourselves to really break things' and '8.0 should be an upgrade you can skip over' feels like having your cake and eating it too.
@jacobvosmaer it might be expensive but I assume we only have run this migration (check for pre 8.0 CI and abort if detected) in GitLab 8.1. Let's see if we can make it robust.
@marin@dzaporozhets any idea's for a robust check if GitLab 7.x and earlier was using CI somewhere? Maybe using a database migration that borks if it finds a GitLab CI hooks configured for any project?
@sytses no I am talking about a check that will run in all future GitLab packages. People may be on 7.14 now and for whatever reason not decide to upgrade until one year from now. This is something we see with customers in corporate environments. That is why I am proposing a simple mechanism: if you upgrade from 7.x to 8.x or higher, you must touch 8.0. If you are upgrading from 7.x to 9.x or higher, you must touch 8.0 and 9.0. Etc.
We detect if the user is upgrading from a package prior to 8.x
We print a message: "Detected upgrading from version < 8.x. If you have GitLab CI you must upgrade to 8.0 first. Do you have GitLab CI configured? [YES/NO] "
User writes YES, we abort and print a message about having to upgrade to 8.0
User writes NO, we continue
Something to that extent, we can fine tune the messages.
@jnijhof , as someone with Debian packaging experience, what do you make of the solutions we are proposing here? To recap, the problem is that the CI migration only works on 8.0 and we want to avoid people getting stuck on a higher-than-8.0 GitLab version while upgrading and losing their CI data.
@sytses interesting idea, a well-placed migration in 8.1 could probably catch it. I am not sure how 'rake db:migrate' does rollbacks, we should probably make sure it fails as early as possible.
It is not 100% clear to me though how to do it with a migration. It would allows us to see if CI is enabled or not. But what we want to prevent is going from 7.x or older to 8.1 or higher. How does the migration see we are coming from 7.x or older?
How does the migration see we are coming from 7.x or older?
@jacobvosmaer database store list of migrations that already completed. If we don't have one of 8.0 migrations in this list - it means we are updating from 7.x
Concluded to put a warning for CI users to first upgrade to 8.0 in the next few release announcements. We don't want to inconvenience the great majority of people that are not using CI. Also, build information is pretty fungible, not a huge problem to start over.