drone使用之配置Secrets

本文介绍如何使用Drone CI的Organization Secrets功能,简化跨仓库的敏感信息管理。通过安装drone-cli并配置drone_server地址和token,可以轻松创建和管理适用于整个组织的通用Secrets。
部署运行你感兴趣的模型镜像

Repository secrets用于存储密码、秘钥、令牌等机密信息。
在仓库的setting界面可以配置repository secrets
drone使用之配置Secrets
drone使用之配置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使用之配置Secrets
此时就可以使用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

您可能感兴趣的与本文相关的镜像

ACE-Step

ACE-Step

音乐合成
ACE-Step

ACE-Step是由中国团队阶跃星辰(StepFun)与ACE Studio联手打造的开源音乐生成模型。 它拥有3.5B参数量,支持快速高质量生成、强可控性和易于拓展的特点。 最厉害的是,它可以生成多种语言的歌曲,包括但不限于中文、英文、日文等19种语言

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值