drdoctr / doctr

A tool for automatically deploying docs from Travis CI to GitHub pages.
https://drdoctr.github.io
MIT License
107 stars 30 forks source link

doctr not working with forks #342

Open kyleniemeyer opened 5 years ago

kyleniemeyer commented 5 years ago

Although I haven't changed anything except to add some new files, I'm now getting a Don't have permission to push. Not trying. message in Travis, which seems to prevent pushing the generated files back to the repo for GitHub Pages to pick up.

Looking at a recent successful build, it looks like that time it did a git pull then git push, neither of which is happening now.

Any ideas?

asmeurer commented 5 years ago

It should print one of these messages indicating why it thinks it shouldn't push: https://github.com/drdoctr/doctr/blob/0f19ff78c8239efcc98d417f36b0a31d9be01ba5/doctr/travis.py#L571-L602

asmeurer commented 5 years ago

The exception is if you are using --no-push or have doctr: push: false in your .travis.yml. It won't print a message indicating why in that case.

kyleniemeyer commented 5 years ago

OK, I see The website and docs are not pushed to gh-pages on fork builds... what does this mean, and why would this be an issue now? (Was this added in a newer version of doctr or something?)

My repo is a fork, but that's because I forked my website template from elsewhere a while ago. How can I override this?

asmeurer commented 5 years ago

That's curious if it used to work on the same repo.

Travis doesn't allow secure environment variables on builds from forked repos (unless things have changed). You may need to delete the repo and recreate it as a non-forked repo.

But again that's curious if it used to work. If that's the case we should figure out what is going on.

kyleniemeyer commented 5 years ago

Yeah, it used to work fine, and I haven't changed anything. I hadn't made any changes in a few weeks, that's all.

asmeurer commented 5 years ago

OK, I'm guessing the last build was before the most recent release of doctr. The change to not push on forks was new https://drdoctr.github.io/changelog.html, https://github.com/drdoctr/doctr/pull/332. I guess the logic isn't correct, or maybe Travis changed something. I had thought secure environment variables didn't work at all on forks, but I guess that isn't the case. Maybe we should only not push on a fork if the environment variable isn't there.

asmeurer commented 5 years ago

If you need a workaround you can manually install doctr 1.7.4.

asmeurer commented 5 years ago

Fix started at https://github.com/drdoctr/doctr/pull/343. I still need to fix the tests and do some manual testing. If you can check if that branch works on your repo that would help.

kyleniemeyer commented 5 years ago

Can I get Travis to use that one somehow, or should I just try locally?

asmeurer commented 5 years ago

It won't work locally. You can install it on Travis using pip install git+git://github.com/drdoctr/doctr@forks.

kyleniemeyer commented 5 years ago

@asmeurer thanks—I actually figured that out after commenting here... build is in progress.

So, I tried using that fork, but what's happening is weird... I see this message The last commit on this branch was pushed by doctr. Not pushing to avoid an infinite build-loop., even after pushing a few content changes.

The full log is at https://gist.github.com/kyleniemeyer/0da4ea0d3f175c7401ca9f5f53a4dd31

kyleniemeyer commented 5 years ago

Though it does look like it's successfully pushing the generated content. No idea.

asmeurer commented 5 years ago

That happens if you run Travis on the GitHub pages branch itself (gh-pages for most repos, master for *.github.io repos). That's because doctr pushes up to that branch, so otherwise it would get caught in an infinite build loop.

kyleniemeyer commented 5 years ago

I didn’t think I was- I use the “source” branch for the source files. But maybe I don’t have it configured completely right.

On Apr 5, 2019, at 5:33 PM, Aaron Meurer notifications@github.com wrote:

That happens if you run Travis on the GitHub pages branch itself (gh-pages for most repos, master for *.github.io repos). That's because doctr pushes up to that branch, so otherwise it would get caught in an infinite build loop.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

banesullivan commented 5 years ago

Is this close to being resolved? I've been using doctr for a number of my open-source projects and I love it!

I have a side project that uses several open-source projects I develop and thought it'd be cool to showcase the project in a sphinx-gallery. I set up the docs to build and they were deploying from Travis via doctr but then I filled out the rest of the project and it requires more resources than Travis can provide (13 GB of ram at least and preferably a GPU) - I was thinking that I'd manually build and deploy the docs from my local machine since I won't edit the project moving forward but I'm getting this issue when I run:

doctr deploy --force --built-docs ./docs/_build/html .
......

[__doctr_working_branch 545c548] Update docs after building Travis build <unknown> of GeothermalDesignChallenge
 30 files changed, 246 insertions(+), 61 deletions(-)
 create mode 100644 .doctr-files
Don't have permission to push. Not trying.
git checkout 33cdb9ab37bb7801d3873a4fb87011cb5bda901b
Note: checking out '33cdb9ab37bb7801d3873a4fb87011cb5bda901b'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 33cdb9a Revert to xenial distribution
git stash pop
Already up to date!
HEAD detached at 33cdb9a
nothing to commit, working tree clean
Dropped refs/stash@{0} (0bb8899dbb2347db767d67e3b423bacd291cbf45)

The project is: https://github.com/OpenGeoVis/GeothermalDesignChallenge

asmeurer commented 5 years ago

I do intend to fix this issue. It requires some manual testing to get any fix like this, which is why I've been a bit slow. I'll try to get to it this week.

However, this sounds like a separate issue from what you are having. doctr was never designed to be run locally. We could probably make it work, but it would require some changes.

banesullivan commented 5 years ago

However, this sounds like a separate issue from what you are having. doctr was never designed to be run locally. We could probably make it work, but it would require some changes.

How big of changes?

asmeurer commented 5 years ago

I've honestly never thought of doing it, so I'm not sure. I'd have to take a look to see. Feel free to open an issue for it.

asmeurer commented 5 years ago

I opened https://github.com/drdoctr/doctr/issues/345 about it.