Skip to content

Commit

Permalink
Adding timeout_in_minutes and parallelism to config
Browse files Browse the repository at this point in the history
  • Loading branch information
jortega0 committed Feb 23, 2024
1 parent 791fa97 commit ec15f00
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 34 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ If the version number is not provided then the most recent version of the plugin
steps:
- label: "Triggering pipelines"
plugins:
- glydways/monorepo-diff#v2.5.20:
- glydways/monorepo-diff#v2.5.10:
diff: "git diff --name-only HEAD~1"
watch:
- path: "bar-service/"
Expand All @@ -38,7 +38,7 @@ steps:
steps:
- label: "Triggering pipelines"
plugins:
- glydways/monorepo-diff#v2.5.20:
- glydways/monorepo-diff#v2.5.10:
diff: "git diff --name-only $(head -n 1 last_successful_build)"
interpolation: false
env:
Expand Down Expand Up @@ -162,7 +162,7 @@ Add `log_level` property to set the log level. Supported log levels are `debug`
steps:
- label: "Triggering pipelines"
plugins:
- glydways/monorepo-diff#v2.5.20:
- glydways/monorepo-diff#v2.5.10:
diff: "git diff --name-only HEAD~1"
log_level: "debug" # defaults to "info"
watch:
Expand Down Expand Up @@ -238,7 +238,7 @@ hooks:
steps:
- label: "Triggering pipelines"
plugins:
- glydways/monorepo-diff#v2.5.20:
- glydways/monorepo-diff#v2.5.10:
diff: "git diff --name-only HEAD~1"
watch:
- path: app/cms/
Expand Down
16 changes: 0 additions & 16 deletions pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,44 +163,28 @@ func generatePipeline(steps []Step, plugin Plugin) (*os.File, error) {
}

yamlSteps := make([]yaml.Marshaler, len(steps))
log.Debug("1")
log.Debug(yamlSteps)

for i, step := range steps {
yamlSteps[i] = step
}

log.Debug("2")
log.Debug(yamlSteps)

if plugin.Wait {
yamlSteps = append(yamlSteps, WaitStep{})
}

log.Debug("3")
log.Debug(yamlSteps)

for _, cmd := range plugin.Hooks {
yamlSteps = append(yamlSteps, Step{Command: cmd.Command})
}
log.Debug("4")
log.Debug(yamlSteps)

yamlNotify := make([]yaml.Marshaler, len(plugin.Notify))
for i, n := range plugin.Notify {
yamlNotify[i] = n
}

log.Debug("5")
log.Debug(yamlSteps)

pipeline := map[string][]yaml.Marshaler{
"steps": yamlSteps,
}

log.Debug("6")
log.Debug(yamlSteps)

if len(yamlNotify) > 0 {
pipeline["notify"] = yamlNotify
}
Expand Down
14 changes: 0 additions & 14 deletions plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,8 @@ func (plugin *Plugin) UnmarshalJSON(data []byte) error {

_ = json.Unmarshal(data, def)

log.Info("def")
log.Info(def)
*plugin = Plugin(*def)

log.Info("plugin")
log.Info(plugin)

parseResult, err := parseEnv(plugin.RawEnv)
if err != nil {
return errors.New("failed to parse plugin configuration")
Expand Down Expand Up @@ -163,30 +158,21 @@ func initializePlugin(data string) (Plugin, error) {

var pluginConfigs []map[string]json.RawMessage

log.Info("rawmessage")
log.Info(pluginConfigs)
if err := json.Unmarshal([]byte(data), &pluginConfigs); err != nil {
log.Debug(err)
return Plugin{}, errors.New("failed to parse plugin configuration")
}

log.Info("after unmarshal")
log.Info(pluginConfigs)

for _, p := range pluginConfigs {
for key, pluginConfig := range p {
if strings.HasPrefix(key, pluginName) {
var plugin Plugin

log.Info("PluginConfig")
log.Info(pluginConfig)
if err := json.Unmarshal(pluginConfig, &plugin); err != nil {
log.Debug(err)
return Plugin{}, errors.New("failed to parse plugin configuration")
}

log.Info("plugin after unmarshal")
log.Info(plugin)
return plugin, nil
}
}
Expand Down

0 comments on commit ec15f00

Please sign in to comment.