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

doctr not working with forks #342

Open
kyleniemeyer opened this issue Apr 5, 2019 · 19 comments · May be fixed by #343
Open

doctr not working with forks #342

kyleniemeyer opened this issue Apr 5, 2019 · 19 comments · May be fixed by #343

Comments

@kyleniemeyer
Copy link

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
Copy link
Member

asmeurer commented Apr 5, 2019

It should print one of these messages indicating why it thinks it shouldn't push:

doctr/doctr/travis.py

Lines 571 to 602 in 0f19ff7

def determine_push_rights(*, branch_whitelist, TRAVIS_BRANCH,
TRAVIS_PULL_REQUEST, TRAVIS_TAG, build_tags, fork):
"""Check if Travis is running on ``master`` (or a whitelisted branch) to
determine if we can/should push the docs to the deploy repo
"""
canpush = True
if TRAVIS_TAG:
if not build_tags:
print("The docs are not pushed on tag builds. To push on future tag builds, use --build-tags")
return build_tags
if not any([re.compile(x).match(TRAVIS_BRANCH) for x in branch_whitelist]):
print("The docs are only pushed to gh-pages from master. To allow pushing from "
"a non-master branch, use the --no-require-master flag", file=sys.stderr)
print("This is the {TRAVIS_BRANCH} branch".format(TRAVIS_BRANCH=TRAVIS_BRANCH), file=sys.stderr)
canpush = False
if TRAVIS_PULL_REQUEST != "false":
print("The website and docs are not pushed to gh-pages on pull requests", file=sys.stderr)
canpush = False
if fork:
print("The website and docs are not pushed to gh-pages on fork builds.", file=sys.stderr)
canpush = False
if last_commit_by_doctr():
print(red("The last commit on this branch was pushed by doctr. Not pushing to "
"avoid an infinite build-loop."), file=sys.stderr)
canpush = False
return canpush

@asmeurer
Copy link
Member

asmeurer commented Apr 5, 2019

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
Copy link
Author

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
Copy link
Member

asmeurer commented Apr 5, 2019

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
Copy link
Author

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
Copy link
Member

asmeurer commented Apr 5, 2019

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, #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
Copy link
Member

asmeurer commented Apr 5, 2019

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

@asmeurer
Copy link
Member

asmeurer commented Apr 5, 2019

Fix started at #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
Copy link
Author

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

@asmeurer
Copy link
Member

asmeurer commented Apr 5, 2019

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

@kyleniemeyer
Copy link
Author

kyleniemeyer commented Apr 5, 2019

@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
Copy link
Author

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

@asmeurer
Copy link
Member

asmeurer commented Apr 6, 2019

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
Copy link
Author

kyleniemeyer commented Apr 6, 2019 via email

@banesullivan
Copy link

banesullivan commented May 13, 2019

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
Copy link
Member

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.

@asmeurer asmeurer changed the title Getting "Don't have permission to push. Not trying." message doctr not working with forks May 14, 2019
@banesullivan
Copy link

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
Copy link
Member

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
Copy link
Member

I opened #345 about it.

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

Successfully merging a pull request may close this issue.

3 participants