InfoGrab Docs

내부 Executor 인터페이스

GitLab Runner의 Executor 및 ExecutorProvider 인터페이스 구조와 Shell, Docker, Docker Machine executor 구현 예시를 설명합니다.

Note 이 문서는 코드 내부에 대한 문서이므로, 사용자에게 노출되는 구성, 동작 또는 기능에 대한 문서보다 오래되기 쉽습니다. 이 페이지는 작성일 기준으로 정확합니다: 2022-01-26 . 인터페이스 # GitLab Runner는 작업이 실행되는 방식을 정의하기 위해 executors 라는 개념을 사용합니다. GitLab CI/CD 작업 실행의 현재 철학은 _모든 것이 셸 스크립트_이지만, 이 스크립트는 다양한 방식으로 실행될 수 있습니다: GitLab Runner가 동작하는 호스트의 셸에서 직접 실행, SSH를 통해 액세스 가능한 외부 호스트의 셸에서 실행, VirtualBox 또는 Parallels로 관리되는 가상 머신의 셸에서 실행, Docker로 관리되는 컨테이너의 셸에서 실행, 및 몇 가지 다른 방식이 있습니다. 또한 _Custom Executor_도 있는데, 이는 사용자가 자체적인 작업 실행 방식을 구현하기 위해 매우 단순한 외부 인터페이스와 상호 작용할 수 있게 합니다. 이러한 _executors_는 모두 GitLab Runner 프로세스에 의해 내부적으로 오케스트레이션됩니다. 이를 위해 Runner는 executor가 작동하기 위해 구현해야 하는 일련의 Go 인터페이스를 사용합니다. executor의 수명 주기와 작업 실행을 관리하는 두 가지 주요 인터페이스( common 패키지의 일부)는 다음과 같습니다: Executor ExecutorProvider type Executor interface { // Shell returns data about the shell and scripts this executor is bound to. Shell() *ShellScriptInfo // Prepare prepares the environment for build execution. e.g. connects to SSH, creates containers. Prepare(options ExecutorPrepareOptions) error // Run executes a command on the prepared environment. Run(cmd ExecutorCommand) error // Finish marks the build execution as finished. Finish(err error ) // Cleanup cleans any resources left by build execution. Cleanup() // GetCurrentStage returns current stage of build execution. GetCurrentStage() ExecutorStage // SetCurrentStage sets the current stage of build execution. SetCurrentStage(stage ExecutorStage) } type ExecutorProvider interface { // CanCreate returns whether the executor provider has t