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

1 Like

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.

1 Like

you can add --access-token=…

so like this

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

Thanks!!

hi sean - Would you be able to share the pipeline you are using? Thanks, daniel

I’m having this exact same issue. I provide the access token but it still tells me:

Validating fly.toml
Error: You must be authenticated to view this.