Skip to content

Commit

Permalink
Polish on the build (#2331)
Browse files Browse the repository at this point in the history
* Increase timeout, try again e2e

* Update cron job

* Attempt to fix resolv.conf

* Fix order for resolv.conf

* Use KUBECONFIG env variable instead of linked file

* Use only fast linters

* Fix linters and lint/licence warnings

* Fix build - goimports doesn't seem to like this

* Revert goimports

* fmt.sh

* More attempts for e2e, test fix

* Default linked

* Move pilot no-auth to the new style, seems more reliable

* One more e2e attempt

* Fix test parsing

* Continue to use random ns for e2e

* Improve parsing of ginko (why are we using it ? Consistency...)

* Fix gopath for e2e

* Fmt (Goland needs to be set to use the right import order

* Try the mixer e2e

* It appears kubedns service was missing in 0.24

* Timeout, try with simple (most test were passing)

* Woot, e2e passing !

* yaml error

* Use better names, run all e2e even if first fails

* Initial version of the .deb creation

* Fix building the .deb using the container

* Allow version customization and match the original names

* Run nightly on the current PR

* Remove empty makefile

* Fix lint errors

* Fix typo

* Fix bad merge
  • Loading branch information
costinm authored Jan 2, 2018
1 parent 55d591f commit 90987fc
Show file tree
Hide file tree
Showing 30 changed files with 648 additions and 72 deletions.
28 changes: 26 additions & 2 deletions .circleci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
FROM circleci/golang:1.9

# The base circleci image runs as user 'circleci'(3434), with sudo capabilities.
# Based on Debian9. Go installed in /usr/local/go

# Env:
# GOLANG_VERSION
# GPATH=/go

# Workdir: /go

# Also installed docker, docker-compose, dockerize, jq

RUN go get github.com/coreos/etcd/cmd/etcd

ARG K8S_VER=v1.7.4
Expand All @@ -10,6 +21,7 @@ RUN mkdir -p /tmp/apiserver && \
wget https://storage.googleapis.com/kubernetes-release/release/v1.7.4/bin/linux/amd64/kube-apiserver && \
chmod +x /tmp/apiserver/kube-apiserver

# TODO: generate and checkin the test apiserver and istio-ca keys
RUN cd /tmp && \
curl -L -O https://storage.googleapis.com/kubernetes-release/easy-rsa/easy-rsa.tar.gz && \
tar xzf easy-rsa.tar.gz && \
Expand All @@ -23,9 +35,21 @@ RUN cd /tmp && \
cd /tmp && \
rm -rf /tmp/easy-rsa-master/


RUN go get -u github.com/golang/dep/cmd/dep

ADD start-test-server.sh /tmp/apiserver/start-test-server.sh

ENTRYPOINT ["/tmp/apiserver/start-test-server.sh"]
# Tool used to convert 'go test' to junit, for integration with CI dashboard
RUN go get github.com/jstemmer/go-junit-report

# Install fpm tool
RUN sudo apt-get -qqy install ruby ruby-dev rubygems build-essential && \
sudo gem install --no-ri --no-rdoc fpm

# Include minikube and kubectl in the image
RUN curl -Lo /tmp/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.7.4/bin/linux/amd64/kubectl && \
chmod +x /tmp/kubectl && sudo mv /tmp/kubectl /usr/local/bin/

RUN curl -Lo /tmp/minikube https://storage.googleapis.com/minikube/releases/v0.22.3/minikube-linux-amd64 &&\
chmod +x /tmp/minikube && sudo mv /tmp/minikube /usr/local/bin/

17 changes: 8 additions & 9 deletions .circleci/Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
# Builder version
VERSION ?= go1.9-k8s1.7.4
PROJECT ?= istio
HUB ?=
CI_VERSION ?= go1.9-k8s1.7.4
CI_HUB ?= istio

image:
docker build -t ${HUB}${PROJECT}/ci:$(VERSION) -f Dockerfile .
ci.image:
docker build -t ${CI_HUB}/ci:$(CI_VERSION) -f Dockerfile .

push:
docker push "${HUB}${PROJECT}/ci:$(VERSION)"
ci.push:
docker push "${CI_HUB}/ci:$(CI_VERSION)"

run:
ci.run:
docker run --rm -u $(shell id -u) -it \
-v ${GOPATH}:${GOPATH} \
-w ${PWD} \
-e USER=${USER} \
--entrypoint /bin/bash \
${HUB}${PROJECT}/ci:$(VERSION)
${CI_HUB}/ci:$(CI_VERSION)


.PHONY: image push
113 changes: 77 additions & 36 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
environment:
- KUBECONFIG: /go/out/minikube.conf
- TEST_ENV: minikube-none
- GOPATH: /go
steps:
- type: shell
name: Initialize Working Directory
Expand All @@ -36,10 +37,13 @@ jobs:
sudo mkdir -p /go/src/istio.io/istio
sudo chown -R circleci /go
- checkout
- run: curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.7.4/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
- run: curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.24.1/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
- attach_workspace:
at: /go
- run:
name: "Start minikube"
command: |
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.7.4/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.22.3/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
mkdir -p /go/out
mkdir /home/circleci/logs
sudo -E minikube start \
Expand All @@ -52,7 +56,9 @@ jobs:
- restore_cache:
keys:
- dep-cache-{{ checksum "Gopkg.toml" }}-{{ checksum "WORKSPACE" }}
- run: make docker
- run:
name: "Wait for minikube"
command: |
kubectl cluster-info
set -ne
Expand All @@ -63,12 +69,25 @@ jobs:
fi
sleep 2
done
kubectl get svc --all-namespaces
- run: docker images
- run:
command: |
make docker
# Show created images
docker images
make e2e_simple
timeout: 20m
command: |
make e2e_simple E2E_ARGS="--skip_delete -use_local_cluster -cluster_wide -alsologtostderr -test.v -v 2 --istioctl ${GOPATH}/bin/istioctl"
- run:
timeout: 20m
# Run the test even if previous failed
when: always
command: |
make e2e_mixer E2E_ARGS="--skip_delete -use_local_cluster -cluster_wide -alsologtostderr -test.v -v 2 --istioctl ${GOPATH}/bin/istioctl"
- run:
timeout: 20m
when: always
command: |
make e2e_bookinfo E2E_ARGS="--skip_delete -use_local_cluster -cluster_wide -alsologtostderr -test.v -v 2 --istioctl ${GOPATH}/bin/istioctl"
- store_artifacts:
path: /home/circleci/logs
path: /tmp
Expand Down Expand Up @@ -123,38 +142,48 @@ jobs:

pilot-integration-noauth:
<<: *integrationDefaults
environment:
- GOPATH: /go
- KUBECONFIG: /go/out/minikube.conf
- TEST_ENV: minikube-none
- HUB: docker.io/dnerepo
- TAG: dontpush
steps:
- type: shell
name: Initialize Working Directory
pwd: /
command: |
sudo mkdir -p /go/src/istio.io/istio
sudo chown -R circleci /go
sudo chown -R circleci /usr/local/go
- checkout
- run: curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.7.4/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
- run: curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.22.3/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
- run:
command: |
mkdir -p /go/out
mkdir /home/circleci/logs
sudo -E minikube start \
--extra-config=apiserver.Admission.PluginNames="Initializers,NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,GenericAdmissionWebhook,ResourceQuota" \
--kubernetes-version=v1.7.5 --vm-driver=none
- run: sudo -E minikube update-context
- run: bin/install-go.sh
--extra-config=apiserver.Admission.PluginNames="Initializers,NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,GenericAdmissionWebhook,ResourceQuota" \
--kubernetes-version=v1.7.5 --vm-driver=none
sudo chown -R $USER $KUBECONFIG
sudo chown -R $USER $HOME/.minikube
- restore_cache:
keys:
- dep-cache-{{ checksum "Gopkg.toml" }}-{{ checksum "WORKSPACE" }}
- run:
command: |
cd /go/src/istio.io/istio
if [ ! -d vendor ]; then
dep ensure
fi
- run: cd pilot; bin/gocompile-and-push-images.sh -hub $HUB -tag $TAG -build-only
- run: mkdir /home/circleci/logs
- run: go build -i ./pilot/test/integration
- run: JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until sudo kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done
- run: sudo -E kubectl cluster-info
- run: make kubelink
- run:
command: |
set -ne
kubectl cluster-info
for i in {1..150}; do # timeout for 5 minutes
kubectl get po &> /dev/null
if [ $? -ne 1 ]; then
break
fi
sleep 2
done
- run: ./integration --logtostderr -hub $HUB -tag $TAG -mixer=false -auth=disable -errorlogsdir=/home/circleci/logs -use-initializer
- store_artifacts:
path: /home/circleci/logs
Expand Down Expand Up @@ -243,7 +272,7 @@ jobs:
- store_artifacts:
path: /go/bin

gotest:
test:
<<: *defaults
resource_class: xlarge
steps:
Expand All @@ -253,11 +282,17 @@ jobs:
- dep-cache-{{ checksum "Gopkg.toml" }}-{{ checksum "WORKSPACE" }}
- run:
command: |
make localTestEnv go-test KUBECONFIG=/go/src/istio.io/istio/.circleci/config
mkdir -p /go/out/tests
go get github.com/jstemmer/go-junit-report
trap "go-junit-report </go/out/tests/go-test-report.out > /go/out/tests/go-test-report.xml" EXIT
make localTestEnv go-test KUBECONFIG=/go/src/istio.io/istio/.circleci/config T=-v | tee /go/out/tests/go-test-report.out
- store_artifacts:
path: /go/bin
path: /go/out
- store_test_results:
path: /go/out/tests

gobuild:
build:
<<: *defaults
resource_class: xlarge
steps:
Expand All @@ -271,6 +306,11 @@ jobs:
make go-build
- store_artifacts:
path: /go/bin
- persist_to_workspace:
root: /go
paths:
- pkg
- bin

lint:
<<: *integrationDefaults
Expand All @@ -287,11 +327,9 @@ jobs:
keys:
- dep-cache-{{ checksum "Gopkg.toml" }}-{{ checksum "WORKSPACE" }}
- run:
no_output_timeout: 900
command: |
cd /go/src/istio.io/istio
SKIP_INIT=1 bin/linters.sh
- store_artifacts:
path: /go/bin
make lint
docker-push:
<<: *defaults
Expand All @@ -301,7 +339,8 @@ jobs:
- restore_cache:
keys:
- dep-cache-{{ checksum "Gopkg.toml" }}-{{ checksum "WORKSPACE" }}
- setup_remote_docker
- setup_remote_docker:
docker_layer_caching: true
- run:
command: |
if [ ! -z "${DOCKER_USER}" ] ; then
Expand All @@ -317,7 +356,6 @@ jobs:
resource_class: xlarge
steps:
- checkout
- restore_cache:
- restore_cache:
keys:
- dep-cache-{{ checksum "Gopkg.toml" }}-{{ checksum "WORKSPACE" }}
Expand All @@ -341,7 +379,7 @@ workflows:
filters:
branches:
only:
- gobuild
- master
jobs:
- dependencies
# Build
Expand Down Expand Up @@ -369,21 +407,24 @@ workflows:
all:
jobs:
- dependencies
- gobuild:
- build:
requires:
- dependencies
- gotest:
- e2e:
requires:
- build
- test:
requires:
- dependencies
- codecov:
requires:
- gotest
- build
- lint:
requires:
- dependencies
- pilot-integration-noauth:
requires:
- gotest
- test
- pilot-integration-auth:
requires:
- gotest
- test
2 changes: 1 addition & 1 deletion DEV-CONVENTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,6 @@ the [adapter logger interface](https://godoc.org/istio.io/istio/mixer/pkg/adapte

- Third-party code

- Go code for normal third-party dependencies is managed by the [Bazel](http://bazel.build) build system.
- Go code for normal third-party dependencies is managed by the Go [Dep](https://github.com/golang/dep).

- Third-party code must carry licenses. This includes modified third-party code and excerpts.
Loading

0 comments on commit 90987fc

Please sign in to comment.