-
Notifications
You must be signed in to change notification settings - Fork 683
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
Improve build system; add e2e tests, docker CD, FAKE, paket #108
Conversation
This should provide sufficient environment for building and testing on linux. Includes debian and alpine based images For usage see https://github.com/ai-traders/docker-dotnet-ide
In development the application can now be run to proxy to the react development server. This resolves the problem where the code needs to be changed in development to point to the server correcly (which is running on a different port). I also modified the csproj file to have msbuild copy the required front-end files to the publish folder when needed. Therefore the built files no longer need to be copied over and permanently stored in the wwwroot because in development the requests are proxied, and in production the files are copied to the publish folder.
- remove the target in msbuild, which has ugly workarounds for even such a simple job as copying some files. - we can still use msbuild in debug config to rebuild spa, which convenient for quick iterations - use FAKE tasks to create final SPA site and put it in publish directory. - added e2e test that validates that SPA is returned by built docker image - updates IDE docker image to include node.js and yarn
Hey @tomzo, I apologize for the incredibly long response time. I feel conflicted with these changes as I want to keep BaGet as simple as possible. IDE project: Paket:
This is possible using NuGet too (see the ASP.NET Core repository for an example). NuGet will be improving this experience in the future, see this spec: Centrally managing NuGet package versions. The
Yes, this a feature that NuGet is sorely lacking. We are actively working on this, see this announcement.
Out of curiosity, why do you want to use the nuget CLI on linux? The dotnet CLI should have most everything you need. FAKE:
I 110% agree. I'm very torn about this as I very much dislike MSBuild. However, I want to keep BaGet as approachable as possible to all .NET developers. I don't think FAKE fits well with this goal.
I agree that we should avoid this. If possible, I'd like to keep all tasks in MSBuild (😢). Is there anything in particular that you think would be too crazy for MSBuild? Okay, I'm gonna stop here as I'd love to hear your thoughts @tomzo. I realize that I haven't addressed your test and Docker changes. I'm much more onboard with these changes, so that should be smoother :) |
Without
nuget cli has
I don't see a problem in running msbuild for restore, build and test. Because those tasks are trivial.
But you are saying that we cannot use FAKE, paket and IDE. Each of those is critical to make those end tests work. Sorry, but I won't be rebasing those tests without any framework, because it would be a lot of wasted time on setups, which would only poorly mimic the tools needed to get the job done. My initial intent was to replace LiGet by merging most of it into BaGet and then move to it. I have mostly done it already in my fork. But now it looks to me that we have different objectives about nuget server project. |
As someone external, I hope that we can find some middle ground on this. The 2 things I think this project is missing is the end to end tests to prove it works the same as nuget. The ability for someone to pick up a docker image, or package to host themselves. My suggestion is to work out how to add these tests and other changes which add value to the project, and then investigate other build tools for example appveyor or Azure pipelines. |
That's completely fair. I'd like to investigate @BlythMeister's suggestion of Azure pipelines for releases.
Will do . Thank you for the great work.
This sounds interesting @BlythMeister . Do you know of other projects that support self hosting through packages? I'd love to mimic their setup. @tomzo If BaGet had tests and was packaged into NuGet packages, would this be a good middleground? |
I don't know of any...but if it helps, I ran a dotnet publish and then got the output. An Azure pipelines might even be able to publish that into GitHub...and maybe push the docker image into docker hub...then your totally cooking on gas. I played a but with pipelines, they look powerful. Also, some useful quick start guides (happy to write one for self hosting since that's my approach using iis as a reverse proxy) |
I've added Continuous Delivery to BaGet. You can:
I'll add support for Docker images in the future. Please let me know what you think! |
What does this PR do?
Idefile
, which is a reference to docker IDE image, which contains all build dependencies (dotnet, node.js, yarn, bats for e2e tests). If you have local docker daemon then you can run any of the build tasks like this nowide <command>
. E.g.ide ./build.sh
will run msbuild publish and run tests with xunit.msbuild /t:Publish
in the docker image. And we are not using docker BUILD container, but using the same artifacts that were tested in previous stage.Dockerfile is changed a bit:
baget
user.baget
user based on owner of volume mount.docker run baget
.Closes Issue(s)
#57 #56 #101 #7
Motivation
In general - I need BaGet to be functional and tested before I can use it in production. I don't want to waste time on testing features and fixing bugs which get randomly broken because there are no tests, no reproducible builds and no release cycle.
Why
Idefile
and IDE project:Why paket:
paket.dependencies
gives you an quick overview of all packages used by application.paket.lock
gives you detailed info about each version of all direct and transitive dependencies.dotnet
SDK. There is no nuget CLI for linux which works without mono, and I managed to keep away from mono so far.Why FAKE:
Why I am running tests with
dotnet ...xunit.console.dll <assemblies-from-publish-dir>
?The main point in CD is that artifacts which constitute the application should be produced just once and then ran through all QA stages. We really need to be testing exactly the same files at each point until final release to ensure quality. In dotnet world that means using
dotnet publish
to force outputting application and all all its dependencies.One of the common issues I had with dotnet assemlies is that running with dotnet test adapter uses additional assemblies from nuget caches. So I've seen tests passing when ran with
dotnet test
ordotnet xunit
, but when same test is executed withdotnet ...xunit.console.dll <assemblies-from-publish-dir>
it fails. Naturally same load errors happen in deployed application (after all tests have passed earlier...). So running tests withpublish
reproduces those errors and makes sure that we get load errors early.PS: I actually ran into this already in BaGet and fixed it. The
Microsoft.AspNetCore.App
in BaGet.Tests was causing problems like this:Additional Notes
I will be away for weekend, so I can have a look at review notes on Monday.
I am closing #103 and #105 , and I hope @solidsloth can close #101 since this contains the work and original intentions.