Drone

Drone is not cloning from Bitbucket Server

I have Bitbucket server setup, and I have Drone setup. Drone sees my repo and attempts to build. When it does, I get an error saying that it was unable to clone the repo.

To diagnose, I tried to run the drone/git plugin manually. I found that the following works:

docker run -e DRONE_COMMIT=$my_commit -e DRONE_COMMIT_BRANCH=master -e DRONE_REMOTE_URL=https://$my_host/scm/infra/microservice-tas-sm.git -e DRONE_NETRC_MACHINE=$my_host -e DRONE_NETRC_USERNAME=drone -e DRONE_NETRC_PASSWORD=$my_token drone/git drone/git

I then captured the env variables passed at runtime to a transient container (I assume it is the drone/git container) that was created when I hit “Restart” in the browser. This container had an empty DRONE_REMOTE_URL and an empty DRONE_NETRC_MACHINE, but it had the DRONE_NETRC_USERNAME and DRONE_NETRC_PASSWORD specific correctly.

My believe is that the clone is failing due to the missing env variables. Is this known to work? I didn’t manage to see in the code where these env variables are being set or where the drone/git is being configured and called.

Is this known to work?

Yes, we test Drone against all supported source control management systems. We have our own Bitbucket Server installation that we used to develop the integration, and there are production installations using this integration.

My belief is that the clone is failing due to the missing env variables.

the DRONE_REMOTE_URL and DRONE_NETRC_MACHINE values come from the Bitbucket repository endpoint. If the value is empty it would imply Bitbucket returns an empty value in the response payload. Here is an example payload from our test instance: https://github.com/drone/go-scm/blob/master/scm/driver/bitbucket/testdata/repos.json#L24

I didn’t manage to see in the code where these env variables are being set

They are being set here

I didn’t manage to see in the code where these env variables are being set or where the drone/git is being configured and called.

It is being configured here.

1 Like

Thank you, that was the key I needed. I had started Drone and sync’d the repo before I had enabled HTTPS cloning in bitbucket. I restarted Drone, but that didn’t pick up the fresh configuration. Instead, I had to hit “sync” again in Drone, and then it picked up the new config and worked as expected.

Now that I understand how the integration works, it is clear to me. I was missing some high level description in the Drone.io docs of how the system worked. Perhaps that would be a worthy enhancement.

Thanks!

we are aware that the documentation needs significant improvement, however, we are also very resource constrained. I appreciate the feedback and we will do our best to take this into account as we continue to improve the docs.