@@ -269,28 +269,25 @@ EOF
269
269
fi
270
270
271
271
272
- # check the container related `driver` value(s).
273
- # scan entire complex project JSON for any key named `Driver` and write to a file
274
- nomad run -output -var-file=env.env project.hcl | jq ' .. | .Driver? | select(. != null)' > | drivers.txt
275
- # there should be exactly one of these drivers in the HCL
276
- NUM=$( grep -icE ' ^"DRIVER_SET_AT_RUNTIME"$' drivers.txt | cat)
277
- if [ " $NUM " -ne 1 ]; then echo ' bad drivers setup' ; exit 1; fi
272
+ if [ " $NOMAD_TOKEN " = test ]; then
273
+ nomad run -output -var-file=env.env project.hcl > | project.json
274
+ exit 0
275
+ fi
276
+
277
+
278
+ # check the `driver` value for all specified containers.
279
+ # scan entire complex project JSON for any key named `Driver` and write to a file.
280
+ nomad run -output project.hcl | jq ' .. | .Driver? | select(. != null)' > | drivers.txt
278
281
# there should be 1+ of either of these drivers in the HCL
279
282
NUM=$( grep -icE ' ^"(docker|podman)"$' drivers.txt | cat)
280
- if [ " $NUM " -lt 1 ]; then echo ' drivers not located?' ; exit 1; fi
281
- # there should be 0 of either of these drivers in the HCL
283
+ if [ " $NUM " -lt 1 ]; then echo ' drivers not found?' ; exit 1; fi
284
+ # there should be 0 of either of these drivers in the HCL.
285
+ # NOTE: the `raw_exec` driver used only for secrets isn't in the `drivers.txt` list since we did
286
+ # *NOT* use `-var-file=env.env` (so the entire kv related `task` gets removed in `nomad run`).
282
287
NUM=$( grep -icE ' ^"(exec|raw_exec)"$' drivers.txt | cat)
283
288
if [ " $NUM " -ne 0 ]; then echo ' bad drivers in project' ; exit 1; fi
284
289
rm drivers.txt
285
290
286
- # Now swap in the 'raw_exec' driver for the 'kv' task
287
- sed -ix ' s/driver = "DRIVER_SET_AT_RUNTIME"/driver = "raw_exec"/' project.hcl
288
-
289
-
290
- if [ " $NOMAD_TOKEN " = test ]; then
291
- nomad run -output -var-file=env.env project.hcl > | project.json
292
- exit 0
293
- fi
294
291
295
292
set -x
296
293
nomad validate -var-file=env.env project.hcl
0 commit comments