You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Playing with a job middleware, I met a behaviour which I'm not quite sure.
My dummy code is:
package main
import (
"context""fmt""os""github.com/runabol/tork/cli""github.com/runabol/tork/conf""github.com/runabol/tork/engine""github.com/rs/zerolog/log""github.com/runabol/tork""github.com/runabol/tork/middleware/job"
)
funcmain() {
iferr:=conf.LoadConfig(); err!=nil {
fmt.Println(err)
os.Exit(1)
}
mw:=func(next job.HandlerFunc) job.HandlerFunc {
returnfunc(ctx context.Context, et job.EventType, j*tork.Job) error {
log.Debug().
Msgf("received job %s at state %s (%s)", j.ID, j.State, et)
returnnext(ctx, et, j)
}
}
engine.RegisterJobMiddleware(mw)
iferr:=cli.New().Run(); err!=nil {
fmt.Println(err)
os.Exit(1)
}
}
Following, I added a job which will fail:
name: my failing jobtasks:
- name: my first taskrun: echo hello world
- name: raise an errorrun: exit 1
- name: my second taskrun: echo bye world
And, from the middleware, I got:
{"level":"debug","time":1702025778,"message":"received job ed83c87901d24b14a7ed44735b130a8a at state PENDING (STATE_CHANGE)"}
...
{"level":"debug","time":1702025778,"message":"received job ed83c87901d24b14a7ed44735b130a8a at state FAILED (STATE_CHANGE)"}
{"level":"debug","time":1702025779,"message":"received job ed83c87901d24b14a7ed44735b130a8a at state FAILED (READ)"}
...
{"level":"debug","time":1702026006,"message":"received job ed83c87901d24b14a7ed44735b130a8a at state FAILED (READ)"}
Playing with a job middleware, I met a behaviour which I'm not quite sure.
My dummy code is:
Following, I added a job which will fail:
And, from the middleware, I got:
But what I'm expecting is also a RUNNING (STATE_CHANGE). Am I wrong? Does it also happen to you or am I missing something?
A similar result also got with a successful job (https://gist.github.com/Pirosauro/62545d0c957e10b52083df5a928af329)
The text was updated successfully, but these errors were encountered: