Skip to content

Connecting to CI/CD

Overview

We recommend creating a new CI/CD pipeline to automatically run tecton plan and tecton apply upon changes to your Tecton feature repo.

Example

For example, in GitHub actions, you can add the following:

name: Tecton Feature Repo CI/CD

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-latest
    env:
      TECTON_API_KEY: ${{ secrets.TECTON_API_KEY }}
      API_SERVICE: https://<YOUR CLUSTER SUBDOMAIN>.tecton.ai/api
      FEATURE_REPO_DIR: ./feature_repo
    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Set up Python 3.7.10
      uses: actions/setup-python@v2
      with:
        python-version: 3.7.10

    - name: Install pypandoc for databricks-connect
      run: pip install pypandoc

    - name: Install the Tecton CLI
      run: pip install --no-cache-dir 'tecton[pyspark]'

    - name: Run tecton plan
      run: cd ${FEATURE_REPO_DIR} && tecton plan --no-safety-check

    - name: Run tecton apply
      if: ${{ github.event_name == 'push' }}
      run: cd ${FEATURE_REPO_DIR} && tecton apply --no-safety-check

You'll also need to run tecton create-api-key --description cicd --is-admin to create your Tecton API key, and add it to GitHub secrets. Note that setting TECTON_API_KEY and API_SERVICE as environment variables avoids the need for an interactive tecton login. For other CI/CD systems, you'll want to modify the above to match the format of the system you use.