저장소별 시크릿
저장소별 시크릿 (Per Repository)
저장소 시크릿(repository secret)은 비밀번호, 토큰, SSH 키 같은 민감한 정보를 저장하고 관리하는 데 사용됩니다. 이런 정보를 구성 파일에 평문으로 두는 것보다 시크릿에 저장하는 편이 안전하다고 여겨집니다.
저장소 시크릿을 생성·수정·삭제하려면 push 권한이나 관리자 권한이 필요합니다.
저장소 설정 화면에서 저장소 시크릿을 관리할 수 있습니다.
출처: Drone CI Docs
본문
이름이 지정된 시크릿으로부터 환경 변수를 주입하기:
kind: pipeline
name: default
steps:
- name: build
image: alpine
environment:
USERNAME:
from_secret: docker_username
PASSWORD:
from_secret: docker_password
commands:
- echo "You can call the secrets like this examples below."
- echo $USERNAME
- echo $PASSWORD
- echo "In both cases, and for security reasons, you will see asteriks '*******' instead the value under the echo command."
이름이 지정된 시크릿으로부터 플러그인 설정을 주입하기:
kind: pipeline
name: default
steps:
- name: build
image: plugins/docker
settings:
repo: octocat/hello-world
username:
from_secret: docker_username
password:
from_secret: docker_password
commands:
- echo "You can call the secrets like this examples below."
- echo $USERNAME
- echo $PASSWORD
- echo "In both cases, and for security reasons, you will see asteriks '*******' instead the value under the echo command."
풀 리퀘스트 (Pull Requests)
시크릿은 기본적으로 풀 리퀘스트에는 노출되지 않습니다. 이는 악의적인 사용자가 풀 리퀘스트를 보내 시크릿을 탈취하려는 시도를 막기 위함입니다. 시크릿을 생성할 때 Allow Pull Requests를 체크하면 이 기본 동작을 바꿀 수 있지만, 그에 따른 위험은 본인 몫입니다.