GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — chore: bake the grpc plugin in the hermetic library generation image by diegomarquezp · Pull Request #3045 · googleapis/sdk-platform-java

This repository was archived by the owner on Oct 29, 2026. It is now read-only.

Conversation

@diegomarquezp

@diegomarquezp diegomarquezp commented Jul 11, 2024

Copy link
Copy Markdown
Contributor

This PR bakes the gRPC plugin in the hermetic library generation image.
The approach is very similar to #2707

  • The docker image will have a configurable ARG for the gRPC plugin
  • The docker image will download the gRPC plugin at the version specified in the previous point
  • The docker image will set the variables DOCKER_GRPC_VERSION and DOCKER_GRPC_LOCATION
  • generate_library.sh will now be able to avoid downloading the gRPC plugin if the computed plugin version is the same as DOCKER_GRPC_VERSION (all this via utilities.sh).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
diegomarquezp added 2 commits July 11, 2024 13:41
@diegomarquezp
chore: bake the grpc plugin in the hermetic library generation image
8de1c01
@diegomarquezp
improve comments
15b2fc5
@product-auto-label product-auto-label Bot added the size: m Pull request size is medium. label Jul 11, 2024
diegomarquezp
diegomarquezp commented Jul 11, 2024
View reviewed changes
Comment thread library_generation/utils/utilities.sh
local proto_library=$(find . -maxdepth 1 -type d -name 'proto-*' | sed 's/\.\///')
local found_libraries=$(echo "${proto_library}" | wc -l)
if [ -z ${proto_library} ]; then
if [[ -z ${proto_library} ]]; then

@diegomarquezp diegomarquezp Jul 11, 2024

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I noticed that the shell unit tests were expecting the binary brackets because proto_library could be expanded to a string with spaces.

+ '[' -z proto-2 proto-1 ']'
/usr/local/google/home/diegomarquezp/google/sdk-platform-java/library_generation/test/../utils/utilities.sh: line 318: [: proto-2: binary operator expected

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@diegomarquezp
diegomarquezp marked this pull request as ready for review July 11, 2024 13:54
blakeli0
blakeli0 reviewed Jul 16, 2024
View reviewed changes
Comment thread library_generation/utils/utilities.sh Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread library_generation/utils/utilities.sh
"${grpc_filename}"
chmod +x "${grpc_filename}"
fi
echo "$(pwd)/${grpc_filename}"

@blakeli0 blakeli0 Jul 16, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Is this a debug log?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@diegomarquezp diegomarquezp Jul 22, 2024

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

No, it's the return statement of the function. Many functions in utilities.sh are made this way. The way we use is variable=$(my_function "arg1" "arg2"). The only possible return values for return are integers from 0 to 255 (and consumed via $?) so it's not useful.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

blakeli0 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread .cloudbuild/library_generation/library_generation.Dockerfile

# install grpc
WORKDIR /grpc
RUN source /src/utils/utilities.sh \

@blakeli0 blakeli0 Jul 16, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

source /src/utils/utilities.sh is not needed anymore. We should probably split

RUN source /src/utils/utilities.sh \
	&& download_protoc "${PROTOC_VERSION}" "${OS_ARCHITECTURE}"

to

RUN source /src/utils/utilities.sh
RUN download_protoc "${PROTOC_VERSION}" "${OS_ARCHITECTURE}"

Then here we can just do

RUN download_grpc_plugin "${GRPC_VERSION}" "${OS_ARCHITECTURE}"

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@diegomarquezp diegomarquezp Jul 22, 2024

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This is something I considered initially when working on the Dockerfile. The effects of source are contained in the RUN statement only, because it is translated into /bin/sh -c "source script.sh" (see SO)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@blakeli0 blakeli0 Jul 25, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Cool, that's good to know!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
blakeli0
blakeli0 reviewed Jul 17, 2024
View reviewed changes
Comment thread .cloudbuild/library_generation/library_generation.Dockerfile Outdated

ARG OWLBOT_CLI_COMMITTISH=ac84fa5c423a0069bbce3d2d869c9730c8fdf550
ARG PROTOC_VERSION=25.3
ARG GRPC_VERSION=1.62.2

@blakeli0 blakeli0 Jul 17, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Can we configure this with renovate bot, and group it with other grpc update? e.g. There is an existing PR that updates gRPC to the latest.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@diegomarquezp diegomarquezp Jul 22, 2024

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Done

sdk-platform-java/renovate.json

Lines 55 to 67 in 9795e23

{
"customType": "regex",
"fileMatch": [
"^gax-java/dependencies\\.properties$",
"^\\.cloudbuild/library_generation/library_generation\\.Dockerfile$"
],
"matchStrings": [
"version\\.io_grpc=(?<currentValue>.+?)\\n",
"ARG GRPC_VERSION=[\"']?(?<currentValue>.+?)[\"']?\\s+"
],
"depNameTemplate": "io.grpc:grpc-core",
"datasourceTemplate": "maven"
},

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@blakeli0 blakeli0 Jul 25, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This version can be updated to 1.65.1 now since this PR is merged..

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

diegomarquezp reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@diegomarquezp diegomarquezp Jul 25, 2024

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Done

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
blakeli0
blakeli0 reviewed Jul 17, 2024
View reviewed changes

@blakeli0 blakeli0 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

We can still pass grpc_version from generation_config.yaml, I guess that would still override the baked in grpc version and the default grpc version from the pom?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
diegomarquezp and others added 2 commits July 22, 2024 16:02
@diegomarquezp @blakeli0
Update library_generation/utils/utilities.sh
0a95554
Co-authored-by: Blake Li <[email protected]>
@diegomarquezp
add grpc to renovate.json
034edf9
@diegomarquezp

diegomarquezp commented Jul 22, 2024

Copy link
Copy Markdown
Contributor Author

We can still pass grpc_version from generation_config.yaml, I guess that would still override the baked in grpc version and the default grpc version from the pom?

@blakeli0 Yes, if --grpc_version is not passed via the config yaml, then it will infer it via utilities.sh/get_protoc_version.

sdk-platform-java/library_generation/generate_library.sh

Lines 89 to 91 in 0a95554

if [ -z "${grpc_version}" ]; then
grpc_version=$(get_grpc_version "${gapic_generator_version}")
fi

sdk-platform-java/library_generation/generate_composed_library.py

Lines 124 to 133 in 0a95554

def __construct_tooling_arg(config: GenerationConfig) -> List[str]:
"""
Construct arguments of tooling versions used in generate_library.sh
:param config: the generation config
:return: arguments containing tooling versions
"""
arguments = []
arguments += util.create_argument("gapic_generator_version", config)
arguments += util.create_argument("grpc_version", config)
arguments += util.create_argument("protoc_version", config)

sdk-platform-java/library_generation/utils/utilities.py

Lines 31 to 39 in 0a95554

def create_argument(arg_key: str, arg_container: object) -> List[str]:
"""
Generates a list of two elements [argument, value], or returns
an empty array if arg_val is None
"""
arg_val = getattr(arg_container, arg_key, None)
if arg_val is not None:
return [f"--{arg_key}", f"{arg_val}"]
return []

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@diegomarquezp
add GRPC_VERSION to renovate config
9795e23
@diegomarquezp
diegomarquezp requested a review from blakeli0 July 24, 2024 20:54
@diegomarquezp diegomarquezp mentioned this pull request Jul 24, 2024
feat: bake gapic-generator-java into the hermetic build docker image #3067
Merged
diegomarquezp added 2 commits July 25, 2024 15:59
@diegomarquezp
Merge remote-tracking branch 'origin/main' into bake-grpc-hermetic-build
ecfe8cd
@diegomarquezp
update grpc to 1.65.1
bfac93f
@sonarqubecloud

sonarqubecloud Bot commented Jul 25, 2024

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed for 'gapic-generator-java-root'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sonarqubecloud

sonarqubecloud Bot commented Jul 25, 2024

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed for 'java_showcase_integration_tests'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

blakeli0
blakeli0 approved these changes Jul 25, 2024
View reviewed changes
@diegomarquezp
diegomarquezp merged commit 4bbb8ac into main Jul 25, 2024
@diegomarquezp
diegomarquezp deleted the bake-grpc-hermetic-build branch July 25, 2024 21:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

1 more reviewer
@blakeli0 blakeli0 blakeli0 approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size: m Pull request size is medium.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@diegomarquezp @blakeli0
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.