skaffold run --tail hangs after containers exit
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, we have considered this use case where pods complete. Its a good to have feature.
+1 on this
Any update here?
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.
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.