GoogleContainerTools / GoogleContainerTools/skaffold
skaffold run --tail hangs after containers exit
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
### 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 logs --since=24s -f temp-pxspc -c temp --namespace ]
[temp] Done
(...hanging indefinitely until I Ctrl-C)
```
### Information
- Skaffold version: 1.16.0
- Operating system: Mac OS
- Contents of skaffold.yaml:
```yaml
{
"apiVersion":"skaffold/v2alpha3",
"kind":"Config",
"build":{
"artifacts":[
{
"image":,
"context":
}
],
"local":{
"useBuildkit":True
},
},
"deploy":{
"kubectl":{
"manifests":[
temp.yaml"
]
},
"statusCheckDeadlineSeconds":600
}
}
```
```temp.yaml
apiVersion: batch/v1
kind: Job
metadata:
name: temp
spec:
backoffLimit: 2
template:
spec:
restartPolicy: Never
containers:
- image:
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](https://github.com/GoogleContainerTools/skaffold/issues/3388) 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 logs --since=24s -f temp-pxspc -c temp --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.
Contributor guide
Assessment
This issue has not been assessed yet.