-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Detect changed repo_url #1545
Comments
I found a plugin that solves this, but I think this should be core behavior: https://gist.github.com/bluefuton/982691 |
If you prepare a PR with tests for incorporating this behaviour into Capistrano, we'd be glad. Actually Git suffers the same problem sometimes, and it can be very confusing for people. |
Implementing that properly is a bit out of my reach I'm afraid (I'm new to Ruby development). |
Even if we're not building the feature right now, it could be useful to discuss it a little more, for future reference. The Gist you mentioned seems to delete the entire repository checkout if it finds the Maybe a safer solution is for Capistrano to abort with an error message like this:
And then an e.g. |
I'm about to support a customer (this week) who has a similar problem for the first time, I'll see if I can come up with the bones of a sane task to use as a reference for discussing this further |
Possibly consider addressing this as part of the same solution: #1482 (in this case repo_url hasn't changed, but cached credentials have gone stale). |
Ran into some problems, so we nuked the repo - since we "own" |
Although a problem with prompting is if you are running Capistrano in non-interactive settings, like CI… |
Yes, I don't think prompting is needed, no different to purging an old release. |
I wonder what the correct target to compare to should be? I wonder if the output of |
A more generic solution for any SCM could be to compute a hash based on relevant config vars (like repo_url, branch), store it in repo directory, and use it to detect changed configuration. |
That's a decent idea actually, it might mean we could cache the repo in |
Brilliant! I say we give that a shot. |
Good. So if I get chance (Each Tuesday morning, I have time) 2016-02-26 I'll take a punt at this, and we can maybe put a PR on here too. |
If I understand you correctly, you want to use the hash to create subdirectories within repo and put the checkout/clone there. Wouldn't this make it a bit less transparent to the user ("which repo subdirectory is capistrano currently using?", and maybe harder for backward compatiblity? (for example, plugins depending on a fixed repo directory). Just using the hash to purge the repo directory when changed, should also be enough, and easier to implement. :) |
True.
Yes, I think you are probably right. |
I would like to add, that sometimes you have change the repo url, but it is just another clone of the same repo (like you point to a fork instead of main repo on github). In this case it would be nice to add the new repository as a remote to an existing repository instead of rm -rf && git clone, because it would be notably speed up deployment of large applications. |
We've recently migrated our repository, changed the |
@mingan: It would probably be a good idea to at least have a note for the time being in the file you referenced, probably in the Thanks! |
FYI, this issue has been fixed for git (but not other SCMs) in Capistrano 3.7.2. See #1826. |
It seems this issue is now also fixed for svn? 8cbe893 |
@marcovtwout-tremani Yes, it should be fixed for svn in capistrano 3.8.0. I'll close the issue. |
Using svn, when I change the repo_url, the clone on the server is not changed and the old version remains.
The solution is simple: when the repo_url changes, I expect the repo clone to be deleted and checked out again.
The text was updated successfully, but these errors were encountered: