1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

feat(kube): kube app auto update backend (#5547)

This commit is contained in:
Dmitry Salakhov 2021-08-31 13:41:19 +12:00
parent a5058e8f1e
commit 0e60f40937
22 changed files with 450 additions and 364 deletions

View file

@ -1,9 +1,10 @@
package stacks
import (
"log"
"time"
log "github.com/sirupsen/logrus"
"github.com/pkg/errors"
portainer "github.com/portainer/portainer/api"
"github.com/portainer/portainer/api/scheduler"
@ -19,9 +20,10 @@ func StartStackSchedules(scheduler *scheduler.Scheduler, stackdeployer StackDepl
if err != nil {
return errors.Wrap(err, "Unable to parse auto update interval")
}
stackID := stack.ID // to be captured by the scheduled function
jobID := scheduler.StartJobEvery(d, func() {
if err := RedeployWhenChanged(stack.ID, stackdeployer, datastore, gitService); err != nil {
log.Printf("[ERROR] %s\n", err)
if err := RedeployWhenChanged(stackID, stackdeployer, datastore, gitService); err != nil {
log.WithFields(log.Fields{"stackID": stackID}).WithError(err).Error("faile to auto-deploy a stack")
}
})