Selaa lähdekoodia

Windows updates for .git in .dockerignore

Signed-off-by: John Howard jhoward@microsoft.com
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
John Howard 8 vuotta sitten
vanhempi
commit
f32b267d1c
2 muutettua tiedostoa jossa 17 lisäystä ja 20 poistoa
  1. 9 13
      Dockerfile.windows
  2. 8 7
      hack/make.ps1

+ 9 - 13
Dockerfile.windows

@@ -71,8 +71,9 @@
 #
 #
 # 4. Build the docker executable binaries by running one of the following:
 # 4. Build the docker executable binaries by running one of the following:
 #
 #
-#    >>   docker run --name binaries nativebuildimage hack\make.ps1 -Binary
-#    >>   docker run --name binaries -m 2GB nativebuildimage hack\make.ps1 -Binary    (if using Hyper-V containers)
+#    >>   $DOCKER_GITCOMMIT=(git rev-parse --short HEAD)
+#    >>   docker run --name binaries -e DOCKER_GITCOMMIT=$DOCKER_GITCOMMIT nativebuildimage hack\make.ps1 -Binary
+#    >>   docker run --name binaries -e DOCKER_GITCOMMIT=$DOCKER_GITCOMMIT -m 2GB nativebuildimage hack\make.ps1 -Binary    (if using Hyper-V containers)
 #
 #
 #
 #
 # 5. Copy the binaries out of the container, replacing HostPath with an appropriate destination 
 # 5. Copy the binaries out of the container, replacing HostPath with an appropriate destination 
@@ -98,19 +99,14 @@
 # -----------------------------------------------------------------------------------------
 # -----------------------------------------------------------------------------------------
 
 
 
 
-#  The validation tests can either run in a container, or directly on the host. To run in a
-#  container, ensure you have created the nativebuildimage above. Then run one of the
-#  following from an (elevated) Windows PowerShell prompt:
-#
-#    >>   docker run --rm nativebuildimage hack\make.ps1 -DCO -PkgImports -GoFormat
-#    >>   docker run --rm -m 2GB nativebuildimage hack\make.ps1 -DCO -PkgImports -GoFormat    (if using Hyper-V containers)
-
-# To run the validation tests on the host, from the root of the repository, run the
-# following from a Windows PowerShell prompt (elevation is not required): (Note Go
-# must be installed to run these tests)
+#  The validation tests can only run directly on the host. This is because they calculate
+#  information from the git repo, but the .git directory is not passed into the image as
+#  it is excluded via .dockerignore. Run the following from a Windows PowerShell prompt
+#  (elevation is not required): (Note Go must be installed to run these tests)
 #
 #
 #    >>   hack\make.ps1 -DCO -PkgImports -GoFormat
 #    >>   hack\make.ps1 -DCO -PkgImports -GoFormat
 
 
+
 # -----------------------------------------------------------------------------------------
 # -----------------------------------------------------------------------------------------
 
 
 
 
@@ -124,7 +120,7 @@
 # -----------------------------------------------------------------------------------------
 # -----------------------------------------------------------------------------------------
 
 
 
 
-#  To run all tests and binary build, ensure you have created the nativebuildimage above. Then 
+#  To run unit tests and binary build, ensure you have created the nativebuildimage above. Then 
 #  run one of the following from an (elevated) Windows PowerShell prompt:
 #  run one of the following from an (elevated) Windows PowerShell prompt:
 #
 #
 #    >>   docker run nativebuildimage hack\make.ps1 -All
 #    >>   docker run nativebuildimage hack\make.ps1 -All

+ 8 - 7
hack/make.ps1

@@ -21,7 +21,7 @@
                 "hack\make.ps1 -Client" to build just the client 64-bit binary
                 "hack\make.ps1 -Client" to build just the client 64-bit binary
                 "hack\make.ps1 -TestUnit" to run unit tests
                 "hack\make.ps1 -TestUnit" to run unit tests
                 "hack\make.ps1 -Binary -TestUnit" to build the binaries and run unit tests
                 "hack\make.ps1 -Binary -TestUnit" to build the binaries and run unit tests
-                "hack\make.ps1 -All" to run everything this script knows about
+                "hack\make.ps1 -All" to run everything this script knows about that can run in a container
 
 
 .PARAMETER Client
 .PARAMETER Client
      Builds the client binaries.
      Builds the client binaries.
@@ -48,24 +48,23 @@
      Adds a custom string to be appended to the commit ID (spaces are stripped).
      Adds a custom string to be appended to the commit ID (spaces are stripped).
 
 
 .PARAMETER DCO
 .PARAMETER DCO
-     Runs the DCO (Developer Certificate Of Origin) test.
+     Runs the DCO (Developer Certificate Of Origin) test (must be run outside a container).
 
 
 .PARAMETER PkgImports
 .PARAMETER PkgImports
-     Runs the pkg\ directory imports test.
+     Runs the pkg\ directory imports test (must be run outside a container).
 
 
 .PARAMETER GoFormat
 .PARAMETER GoFormat
-     Runs the Go formatting test.
+     Runs the Go formatting test (must be run outside a container).
 
 
 .PARAMETER TestUnit
 .PARAMETER TestUnit
      Runs unit tests.
      Runs unit tests.
 
 
 .PARAMETER All
 .PARAMETER All
-     Runs everything this script knows about.
+     Runs everything this script knows about that can run in a container.
 
 
 
 
 TODO
 TODO
 - Unify the head commit
 - Unify the head commit
-- Sort out the GITCOMMIT environment variable in the absence of a .git (longer term)
 - Add golint and other checks (swagger maybe?)
 - Add golint and other checks (swagger maybe?)
 
 
 #>
 #>
@@ -314,7 +313,9 @@ Try {
     Push-Location $root
     Push-Location $root
 
 
     # Handle the "-All" shortcut to turn on all things we can handle.
     # Handle the "-All" shortcut to turn on all things we can handle.
-    if ($All) { $Client=$True; $Daemon=$True; $DCO=$True; $PkgImports=$True; $GoFormat=$True; $TestUnit=$True }
+    # Note we expressly only include the items which can run in a container - the validations tests cannot
+    # as they require the .git directory which is excluded from the image by .dockerignore
+    if ($All) { $Client=$True; $Daemon=$True; $TestUnit=$True }
 
 
     # Handle the "-Binary" shortcut to build both client and daemon.
     # Handle the "-Binary" shortcut to build both client and daemon.
     if ($Binary) { $Client = $True; $Daemon = $True }
     if ($Binary) { $Client = $True; $Daemon = $True }