Configuration Secrets used by drone
Repository secrets is used to store secret information such as passwords, keys, tokens, etc.
Repository secrets can be configured in the setting interface of the warehouse
Mode of use:
Kind: pipelinename: defaultsteps:- name: build image: alpine environment: USERNAME: from_secret: docker_username PASSWORD: from_secret: docker_password
However, if the secrets of all Repository is the same, it is troublesome to configure it every time, and Organization secrets is needed at this time. Organization secrets can be used by any Repository that belongs to Organization.
To configure Organization secrets, you need to install drone's command line tools first.
The command line of drone is an important tool for providing drone administrative users and repository settings
1. Install drone-cli (linux):
Curl-L https://github.com/drone/drone-cli/releases/latest/download/drone_linux_amd64.tar.gz | tar zxsudo install-t / usr/local/bin drone
Other installation methods: https://docs.drone.io/cli/install/
Configure the drone_server address and token:
Export DRONE_SERVER= http://drone.mycompany.comexport DRONE_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
You can get information in the user-setting interface.
At this point you can use the drone command line tool
2. Use drone-cli
Command line argument
# drone-hNAME: drone-command line utilityUSAGE: drone [global options] command [command options] [arguments...] VERSION: 1.2.0COMMANDS: 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 commandGLOBAL 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
Command details: https://docs.drone.io/cli/commands/
Create a generic secrets
$drone orgsecret add [organization] [name] [data] / / for example $drone orgsecret add octocat docker_password pa55word$ drone orgsecret ls docker_password Organization: octocat Pull Request Read: false Pull Request Write: false