<p>I have an OpenShift/Tekton pipeline which in <code>Task A</code> deploys an application to a test environment. In <code>Task B</code>, the application's test suite is run. If all tests pass, then the application is deployed to another environment in <code>Task C</code>.</p>
<p>The problem is that <code>Task A</code>'s pod is deployed (with <code>oc apply -f &lt;deployment&gt;</code>), and before the pod is actually ready to receive requests, <code>Task B</code> starts running the test suite, and all the tests fail (because it can't reach the endpoints defined in the test cases).</p>
<p>Is there an elegant way to make sure the pod from <code>Task A</code> is ready to receive requests, before starting the execution of <code>Task B</code>? One solution I have seen is to do HTTP GET requests against a health endpoint until you get a HTTP 200 response. We have quite a few applications which do not expose HTTP endpoints, so is there a more &quot;generic&quot; way to make sure the pod is ready? Can I for example query for a specific record in <code>Task A</code>'s log? There is a log statement which always shows when the pod is ready to receive traffic.</p>
<p>If it's of any interest, here is the definition for <code>Task A</code>:</p>
<pre><code>apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: create-and-deploy-integration-server
spec:
  params:
    - name: release-name
      type: string
      description: The release name of the application
    - name: image-name
      type: string
      description: The name of the container image to use
    - name: namespace
      type: string
      description: The namespace (OCP project) the application resides in
    - name: commit-id
      type: string
      description: The commit hash identifier for the current HEAD commit
  steps:
    - name: create-is-manifest
      image: image-registry.openshift-image-registry.svc:5000/openshift/origin-cli
      script: |
        echo &quot;Creating IntegrationServer manifest&quot;
        cat &lt;&lt; EOF &gt; integrationserver.yaml
        apiVersion: appconnect.ibm.com/v1beta1
        kind: IntegrationServer
        metadata:
          name: $(params.release-name)
          namespace: $(params.namespace)
        spec:
          license:
            accept: true
            license: L-KSBM-BZWEAT
            use: CloudPakForIntegrationNonProduction
          pod:
            containers:
              runtime:
                image: image-registry.openshift-image-registry.svc:5000/$(params.namespace)/$(params.image-name)-$(params.commit-id)
                imagePullPolicy: Always
                resources:
                  limits:
                    cpu: 500m
                    memory: 500Mi
                  requests:
                    cpu: 300m
                    memory: 300Mi
          adminServerSecure: true
          router:
            timeout: 120s
          designerFlowsOperationMode: disabled
          service:
            endpointType: http
          version: 11.0.0.11-r2
          replicas: 1
          barURL: ''
        EOF
    - name: deploy-is-manifest
      image: image-registry.openshift-image-registry.svc:5000/openshift/origin-cli
      script: |
        echo &quot;Applying IntegrationServer manifest to OpenShift cluster&quot;
        oc apply -f integrationserver.yaml
</code></pre>

<p>After your <em>step</em> that do <code>oc apply</code>, you can add a step to wait for the deployment to become &quot;available&quot;. This is for <code>kubectl</code> but should work the same way with <code>oc</code>:</p>
<pre><code>kubectl wait --for=condition=available --timeout=60s deployment/myapp
</code></pre>
<p>Then the next Task can depend on this Task with <code>runAfter: [&quot;create-and-deploy-integration-server&quot;]</code></p>
