Spacelift
PrivacyT&Cs
  • 👋Hello, Spacelift!
  • 🚀Getting Started
  • 🌠Main concepts
    • Stack
      • Creating a stack
      • Stack settings
      • Organizing stacks
      • Stack locking
      • Drift detection
    • Configuration
      • Environment
      • Context
      • Runtime configuration
        • YAML reference
    • Run
      • Task
      • Proposed run (preview)
      • Tracked run (deployment)
      • Module test case
      • User-Provided Metadata
      • Run Promotion
      • Pull Request Comments
    • Policy
      • Login policy
      • Access policy
      • Approval policy
      • Initialization policy
      • Plan policy
      • Push policy
      • Task policy
      • Trigger policy
    • Resources
    • Worker pools
    • VCS Agent Pools
  • 🛰️Platforms
    • Terraform
      • Module registry
      • External modules
      • Provider
      • State management
      • Terragrunt
      • Version management
      • Handling .tfvars
      • CLI Configuration
      • Cost Estimation
      • Resource Sanitization
      • Storing Complex Variables
      • Debugging Guide
    • Pulumi
      • Getting started
        • C#
        • Go
        • JavaScript
        • Python
      • State management
      • Version management
    • CloudFormation
      • Getting Started
      • Reference
      • Integrating with SAM
      • Integrating with the serverless framework
    • Kubernetes
      • Getting Started
      • Authenticating
      • Custom Resources
      • Helm
      • Kustomize
  • ⚙️Integrations
    • Audit trail
    • Cloud Integrations
      • Amazon Web Services (AWS)
      • Microsoft Azure
      • Google Cloud Platform (GCP)
    • Source Control
      • GitHub
      • GitLab
      • Azure DevOps
      • Bitbucket Cloud
      • Bitbucket Datacenter/Server
    • Docker
    • GraphQL API
    • Single sign-on
      • GitLab OIDC Setup Guide
      • Okta OIDC Setup Guide
      • OneLogin OIDC Setup Guide
      • Azure AD OIDC Setup Guide
      • AWS IAM Identity SAML 2.0 Setup Guide
    • Slack
    • Webhooks
  • 📖Product
    • Privacy
    • Security
    • Support
      • Statement of Support
    • Disaster Continuity
    • Billing
      • Stripe
      • AWS Marketplace
    • Terms and conditions
    • Refund Policy
  • Cookie Policy
Powered by GitBook
On this page
  • Setting Up
  • Configuration Options
  • Passing Metadata Tags
  • Private Workers

Was this helpful?

  1. Main concepts

VCS Agent Pools

This article explains how you can set up and use on-premise VCS Agent Pools.

PreviousWorker poolsNextTerraform

Last updated 2 years ago

Was this helpful?

By default, Spacelift communicates with your VCS provider directly. This is usually sufficient, but some users may have special requirements regarding infrastructure, security or compliance, and need to host their VCS system in a way that's only accessible internally, where Spacelift can't reach it. This is where VCS Agent Pools come into play.

A single VCS Agent Pool is a way for Spacelift to communicate with a single VCS system on your side. You run VCS Agents inside of your infrastructure and configure them with your internal VCS system endpoint. They will then connect to a gateway on our backend, and we will be able to access your VCS system through them.

On the Agent there are very conservative checks on what requests are let through and which ones are denied, with an explicit allowlist of paths that are necessary for Spacelift to work. All requests will be logged to standard output with a description about what they were used for.

Setting Up

Navigate to VCS Agent Pools using the Spacelift navigation sidebar. Click Add VCS Agent Pool.

Give your VCS Agent Pool a name and description, and you're done! A configuration token will be downloaded.

  • SPACELIFT_VCS_AGENT_POOL_TOKEN - the token you’ve received from Spacelift during VCS Agent Pool creation.

  • SPACELIFT_VCS_AGENT_TARGET_BASE_ENDPOINT - internal endpoint of your VCS system, including the protocol, as well as port, if applicable. i.e. http://169.254.0.10:7990

  • SPACELIFT_VCS_AGENT_VENDOR - the vendor of your VCS system, currently available options are gitlab, bitbucket_datacenter and github_enterprise.

Congrats! Your VCS Agent should now connect to the Spacelift backend and start handling connections.

Within the VCS Agent Pools page, you will be able to see the number of active connections used by your pool.

Whenever you need to specify an endpoint inside of Spacelift which should use your VCS Agent Pool, you should write it this way: private://my-vcs-agent-pool-name/possible/path

When trying to use this integration, i.e. by opening the Stack creation form, you'll get a detailed log of the requests:

Configuration Options

A number of configuration variables is available to customize how your VCS Agent behaves:

  • SPACELIFT_VCS_AGENT_ALLOWED_PROJECTS - regular expression matching allowed projects for API calls. Projects are in the form: 'group/repository';

  • SPACELIFT_VCS_AGENT_PARALLELISM- number of streams to create. Each stream can handle one request simultaneously;

Passing Metadata Tags

When the VCS Agent from a VCS Agent Pool is connecting to the gateway, you can send along some tags that will allow you to uniquely identify the process / machine for the purpose of debugging. Any environment variables using SPACELIFT_METADATA_ prefix will be passed on. As an example, if you're running Spacelift VCS Agents in EC2, you can do the following just before you execute the VCS Agent binary:

export SPACELIFT_METADATA_instance_id=$(ec2-metadata --instance-id | cut -d ' ' -f2)

Doing so will set your EC2 instance ID as instance_id tag in your VCS Agent connections.

Private Workers

You can now run the launcher binary (downloaded from ) by setting three environment variables:

VCS agents are only supported when using private worker pools. Because your source code is downloaded directly by Spacelift workers, you need to configure your workers to know how to reach your VCS instance. Information on how to do this is provided on the page.

🌠
here
worker pools
Creation of VCS Agent Pool
Running the VCS Agent
VCS Agent Pool Connections
Access Log example