* FEATURE: add --tags and --skip-tags options
Allow config manifests to be tagged, so a pups run can apply a subset of run commands.
Update to ruby 3.2.
Lots of linting. Added rubocop lint exception for Eval.
Fixing test imports, update MiniTest::Test -> Minitest::Test.
The --gen-docker-env-args argument makes pups process any template
environment variables and generate the command line arguments suitable
for the docker run command. The intention is to expand support for
configuring container runtime into pups such that configuration
templates can be more generally useful.
Bash special characters are safely escaped. This prevents issues where
variables contain special characters that are parsed by the calling shell.
A script which uses the pups output may have unexpected side effects
without escaping the special characters.
Note that only `env`, `label`, and `volume` config variables are escaped
as these are the most likely to contain special chacters. No attempt is
made to validate config variables against the allowed characters by
docker itself.
Other changes:
- Change some exit calls to return to prevent the tests prematurely
exiting.
There are use cases where we may want pups to ignore particular
configuration elements at runtime. For example, we may want to skip over
hooks in certain circumstances or define environment variables via the
process at runtime that are already defined in a template.
The follow example demonstrates the usage (note the last log line):
```
$ cat /tmp/test.yml
env:
MY_VAR: a_word
run:
- exec: 'echo repeating $MY_VAR'
$ bin/pups --ignore env /tmp/test.yml
I, [2021-06-09T12:03:46.864770 #30369] INFO -- : Reading from /tmp/test.yml
I, [2021-06-09T12:03:46.865009 #30369] INFO -- : > echo repeating $MY_VAR
I, [2021-06-09T12:03:46.865824 #30369] INFO -- : repeating
$ bin/pups /tmp/test.yml
I, [2021-06-09T12:03:50.694739 #30380] INFO -- : Reading from /tmp/test.yml
I, [2021-06-09T12:03:50.694980 #30380] INFO -- : > echo repeating $MY_VAR
I, [2021-06-09T12:03:50.695730 #30380] INFO -- : repeating a_word
```
This will become more useful once the docker run argument generation
functionality is implemented. For example, options like `expose` may
want to be ignored if pups is being used to generate runtime arguments
for more the one container on the same machine (as published port numbers
cannot overlap between containers). Without the `--ignore` lever, all
runtime arguments will be produced all the time which limits use cases.
Templated variables can be used to parameterise container creation. This
will ensure any ENV variables are templated during config initialisation
prior to any use.
There are situations where we want to provide and config template at
runtime rather than ahead-of-time. This adds support for specifying such
a variable via the process environment, prefixed with
env_template_<name>=value.
This reverts commit 262d7eb4f8 and 8f353a3778
discourse_docker's launcher, and potentially other systems, manipulate environment variables before applying them to a `docker run` command. At the moment, those tools do not necessarily apply those same manipulations to the YAML file passed to pups.
Specifically, in discourse_docker's launcher, the string `{{config}}` in container labels or environment variables is substituted with the filename of the YAML file. Launcher does not perform this replacement on the file passed to pups. Previously, that was not an issue, because pups didn't use the `env` or `labels` from the file. Now, it causes pups to run its setup using incorrect environment variables.
Reverting this until:
- We update discourse_docker's launcher so that it performs the replacement on the YAML file passed to pups
- We come up with a way to avoid breaking old discourse_docker installs (right now they use the latest `master` version of discourse/pups on every build)
Variables specified under the `env` property in the root of the yaml
configuration file will now be set in the pups environment during the
initialization process. Any existing environment variables are
overwritten by matching variables specified in the config `env` property.
The integration test was updated to exercise the params and env
codepath as this covers the new functionality.