forked from kubernetes/cloud-provider-vsphere
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
120 lines (110 loc) · 6.15 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Use the newer Travis-CI build templates based on the
# Debian Linux distribution "Xenial" release.
os: linux
dist: xenial
# Set the version of Go.
language: go
go: "1.12"
# All jobs require Docker.
sudo: required
services: docker
# Always set the project's Go import path to ensure that forked
# builds get cloned to the correct location.
go_import_path: k8s.io/cloud-provider-vsphere
jobs:
include:
# The "build" stage builds the cloud provider when requested with a commit
# message trigger.
- stage: build
if: |
(
commit_message =~ /\/ci-build/ AND
(fork = true OR sender =~ env(OWNERS))
) AND NOT (
commit_message =~ /\/ci-nobuild/ AND
(fork = true OR sender =~ env(OWNERS))
)
sudo: false
services: false
before_install:
- REPO_SLUG_SHA=$(echo $(TRAVIS_REPO_SLUG) | sha1sum | cut -c1-7); export REPO_SLUG_SHA; echo "REPO_SLUG_SHA=${REPO_SLUG_SHA}"
install:
- make deps
script:
- make build
# The "deploy" stage builds the cloud provider and then pushes the
# the cloud provider image to the GCR image registry. This stage is
# skipped when this configuration runs as a cron job.
- stage: deploy
if: |
(
(branch = master AND type = push) OR
(
commit_message =~ /\/ci-deploy/ AND
(fork = true OR sender =~ env(OWNERS))
)
) AND NOT (
commit_message =~ /\/ci-nodeploy/ AND
(fork = true OR sender =~ env(OWNERS))
)
install:
- make deps
before_script:
- echo "${GCR_KEY_FILE}" | base64 -d | gzip -d >gcr-key-file.json
script:
- make build
- make images
after_success:
- GCR_KEY_FILE=gcr-key-file.json make upload-images
# The "conformance-test-stage" stage turns up K8s clusters, schedules
# the e2e conformance tests on the cluster, uploads the test results
# to a GCS bucket, and turns down the K8s clusters.
- &conformance-test-stage
stage: Kubernetes e2e conformance tests
env: CCM=true K8S_VERSION=ci/latest CLUSTER_NAME=ci-latest GCS_PATH=ci/latest EVENT_TYPE='^(push|cron)$' COMMIT_TRIGGER_YES='\/ci-ccm-conformance' COMMIT_TRIGGER_NO='\/ci-ccm-noconformance'
if: |
(
(env(CCM) = true AND branch = master AND type =~ env(EVENT_TYPE)) OR
(
commit_message =~ env(COMMIT_TRIGGER_YES) AND
(repo != 'kubernetes/cloud-provider-vsphere' OR sender =~ env(OWNERS))
)
) AND NOT (
commit_message =~ env(COMMIT_TRIGGER_NO) AND
(repo != 'kubernetes/cloud-provider-vsphere' OR sender =~ env(OWNERS))
)
before_script:
- mkdir -p data/.terraform/plugins
- if [ -f e2e-job.yaml ]; then cp e2e-job.yaml data/; fi
- echo "${GCS_KEY_FILE}" | base64 -d | gzip -d >key-file.json
- echo "${VMC_INFO}" | base64 -d | gzip -d >vmc-info.env
- CLOUD_PROVIDER=vsphere; [ "${CCM}" = "true" ] && CLOUD_PROVIDER=external; export CLOUD_PROVIDER; echo "CLOUD_PROVIDER=${CLOUD_PROVIDER}"
- GCS_BUCKET=k8s-conformance-vsphere; [ "${CCM}" = "true" ] && GCS_BUCKET=k8s-conformance-cloud-provider-vsphere; export GCS_BUCKET; echo "GCS_BUCKET=${GCS_BUCKET}"
- REPO_SLUG_SHA=$(echo $(TRAVIS_REPO_SLUG) | sha1sum | cut -c1-7); export REPO_SLUG_SHA; echo "REPO_SLUG_SHA=${REPO_SLUG_SHA}"
- REAL_CLUSTER_NAME="${CLUSTER_NAME}-${REPO_SLUG_SHA}-${TRAVIS_BUILD_NUMBER}"; export REAL_CLUSTER_NAME; echo "REAL_CLUSTER_NAME=${REAL_CLUSTER_NAME}"
- export DOCKER_RUN="docker run -it --rm -v $(pwd)/data:/tf/data -v $(pwd)/key-file.json:/tf/data/key-file.json:ro -v $(pwd)/data/.terraform/plugins:/tf/.terraform/plugins --env-file vmc-info.env --env TF_VAR_wrk_count=3 --env TF_VAR_k8s_version="${K8S_VERSION}" --env TF_VAR_cloud_provider="${CLOUD_PROVIDER}" --env TF_VAR_sk8_url="${SK8_URL}" --env KUBE_CONFORMANCE_IMAGE="${KUBE_CONFORMANCE_IMAGE}" --env E2E_FOCUS='"${E2E_FOCUS}"' --env E2E_SKIP='"${E2E_SKIP}"' "${E2E_IMAGE}" "${REAL_CLUSTER_NAME}""
script:
- eval "${DOCKER_RUN} up"
- eval "${DOCKER_RUN} version"
- eval "${DOCKER_RUN} test"
- eval "${DOCKER_RUN} tlog"
- eval "${DOCKER_RUN} tget"
- eval "${DOCKER_RUN} tput gs://${GCS_BUCKET}/head/${GCS_PATH} data/key-file.json"
after_script:
- eval "${DOCKER_RUN} down"
# Out-of-tree conformance tests (plus the initial definition above)
- <<: *conformance-test-stage
env: CCM=true K8S_VERSION=release/latest-1.13 CLUSTER_NAME=v1-13 GCS_PATH=release/v1.13 EVENT_TYPE='^(push|cron)$' COMMIT_TRIGGER_YES='\/ci-ccm-conformance' COMMIT_TRIGGER_NO='\/ci-ccm-noconformance'
- <<: *conformance-test-stage
env: CCM=true K8S_VERSION=release/latest-1.12 CLUSTER_NAME=v1-12 GCS_PATH=release/v1.12 EVENT_TYPE='^(push|cron)$' COMMIT_TRIGGER_YES='\/ci-ccm-conformance' COMMIT_TRIGGER_NO='\/ci-ccm-noconformance'
- <<: *conformance-test-stage
env: CCM=true K8S_VERSION=release/latest-1.11 CLUSTER_NAME=v1-11 GCS_PATH=release/v1.11 EVENT_TYPE='^(push|cron)$' COMMIT_TRIGGER_YES='\/ci-ccm-conformance' COMMIT_TRIGGER_NO='\/ci-ccm-noconformance'
# In-tree conformance tests
- <<: *conformance-test-stage
env: CCM=false K8S_VERSION=ci/latest CLUSTER_NAME=ci-latest GCS_PATH=ci/latest EVENT_TYPE='^cron$' COMMIT_TRIGGER_YES='\/ci-conformance' COMMIT_TRIGGER_NO='\/ci-noconformance'
- <<: *conformance-test-stage
env: CCM=false K8S_VERSION=release/latest-1.13 CLUSTER_NAME=v1-13 GCS_PATH=release/v1.13 EVENT_TYPE='^cron$' COMMIT_TRIGGER_YES='\/ci-conformance' COMMIT_TRIGGER_NO='\/ci-noconformance'
- <<: *conformance-test-stage
env: CCM=false K8S_VERSION=release/latest-1.12 CLUSTER_NAME=v1-12 GCS_PATH=release/v1.12 EVENT_TYPE='^cron$' COMMIT_TRIGGER_YES='\/ci-conformance' COMMIT_TRIGGER_NO='\/ci-noconformance'
- <<: *conformance-test-stage
env: CCM=false K8S_VERSION=release/latest-1.11 CLUSTER_NAME=v1-11 GCS_PATH=release/v1.11 EVENT_TYPE='^cron$' COMMIT_TRIGGER_YES='\/ci-conformance' COMMIT_TRIGGER_NO='\/ci-noconformance'