Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing a fooling mistake #275

Merged
merged 4 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bitops.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bitops:
filename: bitops-run # log filename
err: bitops.logs # error logs filename
path: /var/logs/bitops # path to log folder
opsrepo_root_default_dir: _default
default_folder: _default

# https://bitovi.github.io/bitops/plugins/#bitopsconfigyaml
plugins: {}
Expand Down
18 changes: 17 additions & 1 deletion docs/migration/2.0.0-migration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Bitops Core

## Environment Variables
### ENVIRONMENT
Bitops is no longer using the `ENVIRONMENT` value, it instead uses; `BITOPS_ENVIRONMENT`

Easiest migration solution;
Expand All @@ -12,6 +13,9 @@ docker run \
bitovi/bitops:latest
```

### DEFAULT_FOLDER
You can now control the default folder name with the environment variable `BITOPS_DEFAULT_FOLDER`

### New Prefixes
BitOps core exported environment variables now have a prefix of `BITOPS_`

Expand All @@ -21,6 +25,7 @@ BitOps core exported environment variables now have a prefix of `BITOPS_`


# Tool-level BitOps configs (i.e. bitops.config.yaml) in Operations Repo environments
## stack-action
ops_repo level bitops.config.yaml have had one important update; The cli attribute "stack-action" has been added. This attribute is used to tell the BitOps plugin which method it is invoking.

For example, the terraform plugin, has 3 stack-actions;
Expand All @@ -44,9 +49,20 @@ terraform:
```

**Reasoning for the change**

This pattern is used by BitOps to standardize how a plugin specifies an action

## default_folder
New attribute added to bitops.config.yaml to define the default folder name. This attribute is evaluated when building a bitops custom image.

**New method**
```
bitops:
default_folder: _default
```

**Reasoning for the change**
This provides more control to the bitops image builder.


# Plugins
## Ansible
Expand Down
2 changes: 1 addition & 1 deletion docs/operations-repo-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Sometimes it is useful to have directories in your operations repo that are not

BitOps allows you to name your environment directories whatever you want. However, to better reason about which directories are environments and which aren't, a good convention is to prefix any non-deployable-environment directory with an underscore (e.g. `_scripts` or `_terraform`).

The directory `_default` is special in BitOps. This directory is merged into your enviroment directory before deployment.
The directory `_default` is special in BitOps. This directory is merged into your environment directory before deployment. You can control the default folder name through an environment variable `BITOPS_DEFAULT_FOLDER` or through a bitops configuration attribute `bitops.default_folder`.

#### Tool directories
Within an environment directory are tool directories which group supported tools by name. Each of these directories is optional. For example, if your application only requires `terraform/` to execute, you do not need an `ansible/`, `cloudformation/` or `helm/` directory in your environment.
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ bitops:
filename: bitops-run # log filename
err: bitops.logs # error logs filename
path: /var/logs/bitops # path to log folder
opsrepo_root_default_dir: _default
default_folder: _default
plugins:
aws:
source: https://github.com/bitops-plugins/aws
Expand Down
2 changes: 1 addition & 1 deletion prebuilt-config/aws-ansible/bitops.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bitops:
filename: bitops-run # log filename
err: bitops.logs # error logs filename
path: /var/logs/bitops # path to log folder
opsrepo_root_default_dir: _default
default_folder: _default
plugins:
aws:
source: https://github.com/bitops-plugins/aws
Expand Down
2 changes: 1 addition & 1 deletion prebuilt-config/aws-helm/bitops.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bitops:
filename: bitops-run # log filename
err: bitops.logs # error logs filename
path: /var/logs/bitops # path to log folder
opsrepo_root_default_dir: _default
default_folder: _default
plugins:
aws:
source: https://github.com/bitops-plugins/aws
Expand Down
2 changes: 1 addition & 1 deletion prebuilt-config/aws-terraform/bitops.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bitops:
filename: bitops-run # log filename
err: bitops.logs # error logs filename
path: /var/logs/bitops # path to log folder
opsrepo_root_default_dir: _default
default_folder: _default
plugins:
aws:
source: https://github.com/bitops-plugins/aws
Expand Down
2 changes: 1 addition & 1 deletion prebuilt-config/example-plugin/bitops.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bitops:
filename: bitops-run # log filename
err: bitops.logs # error logs filename
path: /var/logs/bitops # path to log folder
opsrepo_root_default_dir: _default
default_folder: _default
plugins:
example-plugin:
source: https://github.com/bitops-plugins/example-plugin
Expand Down
2 changes: 1 addition & 1 deletion prebuilt-config/omnibus/bitops.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bitops:
filename: bitops-run # log filename
err: bitops.logs # error logs filename
path: /var/logs/bitops # path to log folder
opsrepo_root_default_dir: _default
default_folder: _default
plugins:
aws:
source: https://github.com/bitops-plugins/aws
Expand Down
5 changes: 1 addition & 4 deletions scripts/plugins/deploy_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def Deploy_Plugins():
#~#~#~#~#~#~# STAGE 1 - ENVIRONMENT LOADING #~#~#~#~#~#~#
# Temp directory setup
temp_dir = tempfile.mkdtemp()
bitops_default_dir_configuration = DefaultMunch.fromDict(bitops_build_configuration.bitops.opsrepo_root_default_dir, None)
bitops_deployment_configuration = DefaultMunch.fromDict(bitops_build_configuration.bitops.deployments, None)

bitops_dir = "/opt/bitops"
Expand Down Expand Up @@ -49,7 +48,7 @@ def Deploy_Plugins():
os.environ["BITOPS_FAIL_FAST"] = str(BITOPS_fast_fail_mode)
os.environ["BITOPS_KUBE_CONFIG_FILE"] = "{}/.kube/config".format(temp_dir)
os.environ["PATH"] = PATH
os.environ["BITOPS_DEFAULT_ROOT_DIR"] = bitops_default_dir_configuration
os.environ["BITOPS_DEFAULT_ROOT_DIR"] = BITOPS_default_folder

# Global environment evaluation
if BITOPS_ENV_environment is None:
Expand Down Expand Up @@ -79,7 +78,6 @@ def Deploy_Plugins():
\n\t BITOPS_ENVROOT_DIR: [{bitops_envroot_dir}] \
\n\t BITOPS_OPERATIONS_DIR: [{bitops_operations_dir}] \
\n\t BITOPS_SCRIPTS_DIR: [{bitops_scripts_dir}] \
\n\t BITOPS_DEFAULT_ROOT_DIR: [{bitops_default_dir_configuration}] \
\n#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~# \n \
".format(
temp_dir=temp_dir,
Expand All @@ -93,7 +91,6 @@ def Deploy_Plugins():
bitops_envroot_dir=bitops_envroot_dir,
bitops_operations_dir=bitops_operations_dir,
bitops_scripts_dir=bitops_scripts_dir,
bitops_default_dir_configuration=bitops_default_dir_configuration,
))
# Loop through deployments and invoke each
#~#~#~#~#~#~# STAGE 2 - PLUGIN LOADING #~#~#~#~#~#~#
Expand Down
4 changes: 2 additions & 2 deletions scripts/plugins/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
BITOPS_ENV_logging_level = os.environ.get("BITOPS_LOGGING_LEVEL")
BITOPS_ENV_plugin_dir = os.environ.get("BITOPS_PLUGIN_DIR")

BITOPS_ENV_default_folder = os.environ.get("BITOPS_DEFAULT_FOLDER_NAME")
BITOPS_ENV_default_folder = os.environ.get("BITOPS_DEFAULT_FOLDER")
BITOPS_ENV_environment = os.environ.get("BITOPS_ENVIRONMENT", None)
BITOPS_ENV_timeout = os.environ.get("BITOPS_TIMEOUT")

Expand Down Expand Up @@ -88,7 +88,7 @@
if BITOPS_ENV_default_folder is not None \
else bitops_build_configuration.bitops.default_folder \
if bitops_build_configuration.bitops.default_folder is not None \
else "default"
else "_default"

BITOPS_timeout = BITOPS_ENV_timeout \
if BITOPS_ENV_timeout is not None \
Expand Down