How to use a FLY_API_TOKEN in a Pipeline (CI/CD)

Hi,

I’m looking to create a CI/CD pipeline on BitBucket, but I’m unable to run flyctl deploy because my API key is not being recognized. I’ve configured it the same way as you would for GitLab:Continuous Deployment with GitLab · Fly

So I currently get this error:

flyctl deploy --remote-only
Error No access token available. Please login with 'flyctl auth login'

Any tips would be very much appreciated :slight_smile: Thanks!

Shaun

Hi Sean, it sounds like the FLY_API_TOKEN environment variable may not be set. Try running something like echo $FLY_API_TOKEN | wc or echo $FLY_API_TOKEN | head -c 3 right before the flyctl deploy --remote-only call to see that the environment variable is getting set correctly.

If it’s not set, double check the Bitbucket pipeline secrets to ensure the names/values are correct.

you can add --access-token=…

so like this

flyctl deploy --config=fly.toml --access-token=...
1 Like

Thanks!!