Pin docker-cli version to the 17.06-ce release version
Daniel Nephin authored on 2017/08/31 02:43:39... | ... |
@@ -110,7 +110,7 @@ dynbinary: build ## build the linux dynbinaries |
110 | 110 |
$(DOCKER_RUN_DOCKER) hack/make.sh dynbinary |
111 | 111 |
|
112 | 112 |
build: bundles init-go-pkg-cache |
113 |
- $(warning The docker client CLI has moved to github.com/docker/cli. By default, it is built from the git sha specified in hack/dockerfile/binaries-commits. For a dev-test cycle involving the CLI, run:${\n} DOCKER_CLI_PATH=/host/path/to/cli/binary make shell ${\n} then change the cli and compile into a binary at the same location.${\n}) |
|
113 |
+ $(warning The docker client CLI has moved to github.com/docker/cli. For a dev-test cycle involving the CLI, run:${\n} DOCKER_CLI_PATH=/host/path/to/cli/binary make shell ${\n} then change the cli and compile into a binary at the same location.${\n}) |
|
114 | 114 |
docker build ${BUILD_APT_MIRROR} ${DOCKER_BUILD_ARGS} -t "$(DOCKER_IMAGE)" -f "$(DOCKERFILE)" . |
115 | 115 |
|
116 | 116 |
bundles: |
... | ... |
@@ -9,9 +9,5 @@ TINI_COMMIT=949e6facb77383876aeff8a6944dde66b3089574 |
9 | 9 |
LIBNETWORK_COMMIT=7b2b1feb1de4817d522cc372af149ff48d25028e |
10 | 10 |
VNDR_COMMIT=9909bb2b8a0b7ea464527b376dc50389c90df587 |
11 | 11 |
|
12 |
-# CLI |
|
13 |
-DOCKERCLI_REPO=https://github.com/docker/cli |
|
14 |
-DOCKERCLI_COMMIT=3dfb8343b139d6342acfd9975d7f1068b5b1c3d3 |
|
15 |
- |
|
16 | 12 |
# Linting |
17 | 13 |
GOMETALINTER_COMMIT=f7b6e55301c9c67035003b7ba7f8a1cde532d338 |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-#!/bin/sh |
|
1 |
+#!/usr/bin/env bash |
|
2 | 2 |
set -e |
3 | 3 |
set -x |
4 | 4 |
|
... | ... |
@@ -47,10 +47,31 @@ install_proxy() { |
47 | 47 |
} |
48 | 48 |
|
49 | 49 |
install_dockercli() { |
50 |
- echo "Install docker/cli version $DOCKERCLI_COMMIT" |
|
51 |
- git clone "$DOCKERCLI_REPO" "$GOPATH/src/github.com/docker/cli" |
|
52 |
- cd "$GOPATH/src/github.com/docker/cli" |
|
53 |
- git checkout -q "$DOCKERCLI_COMMIT" |
|
50 |
+ DOCKERCLI_CHANNEL=${DOCKERCLI_CHANNEL:-edge} |
|
51 |
+ DOCKERCLI_VERSION=${DOCKERCLI_VERSION:-17.06.0-ce} |
|
52 |
+ echo "Install docker/cli version $DOCKERCLI_VERSION from $DOCKERCLI_CHANNEL" |
|
53 |
+ |
|
54 |
+ arch=$(uname -m) |
|
55 |
+ # No official release of these platforms |
|
56 |
+ if [[ "$arch" != "x86_64" ]] && [[ "$arch" != "s390x" ]]; then |
|
57 |
+ build_dockercli |
|
58 |
+ return |
|
59 |
+ fi |
|
60 |
+ |
|
61 |
+ url=https://download.docker.com/linux/static |
|
62 |
+ curl -Ls $url/$DOCKERCLI_CHANNEL/$arch/docker-$DOCKERCLI_VERSION.tgz | \ |
|
63 |
+ tar -xz docker/docker |
|
64 |
+ mv docker/docker /usr/local/bin/ |
|
65 |
+ rmdir docker |
|
66 |
+} |
|
67 |
+ |
|
68 |
+build_dockercli() { |
|
69 |
+ DOCKERCLI_VERSION=${DOCKERCLI_VERSION:-17.06.0-ce} |
|
70 |
+ git clone https://github.com/docker/docker-ce "$GOPATH/tmp/docker-ce" |
|
71 |
+ cd "$GOPATH/tmp/docker-ce" |
|
72 |
+ git checkout -q "v$DOCKERCLI_VERSION" |
|
73 |
+ mkdir -p "$GOPATH/src/github.com/docker" |
|
74 |
+ mv components/cli "$GOPATH/src/github.com/docker/cli" |
|
54 | 75 |
go build -o /usr/local/bin/docker github.com/docker/cli/cmd/docker |
55 | 76 |
} |
56 | 77 |
|
... | ... |
@@ -88,6 +88,7 @@ param( |
88 | 88 |
) |
89 | 89 |
|
90 | 90 |
$ErrorActionPreference = "Stop" |
91 |
+$ProgressPreference = "SilentlyContinue" |
|
91 | 92 |
$pushed=$False # To restore the directory if we have temporarily pushed to one. |
92 | 93 |
|
93 | 94 |
# Utility function to get the commit ID of the repository |
... | ... |
@@ -398,39 +399,29 @@ Try { |
398 | 398 |
# Perform the actual build |
399 | 399 |
if ($Daemon) { Execute-Build "daemon" "daemon" "dockerd" } |
400 | 400 |
if ($Client) { |
401 |
- # Get the repo and commit of the client to build. |
|
402 |
- "hack\dockerfile\binaries-commits" | ForEach-Object { |
|
403 |
- $dockerCliRepo = ((Get-Content $_ | Select-String "DOCKERCLI_REPO") -split "=")[1] |
|
404 |
- $dockerCliCommit = ((Get-Content $_ | Select-String "DOCKERCLI_COMMIT") -split "=")[1] |
|
405 |
- } |
|
406 |
- |
|
407 |
- # Build from a temporary directory. |
|
408 |
- $tempLocation = "$env:TEMP\$(New-Guid)" |
|
409 |
- New-Item -ItemType Directory $tempLocation | Out-Null |
|
410 |
- |
|
411 |
- # Temporarily override GOPATH, then clone, checkout, and build. |
|
412 |
- $saveGOPATH = $env:GOPATH |
|
401 |
+ # Get the Docker channel and version from the environment, or use the defaults. |
|
402 |
+ if (-not ($channel = $env:DOCKERCLI_CHANNEL)) { $channel = "edge" } |
|
403 |
+ if (-not ($version = $env:DOCKERCLI_VERSION)) { $version = "17.06.0-ce" } |
|
404 |
+ |
|
405 |
+ # Download the zip file and extract the client executable. |
|
406 |
+ Write-Host "INFO: Downloading docker/cli version $version from $channel..." |
|
407 |
+ $url = "https://download.docker.com/win/static/$channel/x86_64/docker-$version.zip" |
|
408 |
+ Invoke-WebRequest $url -OutFile "docker.zip" |
|
413 | 409 |
Try { |
414 |
- $env:GOPATH = $tempLocation |
|
415 |
- $dockerCliRoot = "$env:GOPATH\src\github.com\docker\cli" |
|
416 |
- Write-Host "INFO: Cloning client repository..." |
|
417 |
- Invoke-Expression "git clone -q $dockerCliRepo $dockerCliRoot" |
|
418 |
- if ($LASTEXITCODE -ne 0) { Throw "Failed to clone client repository $dockerCliRepo" } |
|
419 |
- Invoke-Expression "git -C $dockerCliRoot checkout -q $dockerCliCommit" |
|
420 |
- if ($LASTEXITCODE -ne 0) { Throw "Failed to checkout client commit $dockerCliCommit" } |
|
421 |
- Write-Host "INFO: Building client..." |
|
422 |
- Push-Location "$dockerCliRoot\cmd\docker"; $global:pushed=$True |
|
423 |
- Invoke-Expression "go build -o $root\bundles\docker.exe" |
|
424 |
- if ($LASTEXITCODE -ne 0) { Throw "Failed to compile client" } |
|
425 |
- Pop-Location; $global:pushed=$False |
|
426 |
- } |
|
427 |
- Catch [Exception] { |
|
428 |
- Throw $_ |
|
410 |
+ Add-Type -AssemblyName System.IO.Compression.FileSystem |
|
411 |
+ $zip = [System.IO.Compression.ZipFile]::OpenRead("$PWD\docker.zip") |
|
412 |
+ Try { |
|
413 |
+ if (-not ($entry = $zip.Entries | Where-Object { $_.Name -eq "docker.exe" })) { |
|
414 |
+ Throw "Cannot find docker.exe in $url" |
|
415 |
+ } |
|
416 |
+ [System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, "$PWD\bundles\docker.exe", $true) |
|
417 |
+ } |
|
418 |
+ Finally { |
|
419 |
+ $zip.Dispose() |
|
420 |
+ } |
|
429 | 421 |
} |
430 | 422 |
Finally { |
431 |
- # Always restore GOPATH and remove the temporary directory. |
|
432 |
- $env:GOPATH = $saveGOPATH |
|
433 |
- Remove-Item -Force -Recurse $tempLocation |
|
423 |
+ Remove-Item -Force "docker.zip" |
|
434 | 424 |
} |
435 | 425 |
} |
436 | 426 |
} |
... | ... |
@@ -40,7 +40,7 @@ func (s *DockerSwarmSuite) TestServiceLogs(c *check.C) { |
40 | 40 |
// make sure task has been deployed. |
41 | 41 |
waitAndAssert(c, defaultReconciliationTimeout, |
42 | 42 |
d.CheckRunningTaskImages, checker.DeepEquals, |
43 |
- map[string]int{"busybox": len(services)}) |
|
43 |
+ map[string]int{"busybox:latest": len(services)}) |
|
44 | 44 |
|
45 | 45 |
for name, message := range services { |
46 | 46 |
out, err := d.Cmd("service", "logs", name) |
... | ... |
@@ -94,7 +94,7 @@ func (s *DockerSwarmSuite) TestSwarmNetworkPluginV2(c *check.C) { |
94 | 94 |
|
95 | 95 |
time.Sleep(20 * time.Second) |
96 | 96 |
|
97 |
- image := "busybox" |
|
97 |
+ image := "busybox:latest" |
|
98 | 98 |
// create a new global service again. |
99 | 99 |
_, err = d1.Cmd("service", "create", "--no-resolve-image", "--name", serviceName, "--mode=global", "--network", networkName, image, "top") |
100 | 100 |
c.Assert(err, checker.IsNil) |