chocolatey / package-validator

Windows service to validate packages conform to package standards
Apache License 2.0
31 stars 29 forks source link

Need help on how to use (no windows service after install build.bat) #191

Closed tutelage closed 4 years ago

tutelage commented 4 years ago

We used build.bat to build the project. Currently it finishes with no major errors. The setup was on a win10 device. Sorry in advance if it's a rudimentary question, but we are unclear on the expectation of the project. README specifies a 'service', what is the expected name of the service, we didn't see one on our machine.

build.bat log


PS C:\WINDOWS\system32> cd C:\temp\ PS C:\temp> cd .\package-validator-master\package-validator-master\ PS C:\temp\package-validator-master\package-validator-master> .\build.bat [echo] Removing and adding C:\temp\package-validator-master\package-validator-master\build_output. [echo] Build for chocolatey.package.validator started at 09/26/2019 11:48:59 with UppercuT. [echo] Using UppercuT version: 1.4.2.0. [echo] ==================== [echo] UppercuTBuild [echo] ==================== [echo] ==================== [echo] GitVersioner [echo] ==================== [echo] Getting revision number from working directory 'C:\temp\package-validator-master\package-validator-master' or remotely at https://github.com/chocolatey/package-validator. [exec] fatal: not a git repository (or any of the parent directories): .git [exec] C:\temp\package-validator-master\package-validator-master.build\versioners\git.step(26,6): [exec] External Program Failed: git (return code was 128) [echo] Using revision number: fatal: not a git repository (or any of the parent directories): .git and hash: fatal: not a git repository (or any of the parent directories): .git. [echo] Using build number 0. [echo] Version full updated to 0.1.2.0. [echo] Compiled code drop directory will be C:\temp\package-validator-master\package-validator-master\code_drop. [echo] ==================== [echo] VersionBuilder [echo] ==================== [echo] Generating SolutionVersion.cs with assembly version 0.1.2.0. [echo] ==================== [echo] BuildInformation [echo] ==================== [echo] Generating XML file with some information to possibly get merged in at C:\temp\package-validator-master\package-validator-master\build_output_BuildInfo.xml. [echo] ==================== [echo] Compiler [echo] ==================== [echo] Setting compile variables [echo] Finding and restoring all packages (C:\temp\package-validator-master\package-validator-master\lib\NuGet\NuGet.exe restore 'C:\temp\package-validator-master\package-validator-master\src\chocolatey.package.validator.sln') [echo] Compiling C:\temp\package-validator-master\package-validator-master\src\chocolatey.package.validator.sln. [echo] Building on 4.0 [echo] Removing read only attributes that some source control things put on files in 'C:\temp\package-validator-master\package-validator-master\build_output'. [echo] ==================== [echo] EnvironmentBuilder [echo] ==================== [echo] ---------------- [echo] ConfigBuilder: Building Templates from 'C:\temp\package-validator-master\package-validator-master\build_output\chocolatey.package.validator' with '.template' as the name. [echo] ---------------- Looking for template files starting in "C:\temp\package-validator-master\package-validator-master\build_output\chocolatey.package.validator" and building to directory "C:\temp\package-validator-master\package-validator-master\build_output\environment.files". [echo] ---------------- [echo] SQLBuilder: Building Templates from 'C:\temp\package-validator-master\package-validator-master\build_output\chocolatey.package.validator.Database' with '.template' as the name. [echo] ---------------- Looking for template files starting in "C:\temp\package-validator-master\package-validator-master\build_output\chocolatey.package.validator.Database" and building to directory "C:\temp\package-validator-master\package-validator-master\build_output\chocolatey.package.validator.Database". [echo] ---------------- [echo] DocumentBuilder: Building Templates from 'C:\temp\package-validator-master\package-validator-master\build_output\docs' with '.xml' as the name. [echo] ---------------- Looking for template files starting in "C:\temp\package-validator-master\package-validator-master\build_output\docs" and building to directory "C:\temp\package-validator-master\package-validator-master\build_output\docs". [echo] ---------------- [echo] DocumentBuilder Part Deux: Building Templates from 'C:\temp\package-validator-master\package-validator-master\build_output\docs' with '.template' as the name. [echo] ---------------- Looking for template files starting in "C:\temp\package-validator-master\package-validator-master\build_output\docs" and building to directory "C:\temp\package-validator-master\package-validator-master\build_output\docs". [echo] ==================== [echo] Analyzers [echo] ==================== [echo] ==================== [echo] TestRunner [echo] ==================== [echo] ==================== [echo] NUnitTester [echo] ==================== [echo] Removing and adding C:\temp\package-validator-master\package-validator-master\build_output\build_artifacts\tests. [echo] Getting test dlls based on name in directory C:\temp\package-validator-master\package-validator-master\build_output\chocolatey.package.validator. [echo] Running NUnit against these test dlls - chocolatey.package.validator.tests.dll. [echo] Removing and adding C:\temp\package-validator-master\package-validator-master\build_output\build_artifacts\tests. [echo] Running tests using NUnit and putting results in C:\temp\package-validator-master\package-validator-master\build_output\build_artifacts\tests. Test Arguments: ' chocolatey.package.validator.tests.dll /xml="C:\temp\package-validator-master\package-validator-master\build_output\build_artifacts\tests\test-results.xml" /nologo /framework=net-4.0 /exclude="Database,Integration,Slow,NotWorking,Ignore,database,integration,slow,notworking,ignore"'. [echo] ==================== [echo] CoverageRunner [echo] ==================== [echo] ==================== [echo] OpenCover [echo] ==================== [echo] Removing and adding C:\temp\package-validator-master\package-validator-master\build_output\build_artifacts\codecoverage. [echo] Getting test dlls based on name in directory C:\temp\package-validator-master\package-validator-master\build_output\chocolatey.package.validator. [echo] Running OpenCover against these test dlls - chocolatey.package.validator.tests.dll [echo] Attempting to run OpenCover. Creating file at coverage.xml and logging at C:\temp\package-validator-master\package-validator-master\build_output\build_artifacts\codecoverage\chocolatey.package.validator.opencover.log. [echo] Running C:\temp\package-validator-master\package-validator-master\lib\OpenCover\OpenCover.Console.exe -target:'C:\temp\package-validator-master\package-validator-master\src\packages\NUnit.Runners.2.6.4\tools\nunit-console.exe' -targetdir:'C:\temp\package-validator-master\package-validator-master\build_output\chocolatey.package.validator' -targetargs:' chocolatey.package.validator.tests.dll' -filter:'+[chocolatey.package.validator] -[chocolatey.package.validatortest] -[chocolatey.package.validator]adapters. -[chocolatey.package.validator]infrastructure.app.configuration.Setting -[chocolatey.package.validator]app.configuration.Configuration -[chocolatey.package.validator]app.domain. -[chocolatey.package.validator]app.messages. -[chocolatey.package.validator].registration. -[chocolatey.package.validator]app.templates. -[chocolatey.package.validator]commandline.Option -[chocolatey.package.validator]licensing. -[chocolatey.package.validator]infrastructure.results.' -output:'C:\temp\package-validator-master\package-validator-master\build_output\build_artifacts\codecoverage\coverage.xml' -log:All -skipautoprops [echo] Attempting to run ReportGenerator. Creating HTML results file at chocolatey.package.validator.CodeCoverageSummary-results.html and XML results file at chocolatey.package.validator.CodeCoverageSummary-results.xml. [echo] ==================== [echo] FxCop Code Analysis [echo] ==================== [echo] Running FxCop Code Analysis against these files - chocolatey.package.validator.dll package-validator.exe. [echo] [echo] ==================== [echo] analyze POST Extension [echo] ==================== [echo] Running 'C:\temp\package-validator-master\package-validator-master.build.custom\analyze.post.step' - details will be in the build.log. [echo] Attempting to run StyleCop Analysis. Creating file at chocolatey.package.validator-results.xml. [echo] ==================== [echo] PackageBuilder [echo] ==================== [echo] Removing and adding C:\temp\package-validator-master\package-validator-master\code_drop. [echo] Removing and adding C:\temp\package-validator-master\package-validator-master\code_drop. [echo] Packaging build artifacts (such as test results) to C:\temp\package-validator-master\package-validator-master\code_drop\build_artifacts. [echo] Packaging application items to C:\temp\package-validator-master\package-validator-master\code_drop\chocolatey.package.validator. [echo] Packaging published applications to C:\temp\package-validator-master\package-validator-master\code_drop_PublishedApplications. [echo] Packaging website to C:\temp\package-validator-master\package-validator-master\code_drop_PublishedWebSites. [echo] Packaging database files to C:\temp\package-validator-master\package-validator-master\code_drop\chocolatey.package.validator.Database. [echo] Packaging reports to C:\temp\package-validator-master\package-validator-master\code_drop\chocolatey.package.validator.Reports. [echo] Packaging file server items to C:\temp\package-validator-master\package-validator-master\code_drop\file.server. [echo] Packaging output fileserver items to C:\temp\package-validator-master\package-validator-master\code_drop\FileServer. [echo] Packaging environment files to C:\temp\package-validator-master\package-validator-master\code_drop\environment.files. [echo] Packaging deployment scripts from 'C:\temp\package-validator-master\package-validator-master\deployment' to 'C:\temp\package-validator-master\package-validator-master\code_drop\deployment'. [echo] Packaging settings files to C:\temp\package-validator-master\package-validator-master\code_drop\settings. [echo] Removing read only attributes that some source control things put on files in 'C:\temp\package-validator-master\package-validator-master\code_drop'. [echo] Building Deployment Files. [echo] Copying C:\temp\package-validator-master\package-validator-master\build_output_BuildInfo.xml to build_artifacts, chocolatey.package.validator, and deployment in the C:\temp\package-validator-master\package-validator-master\code_drop folder. [echo] Packaging documentation files to C:\temp\package-validator-master\package-validator-master\code_drop\docs. [echo] [echo] ==================== [echo] package POST Extension [echo] ==================== [echo] Running 'C:\temp\package-validator-master\package-validator-master.build.custom\package.post.step' - details will be in the build.log. [echo] Removing C:\temp\package-validator-master\package-validator-master\code_drop\chocolatey.package.validator. [echo] Removing 'C:\temp\package-validator-master\package-validator-master\code_drop\docs'. [echo] Removing xml files from the bin folders. [echo] [echo] ==================== [echo] UppercuTBuild - FINISHED! [echo] ==================== [echo] Build for chocolatey.package.validator finished at 09/26/2019 11:50:10 with UppercuT version 1.4.2.0. [echo] See 'C:\temp\package-validator-master\package-validator-master\code_drop\build_artifacts\build.log' for detailed build log information.


Diagnosis: we did see a .exe in build-output.
C:\temp\package-validator-master\package-validator-master\build_output\chocolatey.package.validator\package-validator.exe So we try tried launching it directly or feed a nupkg to it.

We get this: Cannot start service from the command line or a debugger. A Windows Service must first be installed (using installutil.exe) and then started with the ServerExplorer, Windows Services Administrative tool or the NET START command.

Tried some troubleshooting but couldn't get past it; but not sure if this is what this project intended on using it this way.

Question: Once a project is built, what is the expected result? Is it supposed to be a Windows service? A service that can against any nuget pkg? If yes, are there more details and examples on how to do this?

...Or is this project itself an example? We ask because we saw the project seems to apply unit-tests on itself. Results generated during build+unit-test phase.

C:\temp\package-validator-master\package-validator-master\build_output\build_artifacts\tests\

If this is the caes, then how do we add a candidate nuget pkg for unit testing?
How do we customize the test(s) for that specific nuget package?

ferventcoder commented 4 years ago

Cannot start service from the command line or a debugger. A Windows Service must first be installed (using installutil.exe) and then started with the ServerExplorer, Windows Services Administrative tool or the NET START command.

package-validator.exe /console

ferventcoder commented 4 years ago

Once a project is built, what is the expected result?

That you have the binaries you can run as a service or a console.

Is it supposed to be a Windows service? A service that can against any nuget pkg?

Yes and no, it is only set up for use against the community repository currently.

If yes, are there more details and examples on how to do this?

Not exactly, this is more intended for our use, we are just sharing the source with folks so those that are savvy could use it as an example to build something for their purposes. HTH

tutelage commented 4 years ago

Cannot start service from the command line or a debugger. A Windows Service must first be installed (using installutil.exe) and then started with the ServerExplorer, Windows Services Administrative tool or the NET START command.

package-validator.exe /console

Hi Thanks for this. As a follow-up, where does one provide specify the path or provide the nuget pkg for the scan?


XmlConfiguration is now operational Performing bootstrapping operations for 'chocolatey-package-validator'. Starting chocolatey-package-validator (vfatal: not a git repository (or any of the parent directories): .git) service. StartupTask will send startup message in 15000 milliseconds CheckForPackagesTask will check for packages to validate every 5 minute(s). DownloadSubmittedPackageTask is now ready and waiting for ValidatePackageMessage ValidatePackageTask is now ready and waiting for PackageReadyForValidationMessage PrepareValidationResultsTask is now ready and waiting for PackageValidationResultMessage CleanupDownloadedPackageTask is now ready and waiting for PackageFinishedValidationMessage UpdateWebsiteInformationTask is now ready and waiting for FinalPackageValidationResultMessage chocolatey-package-validator service is now operational. Press Control+C to exit. StartupTask is sending startup message Sending message 'StartupMessage' out if there are subscribers...


mkevenaar commented 4 years ago

I believe this tool was designed to verify packages uploaded to an website like chocolatey.org, and not for scanning individual packages.