skaffold icon indicating copy to clipboard operation
skaffold copied to clipboard

skaffold run --tail hangs after containers exit

Open dindurthy opened this issue 5 years ago • 5 comments

Expected behavior

cat skaffold.yaml | skaffold run --status-check=false --tail=True --force=true -f - Logs are tailed, and when the job -- which is the only pod being tailed -- exits 0, skaffold should also exit.

Actual behavior

INFO[0025] Deploy complete in 20.858541444s
DEBU[0025] getting client config for kubeContext: ``
Press Ctrl+C to exit
INFO[0027] Streaming logs from pod: temp-pxspc container: temp
DEBU[0027] Running command: [kubectl --context <cluster> logs --since=24s -f temp-pxspc -c temp --namespace <namespace>]
[temp] Done
(...hanging indefinitely until I Ctrl-C)

Information

  • Skaffold version: 1.16.0
  • Operating system: Mac OS
  • Contents of skaffold.yaml:
{
    "apiVersion":"skaffold/v2alpha3",
    "kind":"Config",
    "build":{
        "artifacts":[
            {
                "image":<image name>,
                "context":<path-to-repo>
            }
        ],
        "local":{
            "useBuildkit":True
        },
    },
    "deploy":{
        "kubectl":{
            "manifests":[
                temp.yaml"
            ]
        },
        "statusCheckDeadlineSeconds":600
    }
}
apiVersion: batch/v1
kind: Job
metadata:
  name: temp
spec:
  backoffLimit: 2
  template:
    spec:
      restartPolicy: Never
      containers:
      - image: <image name>
        command: ["bash"]
        args: ["-c", "sleep 30 && echo Done && exit"]
        imagePullPolicy: Always
        name: temp

Steps to reproduce the behavior

See expected behavior above.

I believe this is essentially the same as this issue, but sounds like there was some confusion -- or I'm confused. I don't expect skaffold to hang indefinitely tailing logs for jobs. Once the job completes, there's nothing left to attach to. I can also confirm that running the kubectl logs command directly does exit with the intended code:

% kubectl --context <cluster> logs --since=24s -f temp-pxspc -c temp --namespace <namespace>
Done
%

For context, I'm trying to setup a job to run a suite of tests, and using skaffold run --tail to do this would be really nifty.

dindurthy avatar Dec 03 '20 01:12 dindurthy

@dindurthy, we have considered this use case where pods complete. Its a good to have feature.

tejal29 avatar Dec 08 '20 19:12 tejal29

+1 on this

AleksandarFaraj avatar Jul 12 '21 09:07 AleksandarFaraj

Any update here?

sudughonge avatar Dec 19 '22 22:12 sudughonge

Thank you for filing this issue, agree this feature is nice to have. --tail hanging does creates confusion, however we're not available to work on this, if anyone is interested in implementing this we would appreciate.

ericzzzzzzz avatar Feb 06 '23 19:02 ericzzzzzzz

Good thing this issue was around, I was confused if this was a "me" issue or a skaffold issue. Not the end of the world, but it would be a nice-to-have to not have tail hang.

Gikkman avatar Nov 13 '25 14:11 Gikkman