Playbook Configuration
The playbook can be configured to meet your needs. The configuration file is located in the playbook's root directory:
- Unix:
<playbook_root>/.aiop
in theplaybook
field - Windows:
<playbook_root>\.aiop
in theplaybook
field
<playbook_root>
is the root directory of the playbook.
Plugins can also provide additional configuration options. Please refer to the plugin documentation for more information. Contact technical support for any questions.
The configuration file is in YAML format. It can be edited with a text editor or code editor. It will then be read and verified by AIOP to customize the playbook.
Configuration File Structure
This configuration file is specific to your playbook. It contains information about plugins, remote repositories, custom validation rules, post-build scripts, and other customization options that may come from plugins.
playbook:
playbook_name: {playbook_name}
plugins:
- name: {plugin_name}
version: {plugin_version}
repositories:
- name: {repository_name}
instance: {instance_name}
type: {repository_type}
base_url: {repository_base_url}
repository_regex: {repository_regex}
lint_rules:
- classname: {rule_classname}
path: {rule_script_path}
post_scripts:
- classname: {script_classname}
path: {script_path}
Customization
To customize, simply open and modify the configuration file.
Name | Type | Description | Possible Values |
---|---|---|---|
playbook.playbook_name | str | Playbook name | By default, this will be the name of the playbook folder. |
playbook.plugins | list | List of plugins to use for the playbook. | name : Plugin name. version : Plugin version. |
playbook.plugins.name | str | Plugin name | |
playbook.plugins.version | str | Plugin version | |
playbook.repositories | list | List of remote repositories to use for the playbook. | name : Repository name. instance : Instance name. type : Repository type. base_url : Repository base URL. repository_regex : Regex to filter repositories. |
playbook.repositories.name | str | Repository name | |
playbook.repositories.instance | str | Instance name | |
playbook.repositories.type | str | Repository type | |
playbook.repositories.base_url | str | Repository base URL | |
playbook.repositories.repository_regex | str | Regex to filter repositories | |
playbook.lint_rules | list | List of validation rules to execute. | classname : Classname of the rule to execute during validation. path : Relative path to the script. |
playbook.lint_rules.classname | str | Classname of the rule to execute during validation. | |
playbook.lint_rules.path | str | Relative path to the script. | |
playbook.post_scripts | list | List of scripts to execute after the build. | classname : Classname of the rule to execute after the build. path : Relative path to the script. |
playbook.post_scripts.classname | str | Classname of the rule to execute after the build. | |
playbook.post_scripts.path | str | Relative path to the script. |
All these fields are optional.
playbook_name
The playbook_name
section is the name of the playbook. By default, this will be the name of the playbook folder.
plugins
The plugins
section is a list of plugins to use for the playbook. Each plugin must have a name and a version. You can have as many plugins as you like.
repositories
The repositories
section is a list of remote repositories to use for the playbook. You are not limited in the number of repositories. Each repository must have a name, an instance, a type, a base URL, and a regex. Here is an explanation of each field:
-
name
: The name of the repository. This name is used to identify the repository in declarations. -
instance
: The instance name corresponds to the parameter in the user configuration file. It is the instance of a remote repository that the playbook will use. -
type
: The type can currently beartifactory
ornexus
. -
base_url
: The base URL of the repository. For example, for an Artifactory repository, the base URL ishttps://artifactory.my-company.com/artifactory/
. -
repository_regex
: A regular expression to both validate that the path to the remote resource is correct and obtain additional data for processing during generation. For example, you might need to retrieve the version of the resource and its name and check that it is a Java application.jar
. In this case, you can use a regex to extract this information:(?<version>[0-9.]+)/(?<name>[a-zA-Z0-9-]+).jar
. You can then retrieve theversion
andname
values during package generation to use in yourpost_scripts
.
lint_rules
and post_scripts
The lint_rules
and post_scripts
sections are lists of rules to execute at package generation time. Each rule must specify the class name and the relative path from the project root to the script file.
Configuration Example
This configuration file can be challenging to set up, which is why we have created a sample inventory to help you get started. By default, AIOP will create it for you during project initialization.
playbook:
playbook_name: aiop-playbook
plugins:
- name: tesla-plugin
version: "0.2"
repositories:
- name: release
instance: artifactory-tesla-repo
type: artifactory
base_url: https://artifactory.tesla.com/artifactory/release/
repository_regex: (?<team>((sensors)|(driving)))/(?<version>[0-9.]+)/(?<name>[a-zA-Z0-9-]+).jar
- name: qa
instance: artifactory-tesla-repo
type: artifactory
base_url: https://artifactory.tesla.com/artifactory/qa/
repository_regex: (?<team>((sensors)|(driving)))/(?<version>[0-9.]+)/(?<name>[a-zA-Z0-9-]+).jar
lint_rules:
- classname: SnakeCaseRule
path: .aiop/rules/snake_case_rule.py
post_scripts:
- classname: ApplyPatch
path: .aiop/rules/apply_patch.py
Let's break it down:
playbook:
plugins:
- name: tesla-plugin
version: "0.2"
The playbook requires the plugin named tesla-plugin
with version 0.2
. Remember, you can have as many plugins as you want.
You must have the rights to access this plugin. If you don't, you can contact technical support for assistance.
playbook:
repositories:
- name: release
instance: artifactory-tesla-repo
type: artifactory
base_url: https://artifactory.tesla.com/artifactory/release/
repository_regex: (?<team>((sensors)|(driving)))/(?<version>[0-9.]+)/(?<name>[a-zA-Z0-9-]+).jar
- name: dev
instance: artifactory-tesla-repo
type: artifactory
base_url: https://artifactory.tesla.com/artifactory/dev/
repository_regex: (?<team>((sensors)|(driving)))/(?<version>[0-9.]+)/(?<name>[a-zA-Z0-9-]+).jar
There are two remote repositories in this example. The first is release
and the second is dev
. In our case, release
stores production resources, and dev
stores development resources. It is the same remote repository, hence the same instance. The type is artifactory
because it is a repository using the Artifactory solution. The base URL is https://artifactory.tesla.com/artifactory/release/
for the first and https://artifactory.tesla.com/artifactory/dev/
for the second. The regex extracts information about the team responsible for the resource, its version, and its name.
playbook:
lint_rules:
- classname: SnakeCaseRule
path: .aiop/rules/snake_case_rule.py
The SnakeCaseRule
rule is defined in the file .aiop/rules/snake_case_rule.py
. In this example, this rule checks that file names are in snake_case.
playbook:
post_scripts:
- classname: ApplyPatch
path: .aiop/rules/apply_patch.py
The ApplyPatch
script is defined in the file .aiop/rules/apply_patch.py
. In this example, this script applies a patch to the generated package.
Ignoring Files
It is possible to ignore files in the playbook. To do this, create a .amlignore
file at the root of the playbook. This file follows the same syntax as the .gitignore
file. For example, to ignore all files with the .jar
extension:
*.jar
Or all files in the target
directory:
target/