Starlark 템플릿
template을 사용하려면 drone.yml 파일에서 kind를 'template'으로 설정하고, 불러올 기본 템플릿 이름과 자유 형식의 템플릿 입력값들을 지정하면 됩니다.
출처: Drone CI Docs
본문
kind: template
load: plugin.starlark
data:
stepName: my_step
image: my_image
commands: my_command
기본 템플릿 예시:
def main(ctx):
return {
"kind": "pipeline",
"name": "build",
"steps": [
{
"name": ctx.input.stepName,
"image": ctx.input.image,
"commands": [
ctx.input.commands
]
}
]
}
미리 정의된 변수 목록은 다음에서 확인할 수 있습니다: https://docs.drone.io/template/variables
커맨드 라인 도구를 사용해 조직 템플릿을 만들 수 있습니다:
$ drone template add [namespace] [name] [data]
$ drone template add octocat template_name @path_to_file