digitalocean / doctl

The official command line interface for the DigitalOcean API.
https://docs.digitalocean.com/reference/doctl/
Apache License 2.0
3.24k stars 385 forks source link

doctl binary for Android ARM64 #1028

Open vainkop opened 3 years ago

vainkop commented 3 years ago

There is no working doctl binary for Android ARM64 & I'd like to be able to use doctl on Android to manage Kubernetes clusters.

Currently I'm able to manage EKS, GKE with their tools like aws-iam-authenticator & gcloud but not DigitalOcean.

For example with the latest arm64 binary in the repo releases https://github.com/digitalocean/doctl/releases/download/v1.64.0/doctl-1.64.0-linux-arm64.tar.gz it doesn't work:

export DIGITALOCEAN_ACCESS_TOKEN="xxxxxxxxxxxxxx" && \
doctl auth init

Error: Unable to use supplied token to access API: Get https://api.digitalocean.com/v2/account: dial tcp lookup api.digitalocean.com on [::1]:53 read udp [::1]:47107>[::1]:53 read connection refused

But the curl request for same api works ok:

export DIGITALOCEAN_ACCESS_TOKEN="xxxxxxxxxxxxxx" && \
curl -X GET -H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
"https://api.digitalocean.com/v2/account"

{
  "account":
    {
      "droplet_limit":xxxx,
      "floating_ip_limit":xx,
      "volume_limit":xxx,
      "email":"xxxxxx",
      "uuid":"xxxxxxxxx",
      "email_verified":true,
      "status":"active",
      "status_message":""
    }
}

I wasn't able to build a working binary from sources either.

andrewsomething commented 3 years ago

Hi @vainkop Thanks for opening this issue. I suspect the DNS resolution failure you are seeing is due to this upstream issue with Go itself: https://github.com/golang/go/issues/8877 I believe building doctl with cgo enabled should produce a working binary for Android. Though that would require building it on the target platform. We disable cgo on our build in order to cross-build for different architectures.

If you a have an Android environment with a functional Go setup, I think they should be able to build it there with:

cd cmd/doctl && CGO_ENABLED=1 go build
vainkop commented 3 years ago

Hi @vainkop Thanks for opening this issue. I suspect the DNS resolution failure you are seeing is due to this upstream issue with Go itself: golang/go#8877 I believe building doctl with cgo enabled should produce a working binary for Android. Though that would require building it on the target platform. We disable cgo on our build in order to cross-build for different architectures.

If you a have an Android environment with a functional Go setup, I think they should be able to build it there with:

cd cmd/doctl && CGO_ENABLED=1 go build

@andrewsomething Unfortunately I don't have an environment with android ndk & etc necessary for such builds.

Because this platform is quite popular please consider building Android binaries & putting them into release assets on a regular basis like for the rest of the platforms. I wouldn't like to go through the building process every time you release a new version.

Also posting some issues & link that others might find useful: https://github.com/golang/go/issues/8877 https://github.com/golang/go/wiki/Mobile

createchange commented 2 years ago

Hi @vainkop Thanks for opening this issue. I suspect the DNS resolution failure you are seeing is due to this upstream issue with Go itself: golang/go#8877 I believe building doctl with cgo enabled should produce a working binary for Android. Though that would require building it on the target platform. We disable cgo on our build in order to cross-build for different architectures.

If you a have an Android environment with a functional Go setup, I think they should be able to build it there with:

cd cmd/doctl && CGO_ENABLED=1 go build

Thank you for providing this information. I do have the prequisite environment, and was able to get a functional binary which now permits me to authenticate.