Repository secrets for storing passwords, keys, tokens and other confidential information.
In setting the warehouse interface can be configured repository secrets
Use:
kind: pipeline
name: default
steps:
- name: build
image: alpine
environment:
USERNAME:
from_secret: docker_username
PASSWORD:
from_secret: docker_password
But in all Repository user's secrets are the same, the configuration every time a lot of trouble, then you need Organization secrets. Organization Secrets Repository can be used by any part of the Organization.
Configuration Organization secrets need to install the command line tool drone
drone command-line user management is an important tool drone and repository settings provide
a mounting drone-cli (linux):
curl -L https://github.com/drone/drone-cli/releases/latest/download/drone_linux_amd64.tar.gz | tar zx
sudo install -t /usr/local/bin drone
Other Installation: https://docs.drone.io/cli/install/
configuration drone_server address and token:
export DRONE_SERVER=http://drone.mycompany.com
export DRONE_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
You can be acquired in a user-setting information interface
then you can use the command-line tool drone
2, using the drone-cli
command line parameters
# drone -h
NAME:
drone - command line utility
USAGE:
drone [global options] command [command options] [arguments...]
VERSION:
1.2.0
COMMANDS:
build manage builds
cron manage cron jobs
log manage logs
encrypt encrypt a secret
exec execute a local build
info show information about the current user
repo manage repositories
user manage users
secret manage secrets
server manage servers
queue queue operations
orgsecret manage organization secrets
autoscale manage autoscaling
fmt format the yaml file
convert convert legacy format
lint lint the yaml file
sign sign the yaml file
jsonnet generate .drone.yml from jsonnet
starlark generate .drone.yml from starlark
plugins plugin helper functions
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
-t value, --token value server auth token [$DRONE_TOKEN]
-s value, --server value server address [$DRONE_SERVER]
--autoscaler value autoscaler address [$DRONE_AUTOSCALER]
--help, -h show help
--version, -v print the version
For more information about the command: https://docs.drone.io/cli/commands/
create a common secrets
$ drone orgsecret add [organization] [name] [data]
//例如
$ drone orgsecret add octocat docker_password pa55word
$ drone orgsecret ls
docker_password
Organization: octocat
Pull Request Read: false
Pull Request Write: false