Commit Graph

5 Commits

Author SHA1 Message Date
Jeff Wong d51da1fc1d
FEATURE: add --tags and --skip-tags options (#28)
* 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.
2023-10-22 17:42:24 -07:00
Michael Fitz-Payne 193242003d
FEATURE: Support generating docker cli arguments. (#22)
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.
2021-06-15 16:14:21 +10:00
Michael Fitz-Payne ebe1069395 Add --ignore option for specific config elements. (#26)
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.
2021-06-10 09:02:49 +10:00
Michael Fitz-Payne 2069d66f39
Add lint step to CI, fix all lint issues. (#24)
The fixes were performend rubocop -A functionality for autocorrecting.
The linting is enforced according to the rubocop-discourse rules.
2021-06-03 12:22:29 +10:00
Michael Fitz-Payne f9af90d645
cli: update option parsing to OptionParser. (#21)
Change to proper argument handling in preparation of adding
new command-line arguments to the pups CLI.

Tests added arguments parsing and also for when a file is
specified (not stdin).
2021-05-20 08:46:21 +10:00