-
Notifications
You must be signed in to change notification settings - Fork 903
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
(#2400) Replace UppercuT with Chocolatey.Cake.Recipe #2706
Conversation
@gep13 as discussed on Slack, I have pushed to your branch here two commits. The first commit updates the pester test infrastructure to look for the new nupkg location, and updates the Vagrantfile to prevent most of the output from the build due to what appears to be a buffer overflow issue with vagrant. The second commit is intended for you to rebase away when you go in and update the Tests are running successfully as they did with UpperCuT, and can be run by navigating to |
For the docker-build error, I am getting the same message about LibGit2Sharp locally. It should theoretically be fixed by updating the version of Cake.Git used. Bumping the version to I'm running into a gitversion error when the LibGit2Sharp error is fixed, but later on. |
@TheCakeIsNaOH can you shed any light on why this action is being marked as successful, even though the build itself fails: https://github.com/chocolatey/choco/runs/6241475808?check_suite_focus=true#step:3:721 I think I am missing something in terms of how Cake is being called, but I am not sure. Ignore the gitversion error, I am working on that, but leaving this in as a test to actually have the build marked as failed. |
@gep13 perhaps the Try setting the unofficial strict mode for bash, via adding |
Trying now... Thanks! |
@TheCakeIsNaOH that did it, thank you! All the builds are now correctly failing! Now we need to get them all passing 😄 |
Yup, at least there is progress being made. Don't forget to add that line to the other |
eaeb8e0
to
f1bf8bd
Compare
@TheCakeIsNaOH @vexx32 @corbob @JPRuskin @Windos I "think" I have most of the pieces in place here (aside from the failing Docker build)... Would be good if you could all take a look at the changes that I have made here, take it for a spin, and let me know if you have any questions or concerns. Thanks! |
What about the |
That is a good catch. We will likely need to add another task in the Recipe to cover that. |
9b0f662
to
87e201a
Compare
@TheCakeIsNaOH @AdmiringWorm so, I have all the builds now succeeding, although I have now broken the local build of the docker image 😢 The issue here is that by introducing the environment variables from the GitHub Actions provider to the docker file (in order to get it to understand that it was building on GitHub actions), due to the way that GitVersion works, it now also thinks it is running on GitHub Actions when it is running locally. Ideally, what I want to do is to conditionally do this work:
Based on the build arguments being passed in. If they are not there, I don't want the environment variables to be set at all. Any ideas? |
@gep13 this is not something I have had to do before, but here are some possibilities of what might work:
|
I had the same thought about using a separate Dockerfile, but I am not sure if I am a fan of that approach 😄 I will have a play with one of the conditional approaches in that Stack Overflow question (I actually think I read that question earlier today) to see if anything helps there. We are so close with all of this I think! |
This is now working for me locally on Windows, Debian, and in Docker! 🥳 |
Woot! Thanks for confirming! |
@TheCakeIsNaOH @vexx32 @corbob @JPRuskin @Windos I need to rebase some things, but I believe that this is now ready for reviewing/merging. Once I have finished rebasing, I will mark this PR as ready. |
4dfdb52
to
a26e9fe
Compare
@TheCakeIsNaOH @vexx32 @corbob @JPRuskin @Windos this is now ready for review. Have fun, I know I did! 🎉 |
These are no longer required, as all the functionality is now being provided by Chocolatey.Cake.Recipe.
Previously, the UppercuT build required that all tools were either already installed on the machine, or present in the lib folder of the repository. This strategy is no longer required, as the Chocolatey.Cake.Recipe already has the ability to download the tools when required as part of the build process.
Storing the NuGet.exe is in the repository is no longer required. This tool will be resolved, as required, when the build runs.
Chocolatey.Cake.Recipe is quite opinionated about the folder structure that is used when creating Chocolatey and NuGet packages. It expects all nuspec files to be stored in a folder structure like the following: - nuspec - chocolatey - nuget With the UppercuT build, this structure existed, just in a slightly different way. This commit updates the folder structure to be what is required.
This includes pinning to the currently supported version of Cake, 0.38.5, and also to include a cake.config file to allow overridding of the checks that Cake does of out of support addins (these are knowingly being overridden at the minute). The Cake bootstrappers that are being used in the Chocolatey GUI build have been copied over into this repository. Within the recipe.cake file, the project specific changes have been made, including which files should be signed, ILMerge'd, etc.
Rather than calling into UppercuT the build entry files, i.e. build.bat, etc, have been updated to call into Cake.
Cake outputs to a new file (and a lot to the terminal). This updates the script used for running the tests to default to the new location. We also update the Vagrantfile to silently absorb the output from the build script as it seems to output too fast for vagrant to handle consistently.
The folder structure has changed, as a result, changes to the build, as well as what parameters are passed into the build, need to be made to match the new way of doing things.
This will mean that the generated release notes are using the standard look and feel that we want for all release notes.
The strucutre of the code_drop folder has changed, and the docker portion of the build needs to be updated to reflect this new structure.
This NuGet package is no longer required, as the work that it was doing is now being handled within the Chocolatey.Cake.Recipe. i.e. the output from the different project types is now copied to the correct locations as part of the build process.
This is not currently being used, and can be removed as it will reduce maintenance overhead going forward.
A lot of the work that was previously being done in the TeamCity settings file is now done by the Recipe, and therefore can be removed.
In order to get the build to work correctly, we need to install a newer version of git on the build machine (this means using the backports registry) and also to install the .NET CLI.
In order for the Cake Build to correctly identify that it is running on GitHub Actions, in order to assert teh correct branch name to use the environment variables from the GitHub Actions build image have to be passed through to the execution of Docker. We don't need all the variables, just the ones used by Cake to make some assertions.
To account for the new way that things are executed under Chocolatey.Cake.Recipe.
The ordering of the tasks was thrown out a bit due to the introduction of the Prepare-NuGet-Packages and Prepare-Chocolatey-Packages tasks. This corrects that issue, and also maps all the required files
This will mean that Cake and the other tools/dependencies won't need to be resolved/downloaded each time.
I believe that the failing Mac build here is due to this issue: actions/runner-images#5768 (comment) As such, I am going to say that we can ignore this failure, and move forward with the merging of this PR. |
Description Of Changes
This PR removes the existing UppercuT build, and replaces it with Chocolatey.Cake.Recipe, which is an opinionated
set of build scripts that use Cake scripting under the hood. This recipe is already being used on a number of projects
internally, and it makes sense to use it on our open source projects as well.
Motivation and Context
The UppercuT build is starting to show its age, and isn't easy to update and maintain.
The Chocolatey.Cake.Recipe package means that the same build process can be shared across a number of projects
with each project only needing to provide the project specific pieces of information to make the build work.
Testing
I have built this locally on my machine (which has access to the signing certificates) and the generated assembly contains what is expected, i.e. correctly signed choco.exe, chocolatey.dll, PowerShell scripts, etc.
In order to test this properly, we will need to get this onto a complete integration tests execution internally, and verify that all the tests work as expected.
NOTE: The production CI build won't work until this PR is merged, as there were changes to the CI configuration that won't take affect until the merge happens.
Change Types Made
Related Issue
Fixes #2400
Change Checklist