Compiler

This section contains information on the compiler component for the Vela server.

This component is responsible for transforming a pipeline into an executable representation for the worker.

During the transformation, it will retrieve templates from one or more registries depending on the pipeline configuration.

By default, Vela will use GitHub as a registry for fetching templates, but you can configure additional registries as well.

However, to fetch templates from a private organization or repository on GitHub, you need to provide a token to the compiler.

Additionally, the compiler can send pipelines to an external endpoint, to be modified, based off custom configuration.

This modification endpoint can be used to perform any number of customizations to all workloads created by the system.

Some examples of what the modification endpoint can do include, but are not limited to:

  • injecting or updating the configuration for secrets in the pipeline
  • injecting or updating the configuration for services in the pipeline
  • injecting or updating the configuration for stages in the pipeline
  • injecting or updating the configuration for steps in the pipeline

Configuration

The following options are used to configure the component:

NameDescriptionRequiredDefaultEnvironment Variables
clone-imagedefault clone image to use for Vela injected clone steptruetarget/vela-git (1)VELA_CLONE_IMAGE
github-driverenables using Github or GitHub Enterprise Server as a registry for templatesfalsefalseCOMPILER_GITHUB
VELA_COMPILER_GITHUB
github-urlfully qualified url to GitHub or GitHub Enterprise Server for templatesfalseN/ACOMPILER_GITHUB_URL
VELA_COMPILER_GITHUB_URL
github-tokentoken used for authentication when fetching registry templatesfalseN/ACOMPILER_GITHUB_TOKEN
VELA_COMPILER_GITHUB_TOKEN
modification-addrfully qualified url to endpoint for modifying pipelinesfalseN/AMODIFICATION_ADDR
VELA_MODIFICATION_ADDR
modification-retriesnumber of times to resend failed requests to the modification endpointfalse5MODIFICATION_RETRIES
VELA_MODIFICATION_RETRIES
modification-secretauthenticates communication between compiler and the modification endpointfalseN/AMODIFICATION_SECRET
VELA_MODIFICATION_SECRET
modification-timeouttimeout for requests sent to the modification endpointfalse8sMODIFICATION_TIMEOUT
VELA_MODIFICATION_TIMEOUT
max-template-depthmax depth for calling nested templates during compilationtrue3MAX_TEMPLATE_DEPTH
VELA_MAX_TEMPLATE_DEPTH

(1) this will be the latest available, tagged release of target/vela-git at the time the server component is released

Drivers

The following drivers are available to configure the component:

NameDescriptionDocumentation
githubuses GitHub or GitHug Enterprise Server as a template registryhttps://docs.github.com/en/enterprise-server/admin/overview/system-overview

GitHub

From the GitHub official website:

GitHub is where the world builds software. Millions of developers and companies build, ship, and maintain their software on GitHub—the largest and most advanced development platform in the world.

The below configuration displays an example of starting the Vela server that will use a GitHub Server as a template registry:

$ docker run \
  --detach=true \
  --env=VELA_ADDR=https://vela-server.example.com \
+ --env=VELA_COMPILER_GITHUB=true \
+ --env=VELA_COMPILER_TOKEN=<github-personal-access-token> \
+ --env=VELA_COMPILER_URL=https://github.com \
  --env=VELA_DATABASE_ENCRYPTION_KEY=<encryption-key> \
  --env=VELA_QUEUE_DRIVER=redis \
  --env=VELA_QUEUE_ADDR=redis://<password>@<hostname>:<port>/<database> \
  --env=VELA_PORT=443 \
  --env=VELA_SECRET=<shared-secret> \
  --env=VELA_SERVER_PRIVATE_KEY=<private_key> \
  --env=VELA_SCM_CLIENT=<oauth-client-id> \
  --env=VELA_SCM_SECRET=<oauth-client-secret> \
  --env=VELA_WEBUI_ADDR=https://vela.example.com \
  --name=server \
  --publish=80:80 \
  --publish=443:443 \
  --restart=always \
  target/vela-server:latest

GitHub Enterprise Server

From the GitHub Enterprise official website:

GitHub Enterprise Server is your organization’s private copy of GitHub contained within a virtual appliance, hosted on premises or in the cloud, that you configure and control.

The below configuration displays an example of starting the Vela server that will use a GitHub Enterprise Server as a template registry:

$ docker run \
  --detach=true \
  --env=VELA_ADDR=https://vela-server.example.com \
+ --env=VELA_COMPILER_GITHUB=true \
+ --env=VELA_COMPILER_TOKEN=<github-personal-access-token> \
+ --env=VELA_COMPILER_URL=https://git.example.com \
  --env=VELA_DATABASE_ENCRYPTION_KEY=<encryption-key> \
  --env=VELA_QUEUE_DRIVER=redis \
  --env=VELA_QUEUE_ADDR=redis://<password>@<hostname>:<port>/<database> \
  --env=VELA_PORT=443 \
  --env=VELA_SECRET=<shared-secret> \
  --env=VELA_SERVER_PRIVATE_KEY=<private_key> \
  --env=VELA_SCM_CLIENT=<oauth-client-id> \
  --env=VELA_SCM_SECRET=<oauth-client-secret> \
  --env=VELA_WEBUI_ADDR=https://vela.example.com \
  --name=server \
  --publish=80:80 \
  --publish=443:443 \
  --restart=always \
  target/vela-server:latest