Secrets not working 0.8.1

I knows this comes up a lot here, and I’ve tried to RTFM, but this is killing me. I added the secret, include it in the .drone.yml file but I just don’t see it in the build. Is it being hidden or something?

.drone.yml:

pipeline:
  build:
    secrets: [derp]
    image: ubuntu:latest
    commands:
      - cat hello.txt
      - env

And the secret is there:

➜  hello-drone git:(secret_o_rama) ✗ drone secret ls tropo-operations/hello-drone
derp
Events: push, tag, deployment
Images: <any>

But when the server runs my build, it’s just not there in the ENV output.

Hi Robert, I created a secret called derp and then executed a build using your example yaml configuration and it printed out the secret in the logs:

Note that all environment variables will be uppercase inside the container, so make sure you take that into consideration. The only other reason that a secret would not be available, that I can think of, is if your build is a pull request event. Your secret looks like it is only enabled for push, tag and deployment events.

Perhaps you can take a look at this guide and provide some of the additional details requested here if you are still having issues.

Thanks Brad. I’m not trying to be difficult, it’s just not happening for me. Can you share the drone secret add command you used and the exact .drone.yml?

➜  hello-drone git:(secret_o_rama) ✗ drone secret ls tropo-operations/hello-drone
derp
Events: push, tag, deployment
Images: <any>

➜  hello-drone git:(secret_o_rama) ✗ drone repo info tropo-operations/hello-drone
Owner: tropo-operations
Repo: hello-drone
Type: git
Config: .drone.yml
Visibility: internal
Private: true
Trusted: false
Gated: false
Remote: https://sqbu-github.cisco.com/tropo-operations/hello-drone.git

server logs: https://gist.github.com/robertlabrie/afd31aec1fd2ab0d45933421fc833ff7
build output: https://gist.github.com/robertlabrie/9225d39d263355671088a48d41d3337d

I’m not trying to be difficult

No worries, you are definitely not being difficult :slight_smile:

Can you share the drone secret add command

I added the secret using the following command:

$ drone secret add --repository=bradrydzewski/foobar --name=derp --value=derp
$ drone secret ls --repository=bradrydzewski/foobar
derp 
Events: push, tag, deployment
Images: <any>

and the exact .drone.yml?

I used the same yaml that you provided in your example:

pipeline:
  build:
    secrets: [derp]
    image: ubuntu:latest
    commands:
      - cat hello.txt
      - env

I do see from your server logs that it is a push event, so my comment about regarding pull requests does not apply. I also see that you are building branch secret_o_rama. Can you confirm your sample yaml exists in the secret_o_rama branch? The reason I ask is because Drone will use the yaml from secret_o_rama, and sometimes people assume that Drone will only use the yaml in the master branch.

Perhaps maybe it would be faster to just do a quick Google Hangout? I am usually able to resolve these things quickly when I can see them and when we can debug interactively.

Hi Brad,

Yes the .drone.yml as described is in the secret_o_rama branch.

If you’d spend a few minutes with me on it, that’d be great. My gmail is robert.labrie@gmail.com

Thanks to Brad for your help, this was 100% my fault, I’d not pushed my .drone.yml containing secrets []. Yes, really. Posting solution for anyone who googles their way here in the future.