# Workflow Setup

Before you can go through the detailed steps to implement a Continuous Integration (CI)/Continuous Delivery (CD) workflow, you need to provide following prerequisites.

## Set up Access for the Environments

As shown in the picture on the previous page, the suggested workflow requires three (3) environments:

1. CI environment - Jenkins in this example
2. test environment - HERE platform resources, defined by user with HERE platform group
3. production environment - HERE platform resources, defined by user with HERE platform group

We suggest creating a group for each environment and three different apps, and adding one app to each group. It allows to clearly distinguish between environments, to minimize the risk of disruption caused by human error and to simulate a real world scenario where different actors operate different environments.

For example, you can have:

• Group-X with App-X for the CI environment (1)
• Group-Y with App-Y for the test environment (2)
• Group-Z with App-Z for the production environment (3)

Each group/app pair creates and accesses resources in its environment. To clearly separate environments, each app must belong to only one group.

For information on groups, apps and adding apps to groups, see the Teams and Permissions User Guide.

## Create Catalog and Layers

Both Step 2 and Step 3 in the CI/CD workflow require the creation of the following catalogs and layers:

• input catalog and layer
• output catalog and layer

For Step 2, Validation script located in jenkins/step2.groovy creates the catalogs and layers required in the test environment with the configuration file deployments/auto-sensor-1-archive.json for the test input catalog and the configuration file deployments/auto-sensor-2-learnings.json for the test output catalog. The Jenkins job orchestrating this step must use the credentials associated with App-Y (Group-Y).

For Step 3, Deployment script located in jenkins/step3.groovy assumes the catalogs are already created and accessible. The Jenkins job orchestrating this step must use the credentials associated with App-Z (Group-Z).

For information on how to create layers, see the Data API.

Additionally, if you need to access data within the catalogs from your local development or Jenkins environment, you must share the required catalogs with the app used to create these catalogs. If you need to access data within the catalogs from inside the pipeline, you must share the catalogs with the group used to create the pipeline (Group-Y for test catalogs, Group-Z for production catalogs).

For information about sharing catalogs, see the Data API.

### Create Pipelines

Both Step 2 and Step 3 require a pipeline to run the code you are testing. For Step 2, jenkins/step2.groovy creates the pipeline required for the test environment with the configuration file deployments/test/deployment.properties. The Jenkins job orchestrating this step must use the credentials related to Group-Y/App-Y.

For Step 3, jenkins/step3.groovy creates the pipeline required for the production environment with the configuration file deployments/prd/deployment.properties if it doesn't exist. The The id of created pipeline is saved in the Jenkins job configuration. Jenkins job orchestrating this step must use the credentials related to Group-Z/App-Z.