linkerd2/.travis.yml

179 lines
5.5 KiB
YAML

---
dist: trusty
sudo: false
# We do not test pushes to branches, since they are redundant with the pull_request build
# for each branch. Take that, Big CI!
branches:
only:
- master
- /^(edge|stable)-\d+\.\d+\.[\w-]+$/ # build version tags
stages:
- name: test
- name: docker-deploy
if: type != pull_request
- name: integration-test
if: type != pull_request
jobs:
include:
- language: go
# Quote the version number to avoid parsing issues like
# https://github.com/travis-ci/gimme/issues/132.
go: "1.11.5"
go_import_path: github.com/linkerd/linkerd2
cache:
directories:
- target
- vendor
- "$HOME/.cache"
before_install:
- echo $GITCOOKIE_SH | base64 -d | bash
install:
- ./bin/dep ensure -vendor-only -v
- ./bin/dep status -v
script:
# TODO decide whether protoc should be committed or not. If so, we shouldn't do
# this or we should error if it dirties the repo.
- ./bin/protoc-go.sh
- go test -cover -race -v ./...
- ./bin/lint --verbose
- language: node_js
node_js:
- "10"
cache: yarn
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.7.0
- export PATH="$HOME/.yarn/bin:$PATH"
- export NODE_ENV=test
install:
- ./bin/web
script:
- ./bin/web test --reporters=jest-dot-reporter
- language: generic
script:
- |
(
. bin/_tag.sh
for f in $( grep -lR --include=Dockerfile\* go-deps: . ) ; do
validate_go_deps_tag $f
done
)
# Push container images to Google Container Registry.
- stage: docker-deploy
language: generic
services:
- docker
cache:
directories:
- "$HOME/google-cloud-sdk/"
- "$HOME/.cache"
before_install:
- docker version
- |
# Install gcloud and kubectl.
dir="${CLOUDSDK_INSTALL_DIR:-${HOME}}/google-cloud-sdk"
(. bin/_gcp.sh ; install_gcloud_kubectl "$dir")
. "$dir/path.bash.inc"
- |
# Configure gcloud with a service account.
openssl aes-256-cbc -K $encrypted_ea955175587c_key -iv $encrypted_ea955175587c_iv -in .gcp.json.enc -out .gcp.json -d
(. bin/_gcp.sh ; set_gcloud_config "$GCP_PROJECT" "$GCP_ZONE" "$GKE_CLUSTER")
- |
# Get a kubernetes context.
(. bin/_gcp.sh ; get_k8s_ctx "$GCP_PROJECT" "$GCP_ZONE" "$GKE_CLUSTER")
- gcloud version
- kubectl version --short
before_script:
- gcloud docker --authorize-only
- bin/docker-pull-deps
# Pulling master helps with docker build cache, but may fail if we're
# adding a new image to the mix.
- bin/docker-pull master || echo "docker pull failed" >&2
- |
export LINKERD_TAG=$(. bin/_tag.sh ; clean_head_root_tag)
echo "LINKERD_TAG=${LINKERD_TAG}"
- export BUILD_DEBUG=1 DOCKER_TRACE=1
script:
- bin/docker-build
after_success:
- bin/docker-push-deps
- bin/docker-push $LINKERD_TAG
- bin/docker-retag-all $LINKERD_TAG master && bin/docker-push master
- target/cli/linux/linkerd install --linkerd-version=$LINKERD_TAG |tee linkerd.yml
- kubectl -n linkerd apply -f linkerd.yml --prune --selector='linkerd.io/control-plane-component'
# Run integration tests after container images have been published.
- stage: integration-test
language: go
go: "1.11.5"
go_import_path: github.com/linkerd/linkerd2
services:
- docker
cache:
directories:
- vendor
- "$HOME/google-cloud-sdk/"
- "$HOME/.cache"
before_install:
- echo $GITCOOKIE_SH | base64 -d | bash
install:
- ./bin/dep ensure -vendor-only -v
- ./bin/dep status -v
- |
# Install gcloud and kubectl.
dir="${CLOUDSDK_INSTALL_DIR:-${HOME}}/google-cloud-sdk"
(. bin/_gcp.sh ; install_gcloud_kubectl "$dir")
. "$dir/path.bash.inc"
- |
# Configure gcloud with a service account.
openssl aes-256-cbc -K $encrypted_ea955175587c_key -iv $encrypted_ea955175587c_iv -in .gcp.json.enc -out .gcp.json -d
(. bin/_gcp.sh ; set_gcloud_config "$GCP_PROJECT" "$GCP_ZONE" "$GKE_CLUSTER")
- |
# Get a kubernetes context.
(. bin/_gcp.sh ; get_k8s_ctx "$GCP_PROJECT" "$GCP_ZONE" "$GKE_CLUSTER")
- |
# Install linkerd cli.
version="$(CI_FORCE_CLEAN=1 bin/root-tag)"
image="gcr.io/linkerd-io/cli-bin:$version"
id=$(docker create $image)
docker cp "$id:/out/linkerd-linux" "./linkerd"
- gcloud version
- kubectl version --short
- ./linkerd version --client
script:
- |
# Run integration tests.
version="$(./linkerd version --client --short | tr -cd '[:alnum:]-')"
./bin/test-run `pwd`/linkerd linkerd-$version
- |
# Run linkerd-cni integration tests.
TAG="$(./linkerd version --client --short)" go test -cover -race -v ./cni-plugin/test -integration-tests
after_script:
- |
# Cleanup after integration test run.
version="$(./linkerd version --client --short | tr -cd '[:alnum:]-')"
./bin/test-cleanup linkerd-$version
notifications:
email:
on_success: never