Drone 1.0.0-rc.1 Secrets

Hi, I’m trying to do something like this:

  1. Add a secrets to my repo (project/myrepo):
    drone secret add --repository project/myrepo --name sonar_host --data foo
    drone secret add --repository project/myrepo --name sonar_host2 --data bar

The help for command

drone secret add

:

NAME:
drone secret add - adds a secret

USAGE:
drone secret add [command options] [repo/name]

OPTIONS:
–repository value repository name (e.g. octocat/hello-world)
–name value secret name
–data value secret value
–allow-pull-request permit read access to pull requests
–allow-push-on-pull-request permit write access to pull requests (e.g. allow docker push)

  1. Content of .drone.yml:
kind: pipeline
name: constructor
steps:
  - name: docker
    image: golang:1.8
    secrets: [sonar_host, sonar_host2]
    commands:
      - env
  1. Result

+ env
DRONE_BRANCH=feature/test
DRONE_SYSTEM_HOST=cloud.drone.io

GOLANG_VERSION=1.8.7
CI_JOB_STATUS=success

in my environment, i can’t find created variables:

SONAR_HOST and SONAR_HOST2

The secret yaml syntax changed in 1.0.0. https://docs.drone.io/config/secrets/pre-repository/

Try this:

kind: pipeline
name: constructor
steps:
  - name: docker
    image: golang:1.8
    environment:
       SONAR_HOST:
        from_secret: sonar_host
       SONAR_HOST2:
        from_secret: sonar_host2
    commands:
      - env
2 Likes

Wow! It’s working good!