您好,登錄后才能下訂單哦!
Repository secrets用于存儲密碼、秘鑰、令牌等機密信息。
在倉庫的setting界面可以配置repository secrets
使用方式:
kind: pipeline
name: default
steps:
- name: build
image: alpine
environment:
USERNAME:
from_secret: docker_username
PASSWORD:
from_secret: docker_password
但是在用戶所有Repository的secrets都一樣的情況下,每次都配置很麻煩,此時就需要Organization secrets。Organization secrets可以由屬于Organization的任何Repository使用。
配置Organization secrets需要先安裝drone的命令行工具
drone的命令行是提供drone管理用戶和repository 設置的重要工具
1、安裝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
其他安裝方式:https://docs.drone.io/cli/install/
配置drone_server地址和token:
export DRONE_SERVER=http://drone.mycompany.com
export DRONE_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
在user-setting界面可以獲取信息
此時就可以使用drone命令行工具了
2、使用drone-cli
命令行參數
# 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
詳細命令信息:https://docs.drone.io/cli/commands/
創建通用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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。