Drone

Access to .netrc for cloning private repo [plugin]

Attempting to build a plugin that uses the .netrc from Bitbucket (or other providers) to pull another private repo that uses the same credentials. We cant seem to workout how or where to acess the .netrc file inside a plugin container?

Plugin:

  • Alpine linux container
  • git
  • openssh
  • curl

We are building and testing our plugin on Drone.io as we intend to open source it. Its running as

  • Private

Assuming this can be done from reading many issues and discussions and looking through the git push plugin: https://github.com/appleboy/drone-git-push

I would have assumed that they resided in $DRONE_NETRC_PASSWORD $DRONE_NETRC_USERNAME or an injected /root/.netrc or ~/.netrc although cannot find either.

I would have assumed that they resided in $DRONE_NETRC_PASSWORD $DRONE_NETRC_USERNAME or an injected /root/.netrc or ~/.netrc although cannot find either.

The netrc environment variables are only available if the repository is private. The netrc file is automatically generated for pipeline steps with a commands section and then the environment variables are unset (explore the code here).

With that being said, it is important to note that the netrc file is considered and internal implementation detail and could change without warning. For this reason it is not recommended for use outside of the system internals. See DRONE_NETRC_USERNAME documentation/usage