Description of Release GitOps workflow
You can use the Release UI to manage your Application Template, Environment Variables files, and environment configurations. But Release also supports managing these configuration files in your Git repository.
If your code and its Release configuration file are in the same branch of your Git repository, GitOps gives you concise management and version control of files.
In order to use GitOps with Release, you'll need to:
- Contact [email protected] to enable GitOps for your account. GitOps is enabled for your whole account by default, but you can opt to enable GitOps per application and manage other applications using the Release UI.
- Add these two lines to your
.release.yamlfile:application_template: .release/application_template.yamlenvironment_variables: .release/environment_variables.yaml
- Check the
environment_variables.yamlfiles in to your
Figure 1. Both configuration files in the .release directory
Here's a simplified diagram of Release configuration relationships:
When you create an application, Release automatically creates a default Application Template and a default Environment Variables file. These files can be modified to include your application specifics.
Each time you create an environment for your application, Release will configure it using the Application Template and environment variables.
No configuration for any environment is stored in GitOps.
When you make changes to either the Application Template or the Environment Variables file, a new environment configuration is created and deployed.
If you have GitOps enabled, any changes you make to the configuration files are only updated from your repo, and no longer from the Release UI. It is possible, however, to set configuration immutable keys in the UI that GitOps would not be allowed to modify.
Whenever you modify and save an environment's configuration, the environment's configuration version number is incremented. The version number is made up of the version of the Application Template the environment was based on (the first digit), and the version of the environment-specific configuration currently deployed (the second digit). Changes to an environment's configuration will not change the first digit of an environment's version number. Saving an environment configuration file or environment variables file will change the second digit, incrementing the number by one.
In this diagram, you can see how different environments can be based on different Application Template versions:
When using GitOps, environment-specific configuration is automatically generated via a webhook processor that follows the workflow illustrated below.
With every push to your repository, Release runs this workflow to decide whether it should create new templates or configurations and whether it should deploy to any environments.
##check if the Release GitOps files are modified
#get the template from the repo
template_from_repo = app.template_from_repo
#loop through every app for this repo that matches the branch
repository.apps.with_branch(branch).each do |app|
##diff the template, if true, generate and save new templates
if diff(template_from_repo, app.previous_template)
#for every active environment for the repo that matches the branch
repository.active_environments.with_branch(branch).each do |env|
#transform app template to environment configuration
env_config = transform_app_template_to_env_config(env)
#if you want to deploy any matching envs, this setting must be true
GitOps allows you to have different environment configurations in different branches that can be merged back to your main branch. In the same way you work on features and bugs in branches, you can try new configurations by making changes to your Application Template and environment variables in branches. When you merge back to your main branch, your configuration changes will be included. GitOps automatically pushes and deploys configuration changes to your Release environments.