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

Add --no-plugins option to agent #540

Merged
merged 6 commits into from
Sep 6, 2017
Merged

Add --no-plugins option to agent #540

merged 6 commits into from
Sep 6, 2017

Conversation

lox
Copy link
Contributor

@lox lox commented Sep 5, 2017

This adds a --no-plugins option to an agent, which causes as step to fail with an error if there is a plugin present:

Error: This agent is isn't allowed to run plugins. To allow this, re-run this agent without the `--no-plugins` option.

A little bit of extra technology was needed to clean up how errors are wrapped and returned from the bootstrap. Previously there was a duplication of errors from when the command failed and when the phase failed.

@lox lox requested review from keithpitt and sj26 and removed request for keithpitt September 6, 2017 03:15
.buildkite-agent.cfg
/.agent.conf
/.agent.*.conf
/.buildkite-agent.cfg
Copy link
Member

Choose a reason for hiding this comment

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

👍


// Check if we can run plugins (disabled via --no-plugins)
if b.Plugins != "" && !b.Config.PluginsEnabled {
return fmt.Errorf("This agent is isn't allowed to run plugins. To allow this, re-run this agent without the `--no-plugins` option.")
Copy link
Member

Choose a reason for hiding this comment

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

Is there an extra "is" in here? ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is is. Good catch.

@@ -42,7 +43,7 @@ type Shell struct {
func New() (*Shell, error) {
wd, err := os.Getwd()
if err != nil {
return nil, fmt.Errorf("Failed to find current working directory: %v", err)
return nil, errors.Wrapf(err, "Failed to find current working directory: %v")
Copy link
Member

Choose a reason for hiding this comment

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

Loving the wraps 👍 🌯

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, me too. They are really nice.

Copy link
Member

@sj26 sj26 left a comment

Choose a reason for hiding this comment

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

This all looks pretty good to me!

@lox lox merged commit 2749d63 into master Sep 6, 2017
@lox lox deleted the add-no-plugins-option branch September 6, 2017 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants