<p>I'm running some stresses tests in cluster. I compile Gatling code in a jar and run it in a dockerized environment. Likewise, I was wondering if there is a way to upload the final Gatling report to S3. There is <code>after</code> hook in Gatling simulation class, but I think this is getting executed before the report is generated.</p>

Ahmad.Masood
<p>An easy way I can think to do this without changing even the gatling code or the jar, is to simply:</p>
<ul>
<li>Make the docker container running the tests run as an init container</li>
<li>After the init container had run, a main container starts and can do the s3 upload, either with bash commands or with whatever (example, with tinys3 - <a href="https://github.com/smore-inc/tinys3" rel="nofollow noreferrer">https://github.com/smore-inc/tinys3</a> )</li>
</ul>
<p>Just a general example:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  labels:
    app.kubernetes.io/instance: gatling-stress-test
    app.kubernetes.io/name: gatling-stress-test
  name: gatling-stress-test
spec:
  initContainers:
  - name: gatling-stress-test-runner
    image: gatling-docker-image:latest
    imagePullPolicy: Always
    volumeMounts:
    - mountPath: /full/path/to/gatling/reports
      name: reports
  containers:
  - name: stress-test-s3-copier
    image: ubuntu-image-with-tinys3:latest
    imagePullPolicy: Always
    volumeMounts:
    - mountPath: /full/path/to/gatling/reports
      name: reports
  volumes:
  - emptyDir: {}
    name: reports
</code></pre>
