> For the complete documentation index, see [llms.txt](https://docs.coherent.global/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coherent.global/ci-cd/deployment-request.md).

# Deployment request

The [Options](/navigation/options.md#deployment-request) feature in Spark allows users to submit a deployment request that will initiate a continuous integration / continuous deployment process ([CI/CD](https://www.redhat.com/en/topics/devops/what-is-ci-cd)). The request triggers a downstream application to initiate the process.

## Prerequisites

* Webhooks must be enabled, see [How to: Automate workflows with webhooks](/integrations/how-to-automate-workflows-with-webhooks.md).
* Downstream web application that is capable of accepting `POST` method requests.
* Use the [ImpEx APIs](/spark-apis/impex-apis.md) to move Spark services between environments and tenants.

## Implement a deployment to production

The diagram and steps below describe how the [Options](/navigation/options.md#deployment-request) feature can be used with the required functionalities as part of a [CI/CD](https://www.redhat.com/en/topics/devops/what-is-ci-cd) process to deploy a Spark service from the `UAT` to `PROD` environment.

```mermaid
flowchart LR
    User([User])
    UAT["Spark<br>UAT"]
    PROD["Spark<br>production"]
    DA["Downstream<br/>application"]
    User -->|1| UAT
    UAT -->|2| DA
    DA -->|3| UAT
    DA -->|4| PROD
```

1. Define the user groups who can make a deployment request in [Options](/navigation/options.md#tenant-configuration).
2. In the `UAT` environment, a user submits an [Options](/navigation/options.md#deployment-request) by selecting the **Folder**, **Service**, and **Version**.
3. Spark sends a notification to the downstream application via a `POST` method using the webhook.
4. The downstream application receives the notification and conducts the following processing on the `UAT` environment:
   1. Check that the notification relates to a deployment request by checking the request body for `"UserAction": "DeploymentRequest"`.
   2. Acquire an access token via the [Client credentials](/identity-and-access-management/client-credentials.md) grant.
   3. Generate the export package using the [Export](/spark-apis/impex-apis/export.md) API, download and store it.
5. The downstream application then performs the remaining actions on the `PROD` environment.
   1. Acquire an access token via the [Client credentials](/identity-and-access-management/client-credentials.md) grant.
   2. Publish the previously exported package using the [Import](/spark-apis/impex-apis/import.md) API.

## Demo video

This video demonstrates the use of a deployment request to copy a service version between environments.

{% file src="/files/Pe53cubNtcmVWH1HrxXE" %}

## Guides

Here are sample workflows developed in [Azure DevOps](https://learn.microsoft.com/en-us/azure/devops/) and [GitHub Actions](https://docs.github.com/en/actions) that demonstrate the CI/CD process.

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="image">Cover image</th></tr></thead><tbody><tr><td><strong>How to: Deploy with Azure DevOps</strong></td><td></td><td></td><td><a href="/ci-cd/how-to-deploy-spark-services-with-azure-devops.md">How to: Deploy Spark services with Azure DevOps</a></td><td data-object-fit="cover" data-alt="Azure DevOps icon"><a href="https://2714190325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fc7fek1ZgAUH5MA3m5pH8%2Fuploads%2F51cIG0pT77XmoEA0C7CY%2FcommunityIcon_lc1sg4wc73t21.jpg?alt=media&amp;token=5a422573-6d29-4f3e-bca4-b89f0ac5911e">communityIcon_lc1sg4wc73t21.jpg</a></td></tr><tr><td><strong>GitHub Actions example</strong></td><td></td><td></td><td><a href="https://github.com/Coherent-Partners/spark-service-promotion/blob/main/docs/GITHUB_ACTIONS.md">https://github.com/Coherent-Partners/spark-service-promotion/blob/main/docs/GITHUB_ACTIONS.md</a></td><td data-object-fit="cover" data-alt="GitHub Actions logo"><a href="https://2714190325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fc7fek1ZgAUH5MA3m5pH8%2Fuploads%2FLLOGpEx6hTA9c28la6K6%2Fgithubact.png?alt=media&amp;token=e93009ed-372b-4535-be85-0a39507acd2d">githubact.png</a></td></tr></tbody></table>
