latest--rev.022
shared| Type | object |
|---|---|
| Schema URL | https://catalog.lintel.tools/schemas/schemastore/ops-yaml/_shared/latest--rev.022.json |
| Parent schema | ops-yaml |
Configuration for ops.
revision: ...
min_version: ...
forwards: ...
dependencies: ...
hooks: ...
actions: ...
options: ...
Properties
A collection of commands to run via ops. If the first argument to ops is not a builtin, ops will look for an action with that name.
For more information, see the Actions documentation on GitHub.
{
"<action>": "<command>"
}
Dependencies listed in the dependencies section of ops.yml are satisfied when the ops up command is run. Some dependencies will be un-satisfied when you run ops down; e.g. services will be stopped, but packages won't be uninstalled.
This feature allows developers that are new to a project to get up and running without knowing anything about the app itself. Your ops.yml should allow a developer to ops up && ops start to run an application.
For more information, see the Dependencies documentation on GitHub.
10 nested properties
- Specifies that a particular
brewpackage is needed. - Will only run if you're on a Mac.
- Specifies that a particular
brew caskpackage is needed. - Will only run if you're on a Mac.
- Runs the given command.
- Can't tell if the command needs to be run or not, so always runs it on
ops up. - Therefore, the command should be idempotent.
- It's also a good idea to prevent it from printing output unless it encounters an error, to keep the ops output clean.
Sometimes a project is complex enough to split up into multiple directories. In this case, you may have ops.yml files in several places, but still want to provide easy access to these actions from the top-level directory.
With this config, ops app test will have the same effect as running ops test from the app directory. ops inf deploy will be the same as cd infrastructure && ops deploy.
When a command is forwarded to another directory, no config, secrets, or environment variables are set based on the current directory's ops.yml, and no hooks are run from the current directory's ops.yml.
If you want access to the top-level directory's config or secrets from the subdirectory, link it in the subdirectory's ops.yml:
dependencies:
custom:
- ln -sf ../config config
For more information, see the Forwards documentation on GitHub.
Sometimes you want to run a command before other commands. Some examples:
- You have a number of ops commands that let a developer run different test suites inside a container, and you want to make sure the container image is built beforehand.
- You have some configuration that needs to happen when the software execution environment changes (e.g. going from
devtostaging).
In this case, you can use the hooks feature.
For more information, see the Hooks documentation on GitHub.
1 nested properties
A series of hooks that run before actions. They do not run before builtins like up or exec.
before hooks are always executed before secrets are loaded. If you would like a before hook to have access to secrets, create an action with load_secrets: true and call the action from a before hook.
Options allow the user to change some aspects of ops behaviour.
For more information, see the Options documentation on GitHub.
10 nested properties
Affect the behaviour of apt dependencies.
{
"use_sudo": false
}
1 nested properties
If false, causes ops up to install the dependency's packages without sudo.
Affect the behaviour of the background builtin.
{
"log_filename": "app.log",
"shell": "/bin/sh"
}
3 nested properties
Affect how configs are interpreted.
1 nested properties
Affect the behaviour of ops envdiff.
{
"ignored_keys": [
"backend_config_params"
]
}
Statically or dynamically set global environment variables, with each key serving as a variable's name.
NOTE: The values of these variables are not interpreted by the shell before being set, so variable references like
$environmentwill appear literally in the value of the variable.
{
"PATH": "./bin:${PATH}"
}
Different software systems use different environment variables to determine the software execution environment. E.g. Ruby on Rails uses RAILS_ENV. Thus, ops allows the user to specify which variables should also be set to the name of the software environment.
If any environment_aliases are specified in ops.yml, ops will not change the value of $environment unless it is listed as well.
NOTE:
opswill always use$environmentto detect the software execution environment;environment_aliasesjust makesopsset other variables to match it.
Affect the behaviour of ops exec.
1 nested properties
If true, items in secrets.ejson will be loaded before execution, allowing said items to be referenced in the configuration.
Affect the behaviour of gem dependencies.
{
"user_install": true,
"use_sudo": false
}
2 nested properties
If true, causes ops up to run gem install --user-install ejson.
If false, causes ops up to install the dependency's packages without sudo.
Affect how secrets are interpreted.
1 nested properties
Affect how SSH keys are generated.
{
"passphrase": "p@ssw0rd",
"key_size": 4096
}
6 nested properties
If false, disables adding the SSH key to ssh-agent.
The duration, in seconds, at which the SSH key will be removed from ssh-agent.
The size at which the SSH key will be generated.
NOTE: With the
ed25519algorithm,key_sizecan still be specified, but will be ignored byssh-keygen, since all keys for that algorithm are 256 bits.
A passphrase to generate the SSH key with.
The name of an environment variable containing the passphrase to generate the SSH key with.
Definitions
If true, items in secrets.ejson will be loaded before execution, allowing said items to be referenced in the configuration.
The name of a brew package. If you need to specify a version, include it after the name, delimited by an @ symbol.
"ruby""openssl@"
The name of a pip package. If you need to specify a version, include it after the name, delimited by ==.
"semver""ruamel.yaml==0.17.26"
The name of a package. If you need to specify a version, include it after the name, delimited by a space.
"ruby""openssl 0.8.0"
If false, causes ops up to install the dependency's packages without sudo.