With Release you can use our UI to manage your Application Template and Environment Configurations along with corresponding environment variable files. But, Release also supports managing these configuration files in your Git repository. The requirements to use GitOps with Release are:
GitOps must be enabled for your application, please contact [email protected] to enable it
You need to add two lines to your .release.yaml file
application_template: .release/application_template.yamlenvironment_variables: .release/environment_variables.yaml
You have two files (application_template.yaml and environment_variables.yaml) checked-in to your .release directory.
Once these two requirements are met you will be able to manage your Release configurations via Git.
When you create an application in Release we automatically create the first template for you. Every time an environment is created in Release for your application, this template will be used to generate the first configuration for that particular environment. There is also a Default Environment Variable file for the Application Template. These are both templates and used when the first Environment Configuration is created.
Whenever an environment is created the Application Template is used to generate the first Environment Configuration. The major number is based on the version of the Application Template and the minor number is the version of the Environment Configuration. The major number of the Environment Configuration never changes. Release does not merge changes from the Application Template into your Environment Configurations.
When using GitOps with Release the creation of the specific Environment Configurations is done automatically via a webhook processor that follows the workflow below in Figure 4. Any time you push to your repository, Release runs this workflow to decide if it should create new templates and/or configs, and ultimately should it deploy to any environments.
##check if the Release GitOps files are modifiedif release_files_modifies#get the template from the repotemplate_from_repo = app.template_from_repo#loop through every app for this repo that matches the branchrepository.apps.with_branch(branch).each do |app|previous_template = app.previous_template##diff the template, if true, generate and save new templatesif diff(template_from_repo, previous_template)generate_new_templates(app).saveendend#for every active environment for the repo that matches the branchrepository.active_environments.with_branch(branch).each do |env|#transform app template to environment configurationenv_config = transform_app_template_to_env_config(env)env_config.save#if you want to deploy any matching envs, this setting must be trueif should_deploy_active_envs_that_track_branch_with_config_change?deploy_env(env)endendend
On every push to your repository, Release checks to see if there are any changes to the Release gitops files and reacts accordingly. This allows you to make changes to your templates on branches and merge the changes back to your main branch. In the same way you can work on your code in branches, you can do the same with your templates and environment variables.