-
Notifications
You must be signed in to change notification settings - Fork 155
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
Update codegen base image #4968
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4968 +/- ##
==========================================
- Coverage 29.34% 29.32% -0.02%
==========================================
Files 323 323
Lines 40984 40984
==========================================
- Hits 12027 12020 -7
- Misses 27997 28002 +5
- Partials 960 962 +2 ☔ View full report in Codecov by Sentry. |
…and use protoc-gen-js Signed-off-by: Yoshiki Fujikane <[email protected]>
Signed-off-by: Yoshiki Fujikane <[email protected]>
ba0c07b
to
727e4f2
Compare
web/api_client/service_pb.js
Outdated
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.
How about adding these files that protoc-gen-js generated as linguist-generated=true with .gitattributes
The file patterns can be specified as the same as the .gitignore file, so we may be able to mark these files with one-line such as **/*_pb.js linguist-generated=true
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.
Thank you for the comment! It looks good to me.
Added b72f8a4
The result I tried it on my machine, and it works well.
|
📝 The workflow Currently, the workflow uses I will change the image hash in the Makefile after the PR is merged. |
# protoc-gen-js | ||
# This is a workaround to use it https://github.com/protocolbuffers/protobuf-javascript/issues/127#issuecomment-1361047597 | ||
RUN for target in x86_64 aarch_64; do \ | ||
mkdir /protoc-gen-js-${target} && cd /protoc-gen-js-${target} \ | ||
&& wget https://github.com/protocolbuffers/protobuf-javascript/releases/download/v${PROTOC_GEN_JS_VER}/protobuf-javascript-${PROTOC_GEN_JS_VER}-linux-${target}.tar.gz \ | ||
&& tar xvfz protobuf-javascript-${PROTOC_GEN_JS_VER}-linux-${target}.tar.gz \ | ||
&& chmod +x bin/protoc-gen-js \ | ||
&& rm -rf protobuf-javascript-${PROTOC_GEN_JS_VER}-linux-${target}.tar.gz; \ | ||
done && \ | ||
mv /protoc-gen-js-aarch_64/ /protoc-gen-js-aarch64/ |
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.
📝 Get the binary not only for x86_64 but also aarch_64 to check it on the local machine.
Signed-off-by: Yoshiki Fujikane <[email protected]>
@@ -15,7 +15,7 @@ | |||
// Code generated by protoc-gen-go. DO NOT EDIT. | |||
// versions: | |||
// protoc-gen-go v1.27.1 | |||
// protoc v3.18.1 | |||
// protoc v3.21.12 |
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.
The *.pb.go
changes are just a comment update for protoc version.
var global = | ||
(typeof globalThis !== 'undefined' && globalThis) || | ||
(typeof window !== 'undefined' && window) || | ||
(typeof global !== 'undefined' && global) || | ||
(typeof self !== 'undefined' && self) || | ||
(function () { return this; }).call(null) || | ||
Function('return this')(); |
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.
The changes in *.pb.js
are like this and the below.
I think it is ok because the web test is passed.
// Copyright 2023 The PipeCD Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
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.
Love this ❤️
Fyi, the current CI configuration is here: https://github.com/pipe-cd/pipecd/blob/master/.github/workflows/gen.yaml#L14 |
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.
LGTM 👍
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.
LGTM
What this PR does / why we need it:
I changed the codegen's base image from
golang:1.20.4-alpine3.16
togolang:1.22.4
to keep using protoc-gen-js.This change requires updating the go version to 1.22.x.
fixes
golang:1.20.4-alpine3.16
togolang:1.22.4
.Why I changed from alpine to debian
We use protoc-gen-js in the codegen container.
protoc-gen-js is no longer installed by default after protobuf 3.20.
protocolbuffers/protobuf-javascript#127 (comment)
Also, protobuf, which provides protoc-gen-js, is no longer provided after alpine 3.16.
cf. alpine 3.16
cf. alpine 3.17
This is the problem with updating the go version because the alpine-based go 1.22.x image uses the alpine after version 16.
I think there are two patterns to avoid this problem for now.
But we couldn't choose both of them while using alpine-based image.
The bazel doesn't expect to be used on the alpine linux.
Also we couldn't use the released binary because of the glibc dependency.
Why choosing to get protoc-gen-js from the github releases directly
The build time with Bazel is too long—more than 30 minutes.
So I decided to get protoc-gen-js from the github releases directly.
Which issue(s) this PR fixes:
Part of #4874
Does this PR introduce a user-facing change?: