Answers: <p>I think what you are looking for is lifecycle hooks.</p>
  
  <p><a href="https://kitchen.ci/docs/reference/lifecycle-hooks/" rel="nofollow noreferrer">https://kitchen.ci/docs/reference/lifecycle-hooks/</a></p>
  
  <p>For example, you could have this in you kitchen.yml file.</p>
  
  <pre><code>
  suites:
  - name: default
    lifecycle:
      post_verify:
      - local: &lt;script&gt;
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2022-02-17T23:39:35.677Z
Answers: Sorry so late in accepting answer, I suppose I lost track of this. :)
Answers: Chaim Eliyah
Answers: CC BY-SA 4.0
Answers: 2019-11-20T23:19:21.457Z
Answers: 2019-11-20T23:19:21.457Z
Answers: Paul B
Body: <p>I've got a Chef repo that uses test-kitchen. I have a pretty good battery of tests, and when I run the tests and they're successful, I have a <code>vendor.sh</code> script that does some cleanup and a Berks vendor. What I'd like to be able to do is automatically run that script. I suppose I could just put <code>kitchen test {box}</code> into that script, but then I'd have to find a way to detect success (maybe this is easy) and deal with output and things like that; I'd rather just have Kitchen do it. </p>
  
  <p>I googled and searched and found nothing. Does anyone know a way?</p>
  
Comments: CC BY-SA 4.0
Comments: 2019-11-18T22:47:14.373Z
Comments: Why is this downvoted? It's a perfectly legitimate question: How do you execute a script at the end of a Kitchen CI run? Every non-CM CI tool in the world supports this.
Comments: Chaim Eliyah
Comments: CC BY-SA 4.0
Comments: 2022-02-11T15:01:36.247Z
Comments: FTR `kitchen test` does exit with non 0 status if there was a failure.
Comments: Tensibai
Tags: <chef><inspec>
Title: How to have Kitchen CI run a script on success?
UserDisplayName: Chaim Eliyah
ThreadText: # How to have Kitchen CI run a script on success?
  
  (Asked by: username_0 on 2019-10-05)
  
  I've got a Chef repo that uses test-kitchen. I have a pretty good battery of tests, and when I run the tests and they're successful, I have a `vendor.sh` script that does some cleanup and a Berks vendor. What I'd like to be able to do is automatically run that script. I suppose I could just put `kitchen test {box}` into that script, but then I'd have to find a way to detect success (maybe this is easy) and deal with output and things like that; I'd rather just have Kitchen do it.
  
  I googled and searched and found nothing. Does anyone know a way?
  
  **Tags:** chef, inspec
  
  > **Comments:**
  > **username_0**: Why is this downvoted? It's a perfectly legitimate question: How do you execute a script at the end of a Kitchen CI run? Every non-CM CI tool in the world supports this.  
  > **username_1**: FTR `kitchen test` does exit with non 0 status if there was a failure.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2019-11-20. Score: 3 | Accepted answer
  
  I think what you are looking for is lifecycle hooks.
  
  <https://kitchen.ci/docs/reference/lifecycle-hooks/>
  
  For example, you could have this in you kitchen.yml file.
  
  ```
  
  suites:
  - name: default
    lifecycle:
      post_verify:
      - local: <script>
  
  ```
  
  > **Comments:**
  > **username_0**: Sorry so late in accepting answer, I suppose I lost track of this. :)  
  
  ---
  
  