keptn-sandbox / k6-service

Keptn Service for running K6 as load testing tool.
MIT License
7 stars 1 forks source link

Does Job Executor Service support multiple commands? #8

Closed agardnerIT closed 1 year ago

agardnerIT commented 2 years ago

@ppcano mentioned using the JES to first build a k6 binary with extensions using xk6 then running that binary.

Does the Keptn Job Executor Service support running something like this:

xk6 build --with github.com/grafana/xk6-browser && k6 run ....
jainammm commented 2 years ago

No, it probably doesn't... tried to run a simple echo followed by k6 run command but it failed it took the whole command as arguments to echo

Config File

apiVersion: v2
actions:
  - name: "Run k6"
    events:
      - name: "sh.keptn.event.test.triggered"
    tasks:
      - name: "Run k6 with Keptn"
        files:
          - /files
        image: "loadimpact/k6"
        # cmd: ["sh"]
        # args: ["/keptn/files/execution.sh", "&&", "ls" ]
        cmd: ["echo"]
        args: ["jainam-log", "&&", "k6", "run", "--duration", "30s", "--vus", "10", "/keptn/files/k6_test.js"]

JES logs

image
jainammm commented 2 years ago

Tried using a shell script for running multiple commands

image

I got the following output from JES

image

This is the config.yaml file of that service

image

The shell script failed, but JES didn't give any error.

agardnerIT commented 2 years ago

The shell script didn't fail. All commands ran and it exited correctly. One command in the shell script failed.

By default JES mounts as a read only filesystem for most directories (for security). Try writing into the /keptn folder instead.

image

jainammm commented 2 years ago

okay, i will test it out 👍

agardnerIT commented 1 year ago

I think this can be closed. What do you think jainammm?

Summary:

  1. Job Executor Service supports multiple commands - you need to create a shell / python script and execute that.
  2. As long as the python / shell / whatever script (or more generally the process or container that JES executes) exits with a 0 exit code, the Keptn task will be considered as a pass. If the JES job exits with a non-zero exit code, this is interpreted as a fail.
jainammm commented 1 year ago

yes, this summary sums up this exercise 💯 thanks!