mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-25 08:15:02 +01:00
fix: container cleanup error is not a job execution error (#97)
This commit is contained in:
@@ -103,19 +103,19 @@ func newJobExecutor(info jobInfo, sf stepFactory, rc *RunContext) common.Executo
|
|||||||
|
|
||||||
var stopContainerExecutor common.Executor = func(ctx context.Context) error {
|
var stopContainerExecutor common.Executor = func(ctx context.Context) error {
|
||||||
jobError := common.JobError(ctx)
|
jobError := common.JobError(ctx)
|
||||||
var err error
|
|
||||||
if rc.Config.AutoRemove || jobError == nil {
|
if rc.Config.AutoRemove || jobError == nil {
|
||||||
// always allow 1 min for stopping and removing the runner, even if we were cancelled
|
timeout := time.Minute
|
||||||
ctx, cancel := context.WithTimeout(common.WithLogger(context.Background(), common.Logger(ctx)), time.Minute)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
logger := common.Logger(ctx)
|
logger := common.Logger(ctx)
|
||||||
logger.Infof("Cleaning up container for job %s", rc.JobName)
|
logger.Infof("Stopping and removing Container... (waiting for %s)", timeout.String())
|
||||||
if err = info.stopContainer()(ctx); err != nil {
|
// always allow 1 min for stopping and removing the runner, even if we were cancelled
|
||||||
logger.Errorf("error while stop job container: %v", err)
|
ctx, cancel := context.WithTimeout(common.WithLogger(context.Background(), common.Logger(ctx)), timeout)
|
||||||
|
defer cancel()
|
||||||
|
warn := info.stopContainer()(ctx)
|
||||||
|
if warn != nil {
|
||||||
|
logger.Warnf("Stopping and removing Container failed after %s with error: ", timeout.String(), warn.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var setJobResultExecutor common.Executor = func(ctx context.Context) error {
|
var setJobResultExecutor common.Executor = func(ctx context.Context) error {
|
||||||
|
|||||||
Reference in New Issue
Block a user