Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ We welcome contributions to the Runner project! By contributing, you help make t
1. Fork the repository on GitHub.
2. Clone your forked repository:
```sh
git clone git@github.com:v1Flows/runner.git
git clone git@github.com:JustLABv1/runner.git
cd runner
```
3. Create a new branch for your changes:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ api_endpoint:
```

## Plugins
The runner can be extended by integrating plugins following a specific schema. A list of available plugins can be found [here](https://github.com/v1Flows/runner-plugins).
The runner can be extended by integrating plugins following a specific schema. A list of available plugins can be found [here](https://github.com/JustLABv1/runner-plugins).

To develop your own plugin you can start right away with this [template](https://github.com/v1Flows/runner-plugins/tree/develop/template)
To develop your own plugin you can start right away with this [template](https://github.com/JustLABv1/runner-plugins/tree/develop/template)

## Modes

Expand Down Expand Up @@ -91,4 +91,4 @@ We welcome contributions to this project! To contribute, follow these steps:
5. Open a pull request on GitHub.

## License
This project is licensed under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3. See the [LICENSE](https://github.com/v1Flows/runner/blob/main/LICENSE) file for details.
This project is licensed under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3. See the [LICENSE](https://github.com/JustLABv1/runner/blob/main/LICENSE) file for details.
16 changes: 8 additions & 8 deletions cmd/runner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (
"time"

"github.com/JustLABv1/justflow/services/backend/pkg/models"
"github.com/JustLABv1/runner/config"
"github.com/JustLABv1/runner/internal/api"
internal_executions "github.com/JustLABv1/runner/internal/executions"
"github.com/JustLABv1/runner/internal/runner"
"github.com/JustLABv1/runner/internal/worker"
"github.com/JustLABv1/runner/pkg/plugins"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
"github.com/v1Flows/runner/config"
"github.com/v1Flows/runner/internal/api"
internal_executions "github.com/v1Flows/runner/internal/executions"
"github.com/v1Flows/runner/internal/runner"
"github.com/v1Flows/runner/internal/worker"
"github.com/v1Flows/runner/pkg/plugins"

"github.com/alecthomas/kingpin/v2"
)
Expand Down Expand Up @@ -48,7 +48,7 @@ func main() {
kingpin.HelpFlag.Short('h')
kingpin.Parse()

log.Info("Starting v1Flows Runner. Version: ", version)
log.Info("Starting JustLAB Runner. Version: ", version)

log.Info("Loading config")
configManager := config.GetInstance()
Expand All @@ -72,7 +72,7 @@ func main() {
router := gin.Default()

router.Use(cors.New(cors.Config{
AllowOrigins: []string{"https://exflow.org", "https://alertflow.org", "http://localhost:8080", "http://localhost:3000", "http://localhost:4000", "http://localhost:8081"},
AllowOrigins: []string{"https://justflow.app", "http://localhost:8080", "http://localhost:3000", "http://localhost:4000", "http://localhost:8081"},
AllowMethods: []string{"GET", "HEAD", "POST", "PUT", "OPTIONS", "DELETE"},
AllowHeaders: []string{"Origin", "Authorization", "X-Requested-With", "Content-Type"},
ExposeHeaders: []string{"Content-Length"},
Expand Down
8 changes: 4 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,28 +178,28 @@ func (cm *ConfigurationManager) GetConfig() *Config {
return cm.config
}

// UpdateRunnerID updates the runner ID in the configuration for both Alertflow and ExFlow
// UpdateRunnerID updates the runner ID in the configuration for JustFlow
func (cm *ConfigurationManager) UpdateRunnerID(id string) {
cm.mu.Lock()
defer cm.mu.Unlock()
cm.config.JustFlow.RunnerID = id
}

// UpdateRunnerApiKey updates the runner api_key in the configuration for both Alertflow and ExFlow
// UpdateRunnerApiKey updates the runner api_key in the configuration for JustFlow
func (cm *ConfigurationManager) UpdateRunnerApiKey(apiKey string) {
cm.mu.Lock()
defer cm.mu.Unlock()
cm.config.JustFlow.APIKey = apiKey
}

// GetRunnerIDs returns the current runner IDs for both Alertflow and ExFlow
// GetRunnerIDs returns the current runner IDs for JustFlow
func (cm *ConfigurationManager) GetRunnerID() string {
cm.mu.RLock()
defer cm.mu.RUnlock()
return cm.config.JustFlow.RunnerID
}

// GetRunnerIDs returns the current runner apiKey for both Alertflow and ExFlow
// GetRunnerIDs returns the current runner apiKey for JustFlow
func (cm *ConfigurationManager) GetRunnerApiKey() string {
cm.mu.RLock()
defer cm.mu.RUnlock()
Expand Down
4 changes: 2 additions & 2 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
log_level: info
mode: master

exflow:
url: https://exflow.org
justflow:
url: https://justflow.app
runner_id: null
api_key: null

Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/v1Flows/runner
module github.com/JustLABv1/runner

go 1.24.0

Expand All @@ -10,7 +10,6 @@ require (
github.com/hashicorp/go-hclog v1.6.3
github.com/hashicorp/go-plugin v1.7.0
github.com/sirupsen/logrus v1.9.3
github.com/v1Flows/alertFlow/services/backend v0.0.0-20250317112742-7a11f04dd445
)

require (
Expand Down Expand Up @@ -76,7 +75,6 @@ require (
github.com/gin-contrib/cors v1.7.6
github.com/gin-gonic/gin v1.11.0
github.com/spf13/viper v1.21.0
github.com/v1Flows/exFlow/services/backend v0.0.0-20250904092110-86db1f89ca20
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
golang.org/x/sys v0.38.0 // indirect
)
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@ github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA
github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
github.com/uptrace/bun v1.2.16 h1:QlObi6ZIK5Ao7kAALnh91HWYNZUBbVwye52fmlQM9kc=
github.com/uptrace/bun v1.2.16/go.mod h1:jMoNg2n56ckaawi/O/J92BHaECmrz6IRjuMWqlMaMTM=
github.com/v1Flows/alertFlow/services/backend v0.0.0-20250317112742-7a11f04dd445 h1:o1WaAweRrGc6Yz4G3DTE9cr6sFul1TJ9k71yIbECQYQ=
github.com/v1Flows/alertFlow/services/backend v0.0.0-20250317112742-7a11f04dd445/go.mod h1:wN72OUmADQ95eNYyiYM4oa6FOnvoCBRljzsGQGdvaIA=
github.com/v1Flows/exFlow/services/backend v0.0.0-20250904092110-86db1f89ca20 h1:yfee6np8MyaFQv8JKXbNsM7CMZ/Qykg9PDYg4Cmz+Uk=
github.com/v1Flows/exFlow/services/backend v0.0.0-20250904092110-86db1f89ca20/go.mod h1:FDHugsWJJxP5p0baCAd7YQ375DmD0zQchxZKLASJ3Cc=
github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8=
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
Expand Down
4 changes: 2 additions & 2 deletions internal/actions/check_conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"time"

"github.com/JustLABv1/justflow/services/backend/pkg/models"
"github.com/v1Flows/runner/config"
"github.com/v1Flows/runner/pkg/executions"
"github.com/JustLABv1/runner/config"
"github.com/JustLABv1/runner/pkg/executions"

log "github.com/sirupsen/logrus"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/api/auth_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"errors"

"github.com/JustLABv1/justflow/services/backend/functions/httperror"
"github.com/v1Flows/runner/internal/token"
"github.com/JustLABv1/runner/internal/token"

"github.com/gin-gonic/gin"
)
Expand Down
6 changes: 3 additions & 3 deletions internal/api/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"strconv"

"github.com/JustLABv1/justflow/services/backend/pkg/models"
"github.com/JustLABv1/runner/config"
"github.com/JustLABv1/runner/pkg/executions"
"github.com/JustLABv1/runner/pkg/plugins"
"github.com/google/uuid"
"github.com/v1Flows/runner/config"
"github.com/v1Flows/runner/pkg/executions"
"github.com/v1Flows/runner/pkg/plugins"

"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
Expand Down
2 changes: 1 addition & 1 deletion internal/api/ready.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package api

import (
"github.com/JustLABv1/runner/config"
"github.com/gin-gonic/gin"
"github.com/v1Flows/runner/config"
)

func ReadyEndpoint(cfg *config.Config, router *gin.Engine) {
Expand Down
107 changes: 107 additions & 0 deletions internal/cleanup/cleanup.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package cleanup

import (
"fmt"
"os"
"time"

"github.com/JustLABv1/justflow/services/backend/pkg/models"
"github.com/JustLABv1/runner/config"
"github.com/JustLABv1/runner/pkg/executions"
log "github.com/sirupsen/logrus"
)

func PerformWorkspaceCleanup(cfg *config.Config, execution models.Executions, flow models.Flows) error {
if flow.AlwaysCleanupWorkspace {
cleanupStep, err := createCleanupStep(cfg, execution)
if err != nil {
return err
}

err = os.RemoveAll(fmt.Sprintf("%s/%s", cfg.WorkspaceDir, execution.ID))
if err != nil {
log.Error("Error deleting workspace dir: ", err)

err = executions.UpdateStep(nil, execution.ID.String(), models.ExecutionSteps{
ID: cleanupStep.ID,
Messages: []models.Message{
{
Title: "Cleanup Workspace",
Lines: []models.Line{
{
Content: "Failed to delete workspace dir: " + err.Error(),
Timestamp: time.Now(),
Color: "danger",
},
},
},
},
Status: "error",
RunnerID: execution.RunnerID,
FinishedAt: time.Now(),
})
if err != nil {
return err
}
}

err = executions.UpdateStep(nil, execution.ID.String(), models.ExecutionSteps{
ID: cleanupStep.ID,
Messages: []models.Message{
{
Title: "Cleanup Workspace",
Lines: []models.Line{
{
Content: "Workspace directory deleted successfully.",
Timestamp: time.Now(),
Color: "success",
},
},
},
},
Status: "success",
RunnerID: execution.RunnerID,
FinishedAt: time.Now(),
})
if err != nil {
return err
}

return nil
}

return nil
}

func createCleanupStep(cfg *config.Config, execution models.Executions) (models.ExecutionSteps, error) {
cleanupStep := models.ExecutionSteps{
Action: models.Action{
Plugin: "cleanup",
Params: []models.Params{},
},
Messages: []models.Message{
{
Title: "Cleanup Workspace",
Lines: []models.Line{
{
Content: "Perform workspace cleanup. Path: " + cfg.WorkspaceDir + "/" + execution.ID.String(),
Timestamp: time.Now(),
Color: "success",
},
},
},
},
Status: "running",
RunnerID: execution.RunnerID,
CreatedAt: time.Now(),
}

stepID, err := executions.SendStep(cfg, execution, cleanupStep)
if err != nil {
return models.ExecutionSteps{}, err
}

cleanupStep.ID = stepID.ID

return cleanupStep, nil
}
2 changes: 1 addition & 1 deletion internal/executions/cancel_remaining_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"time"

"github.com/JustLABv1/justflow/services/backend/pkg/models"
"github.com/JustLABv1/runner/pkg/executions"
log "github.com/sirupsen/logrus"
"github.com/v1Flows/runner/pkg/executions"
)

func cancelRemainingSteps(executionID string) error {
Expand Down
6 changes: 3 additions & 3 deletions internal/executions/failure_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"time"

"github.com/JustLABv1/justflow/services/backend/pkg/models"
"github.com/v1Flows/runner/config"
"github.com/v1Flows/runner/pkg/executions"
"github.com/v1Flows/runner/pkg/plugins"
"github.com/JustLABv1/runner/config"
"github.com/JustLABv1/runner/pkg/executions"
"github.com/JustLABv1/runner/pkg/plugins"
)

func startFailurePipeline(cfg *config.Config, workspace string, actions []models.Action, loadedPlugins map[string]plugins.Plugin, flow models.Flows, flowBytes []byte, alert models.Alerts, steps []models.ExecutionSteps, failedStep models.ExecutionSteps, execution models.Executions) error {
Expand Down
4 changes: 2 additions & 2 deletions internal/executions/get_pending_executions.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"time"

jf_models "github.com/JustLABv1/justflow/services/backend/pkg/models"
"github.com/v1Flows/runner/pkg/platform"
"github.com/v1Flows/runner/pkg/plugins"
"github.com/JustLABv1/runner/pkg/platform"
"github.com/JustLABv1/runner/pkg/plugins"

log "github.com/sirupsen/logrus"
)
Expand Down
10 changes: 5 additions & 5 deletions internal/executions/process_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"time"

"github.com/JustLABv1/justflow/services/backend/pkg/models"
"github.com/v1Flows/runner/config"
internal_actions "github.com/v1Flows/runner/internal/actions"
"github.com/v1Flows/runner/internal/common"
"github.com/v1Flows/runner/pkg/executions"
"github.com/v1Flows/runner/pkg/plugins"
"github.com/JustLABv1/runner/config"
internal_actions "github.com/JustLABv1/runner/internal/actions"
"github.com/JustLABv1/runner/internal/common"
"github.com/JustLABv1/runner/pkg/executions"
"github.com/JustLABv1/runner/pkg/plugins"

log "github.com/sirupsen/logrus"
)
Expand Down
6 changes: 3 additions & 3 deletions internal/executions/send_flow_action_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package internal_executions

import (
"github.com/JustLABv1/justflow/services/backend/pkg/models"
"github.com/v1Flows/runner/config"
"github.com/v1Flows/runner/pkg/executions"
"github.com/JustLABv1/runner/config"
"github.com/JustLABv1/runner/pkg/executions"
)

// SendFlowActionSteps sends all active flow actions to alertflow
// SendFlowActionSteps sends all active flow actions to justflow
func sendFlowActionSteps(cfg *config.Config, execution models.Executions, flow models.Flows) (stepsWithIDs []models.ExecutionSteps, err error) {
for _, action := range flow.Actions {
if !action.Active {
Expand Down
Loading