Source control management in YAML
DevOps as Code allows you to send source control information from the git repository in which a YAML template is maintained. This can be viewed in the Deploy or Release GUI, and helps to establish the relationship between the YAML files and your Release and Deploy instances, providing visibility into the specific file and commit from which a change was made.
This could be useful in a pipeline where you automate the synchronization of changes from DevOps as Code YAML files to Release or Deploy. Source control information will give you context and traceability to identify where your changes came from.
Limitation: Currently the feature only supports linking to git projects.
In xl apply, the flag -s, --include-scm-info
sends source control information to the application when the template is run. This option will add the current xl apply
meta information to every element which supports the feature.
Prerequisites
This feature requires you to keep your YAML DevOps as Code files in a git repository. It will inspect the directory and parent directories to see if a repository is present. If found it uses the local git information.
Release version control information
In Release, meta information is only supported for templates. To view the information for a template, select its context menu on the right side and click Meta information. This opens a screen which displays the following version control information about that item:
- Commit - Links to the git commit which was used to create or modify the item.
- Timestamp - Shows the timestamp for the commit.
- Committed By - Shows the name and email address of the user who made the commit.
- Summary - Shows the summary entered at the time of the commit.
- Source - Links to the remote repository of the files.
- File Name - Links to the YAML file in the repository which created or modified the item. This may be an external URL or a local file.
Deploy version control information
In Deploy, the context menu for each asset on the left menu has the option to view Meta information. Deploy supports all configuration items, but not other elements such as roles and permissions.
This option opens the same screen with the same information as in Release.
How do releases and data changes affect source control information?
If a release in Release is created from a template which has source control information attached, the template will still retain its meta information. Similarly with configuration items in Deploy.
However, if an item which was created from a YAML file is changed in the product, in any way apart from running xl apply
from a git repository, the item will lose its meta information since it no longer matches the repository.
Proceed-when-dirty flag
The flag -p
--proceed-when-dirty
forces xl apply
to not check if the repository is clean before committing the changes. If this flag is not used and there are uncommitted or un-pulled changes when applying with -s
, --include-scm-info
, you will receive an error such as the following:
Repository dirty and SCM info is required. Please commit all untracked and modified files before applying or use the --proceed-when-dirty flag to skip dirty checking. Aborting.
Dirty checking can be quite slow on large repositories, so using this flag can speed up the time to apply changes if you do not require a clean repository.