Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up tink worker; remove os.Exit; ensure valid container names: #655

Merged
merged 4 commits into from
Dec 23, 2022

Conversation

jacobweinstock
Copy link
Member

@jacobweinstock jacobweinstock commented Dec 23, 2022

Description

Removing numerous os.Exit calls means that tink
worker wont require a restart for action execution failures. This commit also allows action names to contain spaces without the action failing to run.

Why is this needed

Fixes: #463

How Has This Been Tested?

How are existing users impacted? What migration steps/scripts do we need?

Checklist:

I have:

  • updated the documentation and/or roadmap (if required)
  • added unit or e2e tests
  • provided instructions on how to upgrade

@codecov
Copy link

codecov bot commented Dec 23, 2022

Codecov Report

Merging #655 (f820d1d) into main (5b62d12) will increase coverage by 1.58%.
The diff coverage is 16.21%.

@@            Coverage Diff             @@
##             main     #655      +/-   ##
==========================================
+ Coverage   48.86%   50.45%   +1.58%     
==========================================
  Files          20       20              
  Lines        1017      995      -22     
==========================================
+ Hits          497      502       +5     
+ Misses        514      487      -27     
  Partials        6        6              
Impacted Files Coverage Δ
cmd/tink-worker/worker/worker.go 0.00% <0.00%> (ø)
cmd/tink-worker/worker/container_manager.go 97.36% <100.00%> (+0.18%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -130,7 +130,6 @@ func initViper(logger log.Logger, cmd *cobra.Command) error {
logger.With("configFile", viper.ConfigFileUsed()).Error(err, "could not load config file")
return err
}
logger.Info("no config file found")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏🏻

@@ -76,13 +77,22 @@ func (m *containerManager) CreateContainer(ctx context.Context, cmd []string, wf

hostConfig.Binds = append(hostConfig.Binds, action.GetVolumes()...)
l.With("command", cmd).Info("creating container")
resp, err := m.cli.ContainerCreate(ctx, config, hostConfig, nil, nil, action.GetName())
name := makeValidContainerName(action.GetName())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot about this, well remembered!

chrisdoherty4
chrisdoherty4 previously approved these changes Dec 23, 2022
Removing numerous `os.Exit` calls means that tink
worker wont require a restart for action execution failures.
This commit also allows action names to contain spaces without
the action failing to run.

Signed-off-by: Jacob Weinstock <[email protected]>
With the worker now not erroring out this e2e
test needed updated.

Signed-off-by: Jacob Weinstock <[email protected]>
It appears the template library reports a
different error in Go > 1.18 with respect to
a missing `}` in a template. (`{{.device_1}`, for example).

Signed-off-by: Jacob Weinstock <[email protected]>
This removes more unneeded code and drops the use
of `goto` statements.

Signed-off-by: Jacob Weinstock <[email protected]>
@chrisdoherty4 chrisdoherty4 added the ready-to-merge Signal to Mergify to merge the PR. label Dec 23, 2022
@jacobweinstock
Copy link
Member Author

@mergify queue

@mergify
Copy link
Contributor

mergify bot commented Dec 23, 2022

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at fdfecb9

@mergify mergify bot merged commit fdfecb9 into tinkerbell:main Dec 23, 2022
@jacobweinstock jacobweinstock deleted the server-refactor branch December 23, 2022 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Signal to Mergify to merge the PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tink worker should never exit
2 participants