---
title: "Integrating into CI/CD | WebhookRelay"
meta:
  "og:description": "A guide on how to automatically deploy Functions in various source control management systems"
  "og:title": "Integrating into CI/CD"
  description: "A guide on how to automatically deploy Functions in various source control management systems"
---

![Stripes](https://webhookrelay.com/docs/webhooks/functions/integrate-into-cicd/images/stripes.svg)

Documentation

**Fundamentals**

# **Integrating into CI/CD**

A guide on how to automatically deploy Functions in various source control management systems

While it's easy to start using Functions straight from web dashboard, it's a good practice to keep the source in source control management (SCM), also known as [version control](https://en.wikipedia.org/wiki/Version_control) systems such as:

- [Github](https://github.com/)
- [Bitbucket](https://bitbucket.org)
- [Gitlab](https://about.gitlab.com/)

## [Bitbucket pipelines](#bitbucket-pipelines)

Bitbucket function example can be found here: [https://bitbucket.org/rusenas/webhookrelay-function-example/src/master/](https://bitbucket.org/rusenas/webhookrelay-function-example/src/master/).

Updates are done using [Bitbucket pipelines](https://bitbucket.org/product/features/pipelines) and the official [Webhook Relay pipe](https://bitbucket.org/product/features/pipelines/integrations?p=webhookrelay/webhookrelay-function-deploy) which deploys your code.

### [Setup](#setup)

1. Create a new function here [https://my.webhookrelay.com/functions](https://my.webhookrelay.com/functions) (or using `relay` CLI)
2. Get your access token key & secret [https://my.webhookrelay.com/tokens](https://my.webhookrelay.com/tokens)
3. Configure Bitbucket repository settings with access token:
  - Go to "Repository settings"
  - Click on "Repository variables" (if pipelines are not enabled, enable them)
  - Add two environment variables RELAY_KEY (with value from the access token 'key') and RELAY_SECRET (with value from the access token 'secret')
4. Create `bitbucket-pipelines.yml` file in your repository root directory:

```
image: golang:1.12
pipelines:
  default:
    - step:
        script:
          - pipe: webhookrelay/webhookrelay-function-deploy:0.2.4
            variables:
              FUNCTION_NAME: 'name of your functions' # Replace with your function name
              FUNCTION_FILE: 'function_file_name.lua' # Replace with your function filename 
              RELAY_KEY: $RELAY_KEY
              RELAY_SECRET: $RELAY_SECRET
```

That's it, you can now push your functions and get them updated.

Did this page help you?