This diff introduces a new bash directive, it executes given command in
subprocess. Stdout of executed command is exportable in formula.
If we want to use this directive as main check of the task, @kparal suggested
that we should introduce a tool for generating results yaml. A simple script or
shell function that from passed arguments creates a output we understand.
Also we need to discuss how to pass the test output from executed command or
script other than stdout. Almost every command in shell prints something to
stdout and thus bloats the output (which should contain only results yaml at
the moment).
Here is example how it works now, the task pulls httpd docker image, runs
container and tries curl localhost (the example is little too verbose,
all the bash command would probably end in test.sh file):
name: test httpd docker image environment: rpm: - docker actions: - bash: command: systemctl start docker - bash: command: docker pull httpd - bash: command: docker run -d -p 80:80 --name docker_test_httpd httpd - bash: command: sh test.sh export: test_output - bash: command: docker rm -f docker_test_httpd - name: report resultsdb: results: ${test_output}
The file test.sh contains:
#!/bin/bash { #wait for container to start sleep 1s #test it curl localhost outcome=$? } &> /dev/null cat << EOF results: - item: httpd type: docker_image outcome: $([ "$outcome" == 0 ] && echo "PASSED" || echo "FAILED") EOF