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

Feature/cmd stopsignal #159

Merged

Conversation

chrisz100
Copy link
Contributor

@chrisz100 chrisz100 commented Apr 28, 2018

Added stopsignal with environment evaluation.

Reverted changes for shell command as I accidentally pushed them to master and there is another PR open and pending for them.

fixes #16

Copy link
Collaborator

@priyawadhwa priyawadhwa left a comment

Choose a reason for hiding this comment

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

Thanks for contributing! I left a couple comments.

}
signal := resolvedEnvs[len(resolvedEnvs)-1]

logrus.Infof("Replacing StopSignal in config with %v", signal)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We probably want to make sure the signal is valid before setting it -- looks like Docker does something similar here. You could probably use the same method to check!

logrus.Info("cmd: STOPSIGNAL")

// resolve possible environment variables
resolvedEnvs, err := util.ResolveEnvironmentReplacementList([]string{s.cmd.Signal}, config.Env, true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since we aren't resolving file paths for this command, we should pass in false to this method, so it should look like util.ResolveEnvironmentReplacementList([]string{s.cmd.Signal}, config.Env, false)

if err != nil {
return err
}
signal := resolvedEnvs[len(resolvedEnvs)-1]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would this be the same as resolvedEnvs[0]? Could you add ac omment about only having a single element in the output?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I took this from other commands but without actually testing it, I assume you are correct. The main question would be use a strict 0 here or spend some more compute power in favor of keeping the code more adaptable to possible future enhancements or changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Checked on that and the slide will always be len 1 - as the input slice will always be len 1 as well.

@dlorenc
Copy link
Collaborator

dlorenc commented Apr 30, 2018

Thanks @chrisz100 !

@priyawadhwa
Copy link
Collaborator

Could you remove STOPSIGNAL as an unsupported command from the README? Otherwise LGTM!

@priyawadhwa
Copy link
Collaborator

Great, thank you!

@priyawadhwa priyawadhwa merged commit 60cbc54 into GoogleContainerTools:master May 2, 2018
@chrisz100 chrisz100 deleted the feature/cmd_stopsignal branch May 2, 2018 15:51
@priyawadhwa priyawadhwa added the area/dockerfile-command For all bugs related to dockerfile file commands label Feb 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dockerfile-command For all bugs related to dockerfile file commands
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement STOPSIGNAL command
3 participants