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

Add CI validation leg for source-build against an image with the tools our source-build partners use to ensure we don't break our source-build partners. #50811

Merged
11 commits merged into from
Apr 10, 2021

Conversation

jkoritzinsky
Copy link
Member

@jkoritzinsky jkoritzinsky commented Apr 6, 2021

This should help us ensure that we won't break RedHat by relying on newer tool versions than what they have available when building from source.

…s our source-build partners use to ensure we don't break our source-build partners.
@jkoritzinsky jkoritzinsky added source-build Issues relating to dotnet/source-build area-Infrastructure labels Apr 6, 2021
@jkoritzinsky jkoritzinsky requested a review from a team April 6, 2021 21:30
@ghost
Copy link

ghost commented Apr 6, 2021

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Issue Details

This should help us ensure that we won't break RedHat by relying on newer tool versions than what they have available when building from source.

Blocked on #50805

cc: @omajid

Author: jkoritzinsky
Assignees: -
Labels:

area-Infrastructure, source-build

Milestone: -

@hoyosjs
Copy link
Member

hoyosjs commented Apr 7, 2021

@jkoritzinsky do you know who's the runtime's sourcebuild champion? We need to add one leg for sourcebuild for PR + official and wanted to make sure we are not repeating work here.

@jkoritzinsky
Copy link
Member Author

I'm not sure who the contact is. @dagood do you know?

@hoyosjs
Copy link
Member

hoyosjs commented Apr 7, 2021

Looks like @jaredpar is the runtime's source-build champion. The tracking issue I believe is dotnet/source-build#2052

@ericstj
Copy link
Member

ericstj commented Apr 7, 2021

@Anipik set up the existing source build leg and drove most of our source-build changes in 5.0.

@dagood
Copy link
Member

dagood commented Apr 7, 2021

/cc @dseefeld @crummel @MichaelSimons

@jkoritzinsky
Copy link
Member Author

I do not know why the Docker container is failing to initialize in the new leg. @omajid @mthalman do you have any ideas?

@omajid
Copy link
Member

omajid commented Apr 7, 2021

(Please feel free to replace podman with docker below)

$ podman inspect mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-source-build-20201227183738-5fe0e50 --format json | jq '.[0].Config.Entrypoint'
[
  "scl",
  "enable",
  "llvm-toolset-7.0",
  "bash"
]

So this has the default ENTRYPOINT of scl enable llvm-toolset-7.0 bash

scl enable is a funny command: it treats the last argument as the command and the rest as the name of things it needs to enable.

The entrypoint by itself works. But if you add additional arguments (such as sh -c "command -v bash"), that turns the scl command into something like scl enable llvm-toolset-7.0 bash "sh -c \"command -v bash\"". That makes scl enable try and enable llvm-toolset-7.0 (that's fine) as well as bash (that's bad). That leads to an error like this:

$ podman run -it mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-source-build-20201227183738-5fe0e50 /usr/bin/bash
Unable to open /etc/scl/conf/bash!

Overriding the entrypoint makes it work:

$ podman run -it --entrypoint '/usr/bin/scl' mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-source-build-20201227183738-5fe0e50 enable llvm-toolset-7.0 -- bash
[root@c8d0d4ef2601 /]# 

I guess the a better entrypoint in that container would be something like scl enable llvm-toolset-7.0 -- bash? The -- says everything after that is a command.

@jkoritzinsky
Copy link
Member Author

Looks like the best entrypoint I can tell is scl enable llvm-toolset-7.0 --. That way whatever the provided program is will run in the right context. It kind of blocks doing a regular docker run -it without providing a program, but I think that's fine for our use case.

@jkoritzinsky
Copy link
Member Author

Docker image update PR at dotnet/dotnet-buildtools-prereqs-docker#434

@omajid
Copy link
Member

omajid commented Apr 7, 2021

Could we also sneak in a --portableBuild false in here?

It came up in #50097 and #42415

@jkoritzinsky
Copy link
Member Author

That's a good idea. I'll try to hook that in as well.

@omajid
Copy link
Member

omajid commented Apr 8, 2021

ERROR: No usable version of clang found.

Seems like either clang is not installed, or the scl command (or something else) didn't kick in...

@jkoritzinsky
Copy link
Member Author

It works on the image locally on my machine, so I'm not sure what the problem is on CI.

@omajid
Copy link
Member

omajid commented Apr 8, 2021

Do you know a way to see what the exact docker command it runs for the build? It seems to run docker exec in the "Initialize containers" phase, but I can't see the build command. I wonder if docker exec bypasses ENTRYPOINT...

@jkoritzinsky
Copy link
Member Author

Tested this locally. Apparently docker exec doesn't use ENTRYPOINT. That's only used by the initial entrypoint into the image, not for any other commands run in an existing container. I'll investigate and see what I can come up with. I might have to modify the CI scripts to include the scl command. 😢

… it for command executed in a running container.
@jkoritzinsky
Copy link
Member Author

Got it building by adding the scl enable command explicitly to the build command.

@jkoritzinsky
Copy link
Member Author

@jaredpar @dagood @omajid do we care about building MonoVM from a source-build perspective?

@omajid
Copy link
Member

omajid commented Apr 8, 2021

No. It's not part of the final shipped .NET sdk, so source-build doesn't care about it.

@jkoritzinsky jkoritzinsky marked this pull request as ready for review April 9, 2021 23:04
@jkoritzinsky
Copy link
Member Author

This is ready for review.

@jkoritzinsky
Copy link
Member Author

@omajid once #50097 gets in, we can add the --portableBuild false flag to this leg.

@ghost
Copy link

ghost commented Apr 9, 2021

Hello @jkoritzinsky!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 5e41195 into dotnet:main Apr 10, 2021
@ghost ghost locked as resolved and limited conversation to collaborators May 10, 2021
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
@jkoritzinsky jkoritzinsky deleted the source-build-validation branch September 28, 2021 00:04
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Infrastructure source-build Issues relating to dotnet/source-build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants