Migrate Linux builds to AppVeyor

pull/9/head
Stefan Scherer 6 years ago
parent a0d189114a
commit b08df0f032
No known key found for this signature in database
GPG Key ID: 5966AEAC37E957FA

@ -1,9 +0,0 @@
version: 2
jobs:
build:
working_directory: ~/whoami
machine: true
steps:
- checkout
- run: ARCH=arm ./travis-build.sh
- run: ARCH=arm ./travis-test.sh

@ -1,20 +0,0 @@
sudo: required
services:
- docker
env:
matrix:
- ARCH=arm
- ARCH=arm64
- ARCH=amd64
script:
- ./travis-build.sh
- ./travis-test.sh
- >
if [ -n "$TRAVIS_TAG" ]; then
# push image
travis_retry timeout 5m echo "$DOCKER_PASS" | docker login -u="$DOCKER_USER" --password-stdin
./travis-deploy.sh
fi

@ -1,7 +1,6 @@
# whoami multi-arch image
[![Build status](https://ci.appveyor.com/api/projects/status/bhma7tmx0eje73ao/branch/master?svg=true)](https://ci.appveyor.com/project/StefanScherer/whoami/branch/master)
[![Build Status](https://travis-ci.org/StefanScherer/whoami.svg?branch=master)](https://travis-ci.org/StefanScherer/whoami)
[![This image on DockerHub](https://img.shields.io/docker/pulls/stefanscherer/whoami.svg)](https://hub.docker.com/r/stefanscherer/whoami/)
Simple HTTP docker service that prints it's container ID - for (almost) any Docker platform
@ -11,15 +10,16 @@ Simple HTTP docker service that prints it's container ID - for (almost) any Dock
![CI pipeline with Travis and AppVeyor](images/pipeline.png)
* AppVeyor CI
* Build Windows image for nanoserver 2016 SAC
* windows/amd64 10.0.14393.x
* Rebase this image to nanoserver:1709 SAC
* windows/amd64 10.0.16299.x
* Travis CI
* Matrix build for several Linux architectures
* linux/amd64
* linux/arm
* linux/arm64
* Build Windows image for nanoserver 2016 SAC
* windows/amd64 10.0.14393.x
* Rebase this image to nanoserver:1709 SAC
* windows/amd64 10.0.16299.x
* Rebase this image to nanoserver:1803 SAC
* windows/amd64 10.0.17134.x
* Wait for all images to be on Docker Hub
* Create and push the manifest list
* preview of `docker manifest` command
@ -54,6 +54,7 @@ Image: stefanscherer/whoami
- linux/amd64
- linux/arm/v6
- linux/arm64/v8
- windows/amd64:10.0.14393.2068
- windows/amd64:10.0.16299.248
- windows/amd64:10.0.14393.2248
- windows/amd64:10.0.16299.431
- windows/amd64:10.0.17134.48
```

@ -1,7 +0,0 @@
$ErrorActionPreference = 'Stop';
$files = ""
Write-Host Starting build
docker build --pull -t whoami -f Dockerfile.windows .
docker images

@ -1,27 +0,0 @@
$ErrorActionPreference = 'Stop';
if (! (Test-Path Env:\APPVEYOR_REPO_TAG_NAME)) {
Write-Host "No version tag detected. Skip publishing."
exit 0
}
Write-Host Starting deploy
docker login -u="$env:DOCKER_USER" -p="$env:DOCKER_PASS"
docker tag whoami stefanscherer/whoami:windows-amd64-$env:APPVEYOR_REPO_TAG_NAME
docker push stefanscherer/whoami:windows-amd64-$env:APPVEYOR_REPO_TAG_NAME
Write-Host Rebasing image to produce 1709 variant
npm install -g rebase-docker-image
rebase-docker-image `
stefanscherer/whoami:windows-amd64-$env:APPVEYOR_REPO_TAG_NAME `
-t stefanscherer/whoami:windows-amd64-$env:APPVEYOR_REPO_TAG_NAME-1709 `
-b microsoft/nanoserver:1709
Write-Host Rebasing image to produce 1803 variant
npm install -g rebase-docker-image
rebase-docker-image `
stefanscherer/whoami:windows-amd64-$env:APPVEYOR_REPO_TAG_NAME `
-t stefanscherer/whoami:windows-amd64-$env:APPVEYOR_REPO_TAG_NAME-1803 `
-b microsoft/nanoserver:1803

@ -1,18 +1,26 @@
version: 1.0.{build}
image: Visual Studio 2017
image:
- Visual Studio 2017
- Ubuntu
environment:
matrix:
- ARCH: arm
- ARCH: arm64
- ARCH: amd64
matrix:
exclude:
- image: Visual Studio 2017
ARCH: arm
- image: Visual Studio 2017
ARCH: arm64
build_script:
- ps: .\appveyor-build.ps1
- ps: ./build.ps1
test_script:
- ps: .\appveyor-test.ps1
- ps: ./test.ps1
deploy_script:
- ps: >-
if (Test-Path Env:\APPVEYOR_REPO_TAG_NAME) {
docker login -u="$env:DOCKER_USER" -p="$env:DOCKER_PASS"
.\appveyor-deploy.ps1
}
- ps: ./deploy.ps1

@ -0,0 +1,11 @@
$ErrorActionPreference = 'Stop';
$files = ""
Write-Host Starting build
if ($isWindows) {
docker build --pull -t whoami -f Dockerfile.windows .
} else {
docker build -t whoami --build-arg "arch=$env:ARCH" .
}
docker images

@ -0,0 +1,62 @@
$ErrorActionPreference = 'Stop';
if (! (Test-Path Env:\APPVEYOR_REPO_TAG_NAME)) {
Write-Host "No version tag detected. Skip publishing."
exit 0
}
$image = "stefanscherer/whoami"
Write-Host Starting deploy
if (!(Test-Path ~/.docker)) { mkdir ~/.docker }
'{ "experimental": "enabled" }' | Out-File ~/.docker/config.json -Encoding Ascii
docker login -u="$env:DOCKER_USER" -p="$env:DOCKER_PASS"
$os = If ($isWindows) {"windows"} Else {"linux"}
docker tag whoami "$($image):$os-$env:ARCH-$env:APPVEYOR_REPO_TAG_NAME"
docker push "$($image):$os-$env:ARCH-$env:APPVEYOR_REPO_TAG_NAME"
if ($isWindows) {
# Windows
Write-Host "Rebasing image to produce 1709 variant"
npm install -g rebase-docker-image
rebase-docker-image `
"$($image):$os-$env:ARCH-$env:APPVEYOR_REPO_TAG_NAME" `
-t "$($image):$os-$env:ARCH-$env:APPVEYOR_REPO_TAG_NAME-1709" `
-b microsoft/nanoserver:1709
Write-Host "Rebasing image to produce 1803 variant"
npm install -g rebase-docker-image
rebase-docker-image `
"$($image):$os-$env:ARCH-$env:APPVEYOR_REPO_TAG_NAME" `
-t "$($image):$os-$env:ARCH-$env:APPVEYOR_REPO_TAG_NAME-1803" `
-b microsoft/nanoserver:1803
} else {
# Linux
if ($env:ARCH -eq "amd64") {
# The last in the build matrix
docker -D manifest create "$($image):$env:APPVEYOR_REPO_TAG_NAME" `
"$($image):linux-amd64-$env:APPVEYOR_REPO_TAG_NAME" `
"$($image):linux-arm-$env:APPVEYOR_REPO_TAG_NAME" `
"$($image):linux-arm64-$env:APPVEYOR_REPO_TAG_NAME" `
"$($image):windows-amd64-$env:APPVEYOR_REPO_TAG_NAME" `
"$($image):windows-amd64-$env:APPVEYOR_REPO_TAG_NAME-1709" `
"$($image):windows-amd64-$env:APPVEYOR_REPO_TAG_NAME-1803"
docker manifest annotate "$($image):$env:APPVEYOR_REPO_TAG_NAME" "$($image):linux-arm-$env:APPVEYOR_REPO_TAG_NAME" --os linux --arch arm --variant v6
docker manifest annotate "$($image):$env:APPVEYOR_REPO_TAG_NAME" "$($image):linux-arm64-$env:APPVEYOR_REPO_TAG_NAME" --os linux --arch arm64 --variant v8
docker manifest push "$($image):$env:APPVEYOR_REPO_TAG_NAME"
Write-Host "Pushing manifest $($image):latest"
docker -D manifest create "$($image):latest" `
"$($image):linux-amd64-$env:APPVEYOR_REPO_TAG_NAME" `
"$($image):linux-arm-$env:APPVEYOR_REPO_TAG_NAME" `
"$($image):linux-arm64-$env:APPVEYOR_REPO_TAG_NAME" `
"$($image):windows-amd64-$env:APPVEYOR_REPO_TAG_NAME" `
"$($image):windows-amd64-$env:APPVEYOR_REPO_TAG_NAME-1709" `
"$($image):windows-amd64-$env:APPVEYOR_REPO_TAG_NAME-1803"
docker manifest annotate "$($image):latest" "$($image):linux-arm-$env:APPVEYOR_REPO_TAG_NAME" --os linux --arch arm --variant v6
docker manifest annotate "$($image):latest" "$($image):linux-arm64-$env:APPVEYOR_REPO_TAG_NAME" --os linux --arch arm64 --variant v8
docker manifest push "$($image):latest"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 KiB

After

Width:  |  Height:  |  Size: 181 KiB

@ -1,5 +1,10 @@
Write-Host Starting test
if ($env:ARCH -ne "amd64") {
Write-Host "Arch $env:ARCH detected. Skip testing."
exit 0
}
$ErrorActionPreference = 'SilentlyContinue';
docker kill whoamitest
docker rm -f whoamitest

@ -1,22 +0,0 @@
#!/bin/bash
set -e
docker version
uname -a
echo "Updating Docker engine to have multi-stage builds and manifest command"
sudo service docker stop
curl -fsSL https://get.docker.com/ | sudo sh
echo "Enabling docker client experimental features"
mkdir -p ~/.docker
echo '{ "experimental": "enabled" }' > ~/.docker/config.json
docker version
if [ -d tmp ]; then
docker rm build
rm -rf tmp
fi
docker build -t whoami --build-arg "arch=$ARCH" .

@ -1,61 +0,0 @@
#!/bin/bash
set -e
image="stefanscherer/whoami"
docker tag whoami "$image:linux-$ARCH-$TRAVIS_TAG"
docker push "$image:linux-$ARCH-$TRAVIS_TAG"
if [ "$ARCH" == "amd64" ]; then
set +e
echo "Waiting for other images $image:linux-arm-$TRAVIS_TAG"
until docker run --rm stefanscherer/winspector "$image:linux-arm-$TRAVIS_TAG"
do
sleep 15
echo "Try again"
done
until docker run --rm stefanscherer/winspector "$image:linux-arm64-$TRAVIS_TAG"
do
sleep 15
echo "Try again"
done
until docker run --rm stefanscherer/winspector "$image:windows-amd64-$TRAVIS_TAG"
do
sleep 15
echo "Try again"
done
until docker run --rm stefanscherer/winspector "$image:windows-amd64-$TRAVIS_TAG-1709"
do
sleep 15
echo "Try again"
done
until docker run --rm stefanscherer/winspector "$image:windows-amd64-$TRAVIS_TAG-1803"
do
sleep 15
echo "Try again"
done
set -e
echo "Pushing manifest $image:$TRAVIS_TAG"
docker -D manifest create "$image:$TRAVIS_TAG" \
"$image:linux-amd64-$TRAVIS_TAG" \
"$image:linux-arm-$TRAVIS_TAG" \
"$image:linux-arm64-$TRAVIS_TAG" \
"$image:windows-amd64-$TRAVIS_TAG" \
"$image:windows-amd64-$TRAVIS_TAG-1709" \
"$image:windows-amd64-$TRAVIS_TAG-1803"
docker manifest annotate "$image:$TRAVIS_TAG" "$image:linux-arm-$TRAVIS_TAG" --os linux --arch arm --variant v6
docker manifest annotate "$image:$TRAVIS_TAG" "$image:linux-arm64-$TRAVIS_TAG" --os linux --arch arm64 --variant v8
docker manifest push "$image:$TRAVIS_TAG"
echo "Pushing manifest $image:latest"
docker -D manifest create "$image:latest" \
"$image:linux-amd64-$TRAVIS_TAG" \
"$image:linux-arm-$TRAVIS_TAG" \
"$image:linux-arm64-$TRAVIS_TAG" \
"$image:windows-amd64-$TRAVIS_TAG" \
"$image:windows-amd64-$TRAVIS_TAG-1709" \
"$image:windows-amd64-$TRAVIS_TAG-1803"
docker manifest annotate "$image:latest" "$image:linux-arm-$TRAVIS_TAG" --os linux --arch arm --variant v6
docker manifest annotate "$image:latest" "$image:linux-arm64-$TRAVIS_TAG" --os linux --arch arm64 --variant v8
docker manifest push "$image:latest"
fi

@ -1,11 +0,0 @@
#!/bin/bash
set -e
if [ "$ARCH" == "amd64" ]; then
# test image
docker run -d -p 8080:8080 --name=whoamitest whoami
sleep 5
docker logs whoamitest
fi
Loading…
Cancel
Save