Skip to content

Enable windows CI on travis #394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 31 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,57 @@ sudo: required
dist: trusty

go:
- "1.11.1"
- 1.11.x

os:
- linux
- windows

go_import_path: github.com/kubernetes-sigs/cri-tools

services:
- docker

before_install:
- hack/install-docker.sh
- hack/install-kubelet.sh
- |
(
set -Eeuo pipefail
if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
choco install -y make mingw
export PATH="/c/tools/mingw64/bin:/c/ProgramData/chocolatey/bin;$PATH"
fi
)

install:
- make install.tools

jobs:
include:
- stage: Static check
os: linux # Only need to run on Linux
script:
- make lint
- make gofmt
- stage: Build
os: linux # Only need to run on Linux
script:
- make release
- make release
- stage: Test
os: linux
script:
- make
- hack/install-docker.sh
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kubelet installation moved here, so that static check and build could be run more quickly.

- hack/install-kubelet.sh
- sudo env PATH=$PATH GOPATH=$GOPATH hack/run-critest.sh
- stage: Test
os: windows
script:
- make
- powershell -c "Set-ExecutionPolicy Bypass -Scope CURRENTUSER -Force"
- powershell hack/install-kubelet.ps1
# Skip hack/run-critest.sh temporarily.

stages:
- Static check
- Build
- Test
1 change: 0 additions & 1 deletion hack/install-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ rm -f docker.tgz

# Restart docker daemon.
sudo service docker restart

43 changes: 43 additions & 0 deletions hack/install-kubelet.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Stop on any error.
$ErrorActionPreference = "Stop"
$VerbosePreference = "Continue"

# Install kubelet
$gopath = [System.Environment]::GetEnvironmentVariable("GOPATH")
$k8siopath = $gopath + "/src/k8s.io"
$kubernetespath = $k8siopath + "/kubernetes"
mkdir -p $k8siopath
cd $k8siopath
git clone -c core.symlinks=true https://github.com/kubernetes/kubernetes

cd $kubernetespath
$branch = [System.Environment]::GetEnvironmentVariable("TRAVIS_BRANCH")
if ( ! "$branch".Equals("master") ) {
# We can do this because cri-tools have the same branch name with kubernetes.
git checkout "$branch"
}

# Build kubelet
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kubernetes makefile doesn't work on Windows, so here build kubelet directly by go build

$version = git describe --tags --dirty --always
go build -ldflags "-X k8s.io/kubernetes/vendor/k8s.io/client-go/pkg/version.gitVersion=$version -X k8s.io/kubernetes/pkg/version.gitVersion=$version" ./cmd/kubelet/kubelet.go
cp ./kubelet.exe "$gopath/bin/"

# Dump version
echo "Kubelet version:"
kubelet.exe --version
echo "Docker version:"
docker version