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

GitHub Enterprise Support #23

Closed
wants to merge 8 commits into from
Closed

GitHub Enterprise Support #23

wants to merge 8 commits into from

Conversation

floatdrop
Copy link

This pull request allows specify custom GitHub host for enterprise support.

Roadmap:

  • Introduce domain and api urls in settings (make sure you are using patched version of go-github)
  • Create fields in account/admin/settings page
  • Make it link account to enterprise github
  • Fixed webhook url
  • Fixed redirect from github_add page
  • Check if it listens to webhook
  • Fixup build (do not symlink /tmp directory anywhere)
  • Fixup commit status in github
  • Testing in development (due 15.02)

@floatdrop
Copy link
Author

Seems like our github can't send post request to drone host, but curl can (may be network access problems). I triggered this build by long curl bash line:

screen shot 2014-02-09 at 11 41 59 pm

However no output was shown in browser. In /var/log/upstart/drone.log I got this:

creating build image
Pulling repository bradrydzewski/node

copying repository to /var/cache/drone/src/github.yandex-team.ru/floatdrop/drone-test
removing build image
failed to completely delete build image . Not Found
2014/02/09 17:38:48 dial tcp :0: connection refused

My .drone.yml:

image: mischief/docker-golang
env:
  - GOROOT=/usr/local/go
  - GOPATH=/var/cache/drone
  - PATH=$GOPATH/bin:$GOPATH/bin:$PATH
script:
  - apt-get -y install libsqlite3-dev sqlite3 mercurial bzr 1> /dev/null 2> /dev/null

@bradrydzewski
Copy link

awesome work on the patch so far!

it says it is trying to download "bradrydzewski/node" as the image, in your output. I'm wondering if Docker failed to download the image from the index? "bradrydzewski/node" is built on "bradrydzewski/base" which is ~3GB. I've had a lot of problems with the index dropping my connection and failing to complete the download.

regarding the build hook triggering from GitHub. can you check if the hook was successfully added to your repository?

@floatdrop
Copy link
Author

Yes, hook is added and pointing to the right repository (I hope): http:https://drone.i.fog.yandex.net/hook/github.com?id=github.yandex-team.ru/floatdrop/drone-test.

I tested also docker image from example but results are same:

Pulling repository mischief/docker-golang
copying repository to /var/cache/drone/src/github.yandex-team.ru/floatdrop/drone-test
removing build image
failed to completely delete build image . Not Found

@mehulkar
Copy link

mehulkar commented Feb 9, 2014

👍 👍 👍 👍 👍 👍

The sooner I get rid of Jenkins, the happier I will be.

@bradrydzewski
Copy link

ok, for time being, let's print the docker build command's output to the console to help debug this. just pushed this change: https://github.com/drone/drone/blob/master/pkg/build/docker/image.go#L123

@siliconcow
Copy link

👍 Another enterprise user that is interested in drone.

@@ -70,9 +70,9 @@ func (r *Repo) IsGit() bool {
return true
case strings.HasPrefix(r.Path, "ssh:https://git@"):
return true
case strings.HasPrefix(r.Path, "https://github.com/"):
case strings.HasPrefix(r.Path, "https://github"):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if perhaps we don't need this particular branch in the validation?

Seems like case strings.HasSuffix(r.Path, ".git") should be enough while https://github.com/ might be a bit superfluous since I don't believe there is any restriction on hosted github's hostname having to be prefixed with https://github (though it is a nice convention). I believe it is optional to use https (though it is recommended AFAIK).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I don't see a perfect way to check for a subversion URL repo which github also supports.

@floatdrop
Copy link
Author

Okay, I pulled the changes and that is what I've got: build: Forbidden path outside the build context: drone (/mnt/tmp/docker-build363257787/drone)

I have my tmp and var folders symlinked to external storage so this caused troubles for me.

screen shot 2014-02-10 at 12 17 50 pm

@bradrydzewski
Copy link

I have my tmp and var folders symlinked to external storage so this caused troubles for me.

ahh, that makes sense. As of version 0.8 Docker won't follow symlinks when building an image

2014/02/10 06:15:18 error updating github status: Unauthorized

interesting, sounds like an issue with the github api

@floatdrop
Copy link
Author

ahh, that makes sense. As of version 0.8 Docker won't follow symlinks when building an image

But how can I move tmp to external device? My default partition is to small for deploying docker builds there.

interesting, sounds like an issue with the github api

I found another go-github client instance, that wasn't pointing to settings.GitHubApiUrl - this is fixed now.

I got question about this block of code - where status variable comes from? I got errored status build in github from success build in drone - this seems strange.

@bradrydzewski
Copy link

good catch! the switch should actually look like this:

switch commit.Status {

the /tmp directory only stores a few small files during the build process:

  • the Dockerfile
  • the Build Script
  • the Private RSA key

the actual Docker containers and images are stored in /var/lib/docker. Looks like you can change the default location: https://groups.google.com/forum/#!msg/docker-user/AKqf_qIhFL4/HX0-N_H509kJ

@floatdrop
Copy link
Author

Yes, changing switch is fixed the status reporting. Thank you!

the actual Docker containers and images are stored in /var/lib/docker. Looks like you can change the default location: https://groups.google.com/forum/#!msg/docker-user/AKqf_qIhFL4/HX0-N_H509kJ

I got /var symlinked too 😄

@bradrydzewski
Copy link

any luck with the Docker issues?

if the pull request is ready I'll merge it this afternoon

@floatdrop
Copy link
Author

I moved /tmp back to root and used config file for Docker /etc/default/docker to move docker data to var: DOCKER_OPTS="-g /mnt/var/lib/docker". For now I'm waiting for ours admins to fix up access from Github to Drone host (it turned out, that firewall was blocking connections from Github, but allows to connect to Github).

@floatdrop
Copy link
Author

Feel free to merge. I don't think I will able to solve networking issue anytime soon.

@floatdrop
Copy link
Author

Good news! We got it up and running. Build takes about 20 seconds from push - and it's awesome!

@floatdrop
Copy link
Author

So far so good. Can it be merged?

@bradrydzewski
Copy link

yes, I just need to prepare some sort of database migration. I very much look forward to merging this patch! thanks for all the hard work

@floatdrop
Copy link
Author

I moved this feature to branch and reopened another pull-request for merge

@floatdrop floatdrop closed this Feb 14, 2014
johannesHarness added a commit that referenced this pull request Sep 26, 2023
#23)

Abstracting the api/git/web routers will allow us to replace API routing (and potentially web?), while keeping the rest the same.
johannesHarness pushed a commit that referenced this pull request Sep 26, 2023
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 this pull request may close these issues.

None yet

5 participants