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

Update PHP & Ruby Mac BUILD #24860

Merged
merged 4 commits into from
Dec 4, 2020
Merged

Conversation

veblush
Copy link
Contributor

@veblush veblush commented Dec 1, 2020

This is mainly to use Mojave for PHP, Ruby, and BuildArtifacts.

  • Disable HOMEBREW_UPDATE to prevent unexpected update failure.
  • Simplify Ruby installation
  • Simplify Python installation
    • Python 3.7 and 3.8 are pre-installed.
    • MD5 check is replaced with SHA256 check not to update Homebrew.
  • Updated PHP version to 7.2 to be aligned with the existing PHPUnit (and 7.2 is the oldest version among the supported ones)
  • Remove a protoc x86 artifact since there is no x86 build-tool on Mojave.
  • Use -mmacosx-version-min=10.10 to be consistent with other gRPC artifacts.

Copy link
Contributor

@stanley-cheung stanley-cheung 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 taking care of this! And just to confirm: PHP 7.2 and PHPUnit 8.x are the correct versions where we want to be at.

Copy link
Contributor

@jtattermusch jtattermusch 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 generally looking fine, but I have a few suggestions.

Also, please make sure you're not breaking Grpc.Tools nuget package build (currently that's the case).

@@ -25,6 +25,9 @@ ulimit -a
# - try adding a dependency under a language-specific section first (reduces latency and increases build stability)
# - only add stuff that you absolutely need for your builds to work (add comment to explain why its needed)

# Disable HOMEBREW update to avoid new updates which potentially have problems.
export HOMEBREW_NO_AUTO_UPDATE=1
Copy link
Contributor

Choose a reason for hiding this comment

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

sg.
suggestion: would it be cleaner to also explictly checkout homebrew-core so that things are at a known state?
Like this we are relying on what is the last commit available on kokoro macos workers and we have no control of that. I think it would be worth checking what's the commit provided by the current mojave kokoro workers and pinning it (or at least mentioning it in a comment, so that troubleshooting is easier).

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 briefly updated it to include more info on why its update is disabled and the current version of the core repository. I didn't fix the version because it's meant to use the version when the image was built and it will change when migrating to Catalina or Big sure in future.

for RUBY_VERSION in 2.5.0 2.7.0; do
# TODO(jtattermusch): find a better way of installing ruby, as the current way installs a huge number
Copy link
Contributor

Choose a reason for hiding this comment

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

sg if all ruby builds still work fine after this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep it works :)

@@ -129,8 +96,15 @@ then
export DOTNET_CLI_TELEMETRY_OPTOUT=true
fi

# PHP tests currently require using an older version of PHPUnit
ln -sf /usr/local/bin/phpunit-5.7 /usr/local/bin/phpunit
if [ "${PREPARE_BUILD_INSTALL_DEPS_PHP}" == "true" ]
Copy link
Contributor

Choose a reason for hiding this comment

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

+1, very nice.

@@ -348,7 +348,6 @@ def targets():
ProtocArtifact('linux', 'x64'),
ProtocArtifact('linux', 'x86'),
ProtocArtifact('macos', 'x64'),
ProtocArtifact('macos', 'x86'),
Copy link
Contributor

Choose a reason for hiding this comment

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

as is, this will break the build of Grpc.Tools nuget package (run an adhoc artifact/packages/distribtest flow to see that)
two options:

  • we remove the x86 protoc artifact in a separate PR (and I can help with adjusting C#).
  • you also include the Grpc.Tools fix here

Copy link
Contributor

Choose a reason for hiding this comment

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

Removing these should be enough to make the nuget package build pass?

<_Asset PackagePath="tools/linux_x64/" Include="$(Assets_GrpcPlugins)protoc_linux_x64/grpc_csharp_plugin" />

<_Asset PackagePath="tools/macosx_x86/" Include="$(Assets_ProtoCompiler)macos_x86/protoc" /> <!-- GPB: macosx-->

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I included this in this PR.

Copy link
Contributor

@jtattermusch jtattermusch left a comment

Choose a reason for hiding this comment

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

LGTM once my comments are resolved and tests are looking good (including the artifact - package build - distribtest flow).

@jtattermusch
Copy link
Contributor

Artifact macos build fails with:

+ python3.8 -m pip install -U cython setuptools==44.1.1 wheel --user
github/grpc/tools/internal_ci/macos/grpc_build_artifacts.sh: line 32: python3.8: command not found

https://source.cloud.google.com/results/invocations/b134b8fd-af31-4133-a552-1c46bf8e7b3f/targets/grpc%2Fcore%2Fpull_request%2Fmacos%2Fgrpc_build_artifacts/log

@veblush
Copy link
Contributor Author

veblush commented Dec 1, 2020

Artifact macos build fails with:

+ python3.8 -m pip install -U cython setuptools==44.1.1 wheel --user
github/grpc/tools/internal_ci/macos/grpc_build_artifacts.sh: line 32: python3.8: command not found

https://source.cloud.google.com/results/invocations/b134b8fd-af31-4133-a552-1c46bf8e7b3f/targets/grpc%2Fcore%2Fpull_request%2Fmacos%2Fgrpc_build_artifacts/log

It is expected because this PR assumes that it runs on Mojave machines while the presubmit is still using High Sierra which doesn't have Python 3.7 and 3.8 installed.

@veblush
Copy link
Contributor Author

veblush commented Dec 1, 2020

FYI, this PR has been tested with the Adhoc MacOS job on Mojave for PHP, Python, Ruby, and BuildArtifacts.

@jtattermusch
Copy link
Contributor

@veblush #24870 now hopefully has all the necessary changes to drop protoc x86 macos artifacts without breaking the package build (a ruby package fix was also necessary).

@jtattermusch
Copy link
Contributor

#24870 has been merged - you can rebase now.

@@ -95,7 +95,7 @@ def create_jobspec(name,
return jobspec


_MACOS_COMPAT_FLAG = '-mmacosx-version-min=10.7'
_MACOS_COMPAT_FLAG = '-mmacosx-version-min=10.10'
Copy link
Contributor

Choose a reason for hiding this comment

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

qq: is this really needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesn't need to be part of this PR but I just make this consistent with the all other settings for OSX.

@jtattermusch
Copy link
Contributor

Artifact macos build fails with:

+ python3.8 -m pip install -U cython setuptools==44.1.1 wheel --user
github/grpc/tools/internal_ci/macos/grpc_build_artifacts.sh: line 32: python3.8: command not found

https://source.cloud.google.com/results/invocations/b134b8fd-af31-4133-a552-1c46bf8e7b3f/targets/grpc%2Fcore%2Fpull_request%2Fmacos%2Fgrpc_build_artifacts/log

It is expected because this PR assumes that it runs on Mojave machines while the presubmit is still using High Sierra which doesn't have Python 3.7 and 3.8 installed.

Got it, so you plan to merge this PR at the same time as submitting the cl that upgrades the mac jobs to mojave, right?

That kind of works, but I'd prefer this approach:

  • add a simple check whether python3.7 and 3.8 is available, and if not, run the existing commands to install them (this is pretty trivial to do) + add a TODO to remove later
  • that way, the macos artifact build (and all the other jobs that already pass) will pass on both high-sierra and mojave. That's a much better situation to be in since you can then submit your CL independently without breaking stuff and gives you rollback option in case issues arise - for contrast, if you rely on merging PR & CL in a lockstep and things break for some reason (which can easily happen in the complicated testing world we live in), you'll find yourself in a difficult situation that's hard to fix quickly and without impacting others.
  • once everything is running on macos mojave for a few days and things seem stable, you can remove the conditional python3.7 and python3.8 installation.

@veblush
Copy link
Contributor Author

veblush commented Dec 4, 2020

@jtattermusch You're right about my intention. I planned to do interlocked update with this and the internal CL because it doesn't seem feasible to make this run on both High Sierra and Mojave due to Ruby and PHP. Somehow it seems to work so let me try to make this runnable on both. Having Python 3.7 and 3.8 installed on High Sierra with conditional statements shouldn't be hard.

@veblush
Copy link
Contributor Author

veblush commented Dec 4, 2020

I'll merge this tomorrow (Dec 4) morning so that I can take action when something goes wrong.

@jtattermusch
Copy link
Contributor

@jtattermusch
Copy link
Contributor

@veblush This PR is looking good, so I'll actually merge it now to get the advantage of getting a few runs in before (your) morning.

@jtattermusch jtattermusch merged commit 17a7df4 into grpc:master Dec 4, 2020
yulin-liang added a commit to yulin-liang/grpc that referenced this pull request Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants