<p>I have 2 preinstall scripts that should run sequentially.
They have obviously different weights
The second script must have the first one to finish running.
Is there anyway to make helm support this behavior?</p>

<p>And also for bonus point can you make a pre-install hook to block till the object becomes ready?</p>

<p><strong>The scenario is as follows:</strong></p>

<p>You have a database, and an application. </p>

<p>The setup is:</p>

<ol>
<li>create a database (deployment),</li>
<li>create a database (service),</li>
<li>ran a script that creates all the database users on that db (job)</li>
<li>start the application server (deployment).</li>
</ol>

<p>First, you need to set the <a href="https://helm.sh/docs/charts_hooks/#writing-a-hook" rel="nofollow noreferrer">hook weights</a> properly. E.g:</p>

<pre><code>  annotations:
    "helm.sh/hook-weight": "5"
</code></pre>

<blockquote>
  <p>Hook weights can be positive or negative numbers but must be
  represented as strings. When Tiller starts the execution cycle of
  hooks of a particular kind (ex. the <code>pre-install</code> hooks or <code>post-install</code>
  hooks, etc.) it will sort those hooks in ascending order.</p>
</blockquote>

<p>According to the <a href="https://helm.sh/docs/charts_hooks/#hooks-and-the-release-lifecycle" rel="nofollow noreferrer">Hooks and release lifecycle</a>, by default, the Tiller waits until a hook becomes “Ready” before executing the next ones. The catch is: When dealing with scripts managed by hooks, you need to create the resource as a <code>Job</code>:</p>

<blockquote>
  <p>What does it mean to wait until a hook is ready? This depends on the
  resource declared in the hook. If the resources is a Job kind, Tiller
  will wait until the job successfully runs to completion. And if the
  job fails, the release will fail. <strong>This is a <em>blocking operation</em></strong>, so the
  Helm client will pause while the Job is run.</p>
</blockquote>

<p>If you want to run jobs that depend on the database or application to be Ready, it's better to use the hooks as <code>post-install</code>, combined with the <a href="https://helm.sh/docs/using_helm/#helpful-options-for-install-upgrade-rollback" rel="nofollow noreferrer"><code>--wait</code></a> flag. When this flag is set, Tiller will wait until all release resources are deployed and in a ready state and will not run the <code>post-install</code> hook until they are ready.</p>
