chocolatey / choco

Chocolatey - the package manager for Windows
https://chocolatey.org
Other
10.28k stars 902 forks source link

Dockerfile build does not set version information. #2023

Closed TheCakeIsNaOH closed 4 years ago

TheCakeIsNaOH commented 4 years ago

What You Are Seeing?

The build in the docker container does not set the version information because git is not installed inside the container.

What is Expected?

The version information is set correctly.

How Did You Get This To Happen? (Steps to Reproduce)

  1. Build docker container 1a. See that git failed to start and that the 'version.revision.output' has not been set.
  2. Run docker container
  3. Run choco in container
  4. Chocolatey is v0

Output Log

Build output

~~~sh Sending build context to Docker daemon 239.5MB Step 1/12 : FROM mono:5.20.1.19 ---> 831a16f6ca10 Step 2/12 : MAINTAINER Justin Phelps ---> Using cache ---> 13e37390c228 Step 3/12 : COPY . /usr/local/src/choco/ ---> 4146055b51be Step 4/12 : WORKDIR /usr/local/src/choco ---> Running in 9f4c69f0b759 Removing intermediate container 9f4c69f0b759 ---> 50208933b4da Step 5/12 : RUN chmod +x build.sh ---> Running in 92e7a7d27f37 Removing intermediate container 92e7a7d27f37 ---> 2449f00da6f9 Step 6/12 : RUN chmod +x zip.sh ---> Running in 84a6fd804cde Removing intermediate container 84a6fd804cde ---> 7a546ac3b375 Step 7/12 : RUN ./build.sh ---> Running in 258ff70c8201 [echo] Removing and adding /usr/local/src/choco/build_output. [echo] Build for chocolatey started at 04/02/2020 01:57:15 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 '/usr/local/src/choco' or remotely at https://github.com/chocolatey/choco. [exec] /usr/local/src/choco/.build/versioners/git.step(26,6): [exec] 'git' failed to start. /usr/local/src/choco/.build/versioners/git.step(40,7): Property evaluation failed. Expression: ${string::trim(version.revision.output)} ^^^^^^^^^^^^^^^^^^^^^^^ Property 'version.revision.output' has not been set. [nant] Nested build failed. Refer to build log for exact reason. [echo] Using revision number: 0 and hash: 0. [echo] Using build number 0. [echo] Version full updated to 0.10.16.0. [echo] Compiled code drop directory will be /usr/local/src/choco/code_drop. [echo] ==================== [echo] VersionBuilder [echo] ==================== [echo] Generating a strong name key (/usr/local/src/choco/chocolatey.snk) using /usr/local/src/choco/.build/Microsoft SDKs/Windows/v6.0A/Bin/sn.exe if the key file doesn't already exist. [echo] Generating SolutionVersion.cs with assembly version 0.10.16.0. [echo] ==================== [echo] BuildInformation [echo] ==================== [echo] Generating XML file with some information to possibly get merged in at /usr/local/src/choco/build_output/_BuildInfo.xml. [echo] ==================== [echo] Compiler [echo] ==================== [echo] [echo] ==================== [echo] compile PRE Extension [echo] ==================== [echo] Running '/usr/local/src/choco/.build.custom/compile.pre.step' - details will be in the build.log. [echo] Copying NuGet.Core prior to compiling. This helps resolve issues with Mono 3.12.0. [echo] Setting compile variables [echo] Finding and restoring all packages (/usr/local/src/choco/lib/NuGet/NuGet.exe restore '/usr/local/src/choco/src/chocolatey.sln') [echo] Compiling /usr/local/src/choco/src/chocolatey.sln. [echo] Building on 4.5 [echo] Building... [echo] Working directory /usr/local/src/choco/build_output [echo] Running xbuild /usr/local/src/choco/src/chocolatey.sln /nologo /property:OutputPath='/usr/local/src/choco/build_output/chocolatey' /property:Configuration=Release /verbosity:detailed /toolsversion:4.5 /property:Platform='Any CPU' /property:TargetFrameworkVersion=v4.5 /l:ThoughtWorks.CruiseControl.MSBuild.XmlLogger,"/usr/local/src/choco/lib/NAnt/ThoughtWorks.CruiseControl.MSBuild.dll";'/usr/local/src/choco/build_output/build_artifacts/compile/msbuild-mono-4.5-results.xml' [echo] Copying documentation files to /usr/local/src/choco/build_output/docs. [echo] Removing read only attributes that some source control things put on files in '/usr/local/src/choco/build_output'. [echo] ==================== [echo] Analyzers [echo] ==================== [echo] ==================== [echo] TestRunner [echo] ==================== [echo] ==================== [echo] NUnitTester [echo] ==================== [echo] Removing and adding /usr/local/src/choco/build_output/build_artifacts/tests. [echo] Getting test dlls based on name in directory /usr/local/src/choco/build_output/chocolatey. [echo] Running NUnit against these test dlls - /usr/local/src/choco/build_output/chocolatey/chocolatey.tests.dll. [echo] Removing and adding /usr/local/src/choco/build_output/build_artifacts/tests. [echo] Running tests using NUnit and putting results in /usr/local/src/choco/build_output/build_artifacts/tests. Test Arguments: ' /usr/local/src/choco/build_output/chocolatey/chocolatey.tests.dll --xml="/usr/local/src/choco/build_output/build_artifacts/tests/test-results.xml" --nologo --exclude="Database,Integration,Slow,NotWorking,Ignore,database,integration,slow,notworking,ignore"'. [echo] ==================== [echo] CoverageRunner [echo] ==================== [echo] ==================== [echo] OpenCover [echo] ==================== [echo] Removing and adding /usr/local/src/choco/build_output/build_artifacts/codecoverage. [echo] OpenCover/ReportGenerator doesn't work on Mono. [echo] [echo] ==================== [echo] opencover.cover POST Extension [echo] ==================== [echo] Running '/usr/local/src/choco/.build.custom/analyzers/opencover.cover.post.step' - details will be in the build.log. [echo] Uploading Code Coverage Results to Coveralls if ENV['COVERALS_REPO_TOKEN'] is set. [echo] ==================== [echo] PackageBuilder [echo] ==================== [echo] Removing and adding /usr/local/src/choco/code_drop. [echo] Removing and adding /usr/local/src/choco/code_drop. [echo] Packaging build artifacts (such as test results) to /usr/local/src/choco/code_drop/build_artifacts. [echo] Packaging application items to /usr/local/src/choco/code_drop/chocolatey. [echo] Packaging published applications to /usr/local/src/choco/code_drop/_PublishedApplications. [echo] Packaging website to /usr/local/src/choco/code_drop/_PublishedWebSites. [echo] Packaging database files to /usr/local/src/choco/code_drop/chocolatey.Database. [echo] Packaging reports to /usr/local/src/choco/code_drop/chocolatey.Reports. [echo] Packaging file server items to /usr/local/src/choco/code_drop/file.server. [echo] Packaging output fileserver items to /usr/local/src/choco/code_drop/FileServer. [echo] Packaging environment files to /usr/local/src/choco/code_drop/environment.files. [echo] Packaging deployment scripts from '/usr/local/src/choco/deployment' to '/usr/local/src/choco/code_drop/deployment'. [echo] Packaging settings files to /usr/local/src/choco/code_drop/settings. [echo] Removing read only attributes that some source control things put on files in '/usr/local/src/choco/code_drop'. [echo] Building Deployment Files. [echo] Copying /usr/local/src/choco/build_output/_BuildInfo.xml to build_artifacts, chocolatey, and deployment in the /usr/local/src/choco/code_drop folder. [echo] Packaging documentation files to /usr/local/src/choco/code_drop/docs. [echo] [echo] ==================== [echo] package POST Extension [echo] ==================== [echo] Running '/usr/local/src/choco/.build.custom/package.post.step' - details will be in the build.log. [echo] Removing /usr/local/src/choco/code_drop/chocolatey. [echo] Renaming /usr/local/src/choco/code_drop/_PublishedApplications/chocolatey.console to /usr/local/src/choco/code_drop/chocolatey/console. [echo] Renaming /usr/local/src/choco/code_drop/_PublishedApplications/chocolatey to /usr/local/src/choco/code_drop/chocolatey/lib. [echo] ==================== [echo] CUSTOM Code Sign [echo] ==================== [echo] Signing the assemblies and powershell files if the system is set up correctly. [echo] [echo] ==================== [echo] UppercuTBuild - FINISHED! [echo] ==================== [echo] Build for chocolatey finished at 04/02/2020 01:57:53 with UppercuT version 1.4.2.0. [echo] See '/usr/local/src/choco/code_drop/build_artifacts/build.log' for detailed build log information. Removing intermediate container 258ff70c8201 ---> 59e1e02cf2e2 Step 8/12 : WORKDIR /usr/local/bin ---> Running in b2f5c59b9d59 Removing intermediate container b2f5c59b9d59 ---> b0690d980315 Step 9/12 : RUN ln -s /usr/local/src/choco/code_drop/chocolatey ---> Running in 49f4c8b8ce9f Removing intermediate container 49f4c8b8ce9f ---> 88ac98f95136 Step 10/12 : COPY docker/choco_wrapper /usr/local/bin/choco ---> 52718db1fce4 Step 11/12 : ENV ChocolateyInstall /usr/local/bin/chocolatey ---> Running in a369ffbfefbe Removing intermediate container a369ffbfefbe ---> 2de88f67ab23 Step 12/12 : WORKDIR /root ---> Running in 66245b876dd6 Removing intermediate container 66245b876dd6 ---> 65761fba28b4 Successfully built 65761fba28b4 Successfully tagged mono-choco:latest ~~~

What to do about it

Install git in the container before building chocolatey

TheCakeIsNaOH commented 4 years ago

Fixed via #2024