To build an integration test by using Argo, I used bash to run scripts and Jsonnet to orchestrate Argo workflow. As expected, I met a bunch of problems with them.

  1. problem about base64
[default]
aws_access_key_id = apple
aws_secret_access_key = banana

for this text file, we can use base64 to encode it and assign to an environment variable.

export MY=`cat my.ini |base64`
echo $MY|base64 -d

But it will report error ‘invalid input’:

[default]
aws_access_key_id = apple
aws_secret_access_keybase64: invalid input

The correct way is using -i, --ignore-garbage :

echo $MY|base64 -di

2. problem about exit status of Bash

If a step (or a pod) in Argo workflow failed, the whole workflow will fail. That’s the behaviour we want. But if we use diff command many times in one step, the fail (for diff, it means two files are not the same) of one diff will not cause the fail of the step. So I need a way to check the status of diff command. Fortunately, it’s very easy:

diff a b || exit -1
diff c d || exit -1

3. writes multiple lines of string in Jsonnet

local test_script = |||
  diff a b || exit -1
  diff c d || exit -1
|||;

...
  args = [test_script]