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

STYLE: Update CONTRIBUTING.md to test slicer/apidocs webhook #690

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jcfr
Copy link
Member

@jcfr jcfr commented Mar 25, 2017

This PR is indented to test that the slicer API docs builder is effectively triggered.

@jcfr
Copy link
Member Author

jcfr commented Mar 25, 2017

Et voila !

It works, the following set of documentation are now automatically generated and published:

Note that each time a patch release is done (e.g v4.6.3), documentation is pushed to the v4.6 and overwrite the previous one. (If needed, this could easily be changed)

infrastructure

Now, few words about the infrastructure enabling this:

  • Slicer/slicer-apidocs-builder: A pip installable package able to checkout a specific Slicer version, build corresponding doxygen documentation and then publish it as a subfolder on a particular branch of a project (e.g see directories associated with Slicer/apidocs.slicer.org@gh-pages). Last, it also allows to update the GitHub status state and description associated with of a given commit. This is the slicer/apidocs check you can see above !

  • Slicer/apidocs.slicer.org: This is the project allowing to publish the documentation to the gh-pages branch. The associated CircleCI configuration uses slicer-apidocs-builder to build&publish a given version of the documentation (based on environment variables and also update the GitHub status for the corresponding commit.

  • Slicer/github-circleci-trigger: This one is the "glue" making the magic happen. It is basically a flask application deployable on https://heroku.com. It implements the webhook https://github-circleci-trigger.herokuapp.com/postreceive that is associated with Slicer/Slicer project and trigger the CircleCI build associated with Slicer/apidocs.slicer.org project. The new build is parametrized with SLICER_REPO_NAME, SLICER_REPO_BRANCH, SLICER_REPO_TAG and SLICER_REPO_REVISION.

What is nice about heroku is that they provide a free "dyno" instance (512 MB RAM │ 1 web/1 worker) along with a pool of 1000 hours per account. The instance falls asleep after 30mins and is wake up fairly quickly. More than enough for implementing a simple webhook !

why a dedicated webhook ?

We could have added/updated a travis/circleci/appveyor config directly within the Slicer project to build and publish the documentation but ...

... since we want the documentation to also be published for pull request and we do not want outside random developers to discover our secrets (aka GitHub token) that we would be using to publish the documentation, having a dedicated webhook allow to both nicely decouple things and leverage additional CircleCI workers.

Notes:

next

Here is a list of todos:

  • webhook
    • rename webhook server from https://github-circleci-trigger.herokuapp.com/postreceive to https://slicer-webhooks.herokuapp.com/postreceive (or https://slicer-apidocs-webhooks.herokuapp.com/postreceive). Note that having a more general project github-circleci-trigger on GitHub still makes sense but the specific instance of the server is specific to Slicer ....and should be named accordingly
    • add an endpoint accessible from outside world that is showing the properties of the server ...
    • add an endpoint allowing to get the status of the apidocs documentation for given branch, tag, ... it could be used for a badge
  • website
  • manual trigger
  • In order to trigger build and publication of the previous release, the github-circleci-trigger project should be usable as CLI to trigger bulds.

Note also that since the whole system has been put together in only few days, I definitively expect some hiccup.

screenshots

webhook in action

slicer-apidocs-triggered-for-pr

slicer-apidocs-success

webhook configuration

slicer-add-webhooks-1
slicer-add-webhooks-2

@ihnorton
Copy link
Member

ihnorton commented Mar 27, 2017

The Doxygen publication Python script is great. I think the PR integration is "nice-to-have" but I wonder if it is worth the extra complication of hooks/Heroku/CircleCI/etc.

Please consider whether this will be maintainable by community members. I'm not sure how Heroku and CircleCI permissions work, but I think we need to aim for several people having enough permissions to implement fixes independently. We can all figure this stuff out, but that is less likely to happen if we must also chase access to several different systems in order to even start debugging. (which is the case for the current API doc builder, as well as the nightly factory and other infrastructure)

@lassoan
Copy link
Contributor

lassoan commented Mar 27, 2017

I agree, simpler is better and it would be important for all core developers to be able to access the infrastructure and troubleshoot problems. If external access to Kitware computers is difficult then we can set up documentation builds on perklab-factory and give remote access to all core developers.

@jcfr
Copy link
Member Author

jcfr commented Mar 27, 2017

Thanks for the feedback.

Just to refocus the discussion, in this case, building the doxygen per se was never the issue.

The problem was:

  • on the deployment side where the script (in charge of downloading the built documentation and installing it on the Slicer webserver) wasn't updated when the infrastructure transitioned to digital ocean for hosting wiki et al. More details here.
  • we didn't have monitoring in place to report there was a problem

After talking with @pieper and @mhalle, updating digital ocean to serve the page is not feasible. For that reason, we looked into github pages.

The solution discussed in this PR is intended to:

  • give clear feedback when the documentation is being generated, failed to build or is deployed. Thanks to the slicer/apidocs context
  • streamline the release process removing manual steps (before we didn't even bother having API documentation for a previous version of Slicer ...)
  • allow the community to maintain, debug and improve the infrastructure
  • leverage existing free resources available for open source project. No "who's credit card" dilemma.

Access to account by the community:

  • management of the heroku can be shared

  • management of the slicerbot GitHub user will be shared by associated the usermail with a private mailing list. That way, any one could reset the password if needs to be.

@jcfr jcfr added wip and removed wip labels Feb 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 participants