Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Allow launcher in nodejs #1854

Merged
merged 3 commits into from
Jun 10, 2021

Conversation

martaver
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #1802

"entrypoint / launcher in nodejs_image isn't respected "

What is the new behavior?

The launcher and launcher_args attributes are now accepted by nodejs_image and passed to app_layer.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

This feature isn't really node specific. If maintainers agree, then I would update all the language images that use app_layer to accept launcher and launcher_args. Then I would also remove the documentation change from nodejs_image and instead make a general note that all the language images support the attributes.

@google-cla
Copy link

google-cla bot commented May 18, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label May 18, 2021
@google-cla
Copy link

google-cla bot commented May 18, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: yes and removed cla: no labels May 18, 2021
add launcher and launcher_args attrs to nodejs_image, and pass them to app_layer
update docs with note about launcher and launcher_args for nodejs_image
add run-bazel-in-docker.sh allowing non-linux platforms to execute repo build and tests
add .idea to .gitignore
Add test for using nodejs_image with launcher arg
Copy link
Collaborator

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

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

This is awesome thanks!

You asked on slack about whether this should cover other languages, I don't really know...

Before we merge this, I have one question though. Would it be hard for a user to just skip using the convenient language rules like nodejs_image and just make their own container_image in order to get access to these attributes? maybe the use case is narrow enough that omitting them from the easy-to-use language wrappers is actually a feature to make things simpler for common users.

@@ -0,0 +1,11 @@
mkdir -p /tmp/build_output/
Copy link
Collaborator

Choose a reason for hiding this comment

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

did you mean to check in this file? I guess it's for testing something. If so, maybe add some comments here about what it's used for and how to use it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added some docs... I created this script because the repo's tests fail on non-linux systems (I'm on MacOS):

tests/container/nodejs/nodejs_image_custom_binary_test.image: line 208: /usr/bin/docker: No such file or directory

@martaver
Copy link
Contributor Author

re: rolling your own container_image... I'd rather avoid that... nodejs_image forms a standard that I want to be able to lean on wherever possible. Deviating from it should be a last resort.

I would argue that launchers are common (roughly 50% of the images I deal with have them) and a minor enough implementation detail that it shouldn't warrant having to roll a custom container_image.

At the end of the day, there are basically only two ways to customise a container_image... change the base image, and the launch script / entry point. nodejs_image supports the former already, but not the latter.

This is also why I suspect it'd be good form to adder launcher and launcher_args to all the lang images.

@alexeagle
Copy link
Collaborator

I tried to rebase this for you to land it, but I think you disabled the checkbox "allow edits from maintainers" - could you rebase yourself or check the box?

@martaver
Copy link
Contributor Author

martaver commented Jun 9, 2021

Mmmmm done... looks like .gitignore had a conflict...

Also it's weird, I don't see the 'allow edits from maintainers' option. I found it in docs, but it's just not there in the PR.

What did you think of exposing the launcher args for each language image btw?

Copy link
Collaborator

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

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

If the same problem exists for other languages, then yeah we should fix it for all of them.

I'm okay with getting this fix in first, I don't think it's practical to make you do all of them at once.

@alexeagle alexeagle merged commit 1b75b77 into bazelbuild:master Jun 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants