Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
adbd8a9c
Commit
adbd8a9c
authored
Feb 26, 2016
by
Isaac Hollander McCreery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor e2e-runner.sh in preparation for upgrade job infra improvements
parent
1dd3cb58
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
114 additions
and
81 deletions
+114
-81
e2e-runner.sh
hack/jenkins/e2e-runner.sh
+111
-79
kubernetes-soak.yaml
hack/jenkins/job-configs/kubernetes-soak.yaml
+1
-0
kubernetes-upgrades.yaml
hack/jenkins/job-configs/kubernetes-upgrades.yaml
+2
-2
No files found.
hack/jenkins/e2e-runner.sh
View file @
adbd8a9c
...
@@ -21,96 +21,129 @@ set -o nounset
...
@@ -21,96 +21,129 @@ set -o nounset
set
-o
pipefail
set
-o
pipefail
set
-o
xtrace
set
-o
xtrace
echo
"--------------------------------------------------------------------------------"
function
check_dirty_workspace
()
{
echo
"Test Environment:"
if
[[
"
${
JENKINS_TOLERATE_DIRTY_WORKSPACE
:-}
"
=
~ ^[yY]
$
]]
;
then
printenv
|
sort
echo
"Tolerating dirty workspace (because JENKINS_TOLERATE_DIRTY_WORKSPACE)."
echo
"--------------------------------------------------------------------------------"
# We get the Kubernetes tarballs on either cluster creation or when we want to
# replace existing ones in a multi-step job (e.g. a cluster upgrade).
if
[[
"
${
E2E_UP
,,
}
"
==
"true"
||
"
${
JENKINS_FORCE_GET_TARS
:-}
"
=
~ ^[yY]
$
]]
;
then
if
[[
${
KUBE_RUN_FROM_OUTPUT
:-}
=
~ ^[yY]
$
]]
;
then
echo
"Found KUBE_RUN_FROM_OUTPUT=y; will use binaries from _output"
cp
_output/release-tars/kubernetes
*
.tar.gz
.
else
else
echo
"Pulling binaries from GCS"
echo
"Checking dirty workspace."
# In a multi-step job, clean up just the kubernetes build files.
# Otherwise, we want a completely empty directory.
if
[[
"
${
JENKINS_FORCE_GET_TARS
:-}
"
=
~ ^[yY]
$
]]
;
then
rm
-rf
kubernetes
*
# .config and its children are created by the gcloud call that we use to
# .config and its children are created by the gcloud call that we use to
# get the GCE service account.
# get the GCE service account.
#
# console-log.txt is created by Jenkins, but is usually not flushed out
# console-log.txt is created by Jenkins, but is usually not flushed out
# this early in the script.
# this early in this script.
elif
[[
$(
find
.
-not
-path
"./.config*"
-not
-name
"console-log.txt"
\
if
[[
$(
find
.
-not
-path
"./.config*"
-not
-name
"console-log.txt"
|
wc
-l
)
!=
1
]]
;
then
|
wc
-l
)
!=
1
]]
;
then
echo
"
${
PWD
}
not empty, bailing!"
echo
"
${
PWD
}
not empty, bailing!"
find
.
find
.
exit
1
exit
1
fi
fi
# This is for test, staging, and prod jobs on GKE, where we want to
# test what's running in GKE by default rather than some CI build.
if
[[
${
JENKINS_USE_SERVER_VERSION
:-}
=
~ ^[yY]
$
]]
;
then
# for GKE we can use server default version.
bucket
=
"release"
msg
=
$(
gcloud
${
CMD_GROUP
}
container get-server-config
--project
=
${
PROJECT
}
--zone
=
${
ZONE
}
|
grep
defaultClusterVersion
)
# msg will look like "defaultClusterVersion: 1.0.1". Strip
# everything up to, including ": "
build_version
=
"v
${
msg
##*
:
}
"
echo
"Using server version
$bucket
/
$build_version
"
else
# use JENKINS_PUBLISHED_VERSION, for CI
# Use a published version like "ci/latest" (default),
# "release/latest", "release/latest-1", or "release/stable"
JENKINS_PUBLISHED_VERSION
=
${
JENKINS_PUBLISHED_VERSION
:-
'ci/latest'
}
IFS
=
'/'
read
-a
varr
<<<
"
${
JENKINS_PUBLISHED_VERSION
}
"
bucket
=
"
${
varr
[0]
}
"
build_version
=
$(
gsutil
cat
gs://kubernetes-release/
${
JENKINS_PUBLISHED_VERSION
}
.txt
)
echo
"Using published version
$bucket
/
$build_version
(from
${
JENKINS_PUBLISHED_VERSION
}
)"
# Set CLUSTER_API_VERSION for GKE CI
export
CLUSTER_API_VERSION
=
$(
echo
${
build_version
}
|
cut
-c
2-
)
fi
# At this point, we want to have the following vars set:
# - bucket
# - build_version
gsutil
-mq
cp
\
"gs://kubernetes-release/
${
bucket
}
/
${
build_version
}
/kubernetes.tar.gz"
\
"gs://kubernetes-release/
${
bucket
}
/
${
build_version
}
/kubernetes-test.tar.gz"
\
.
fi
fi
}
if
[[
!
"
${
CIRCLECI
:-}
"
==
"true"
]]
;
then
function
fetch_output_tars
()
{
# Copy GCE keys so we don't keep cycling them.
clean_binaries
# To set this up, you must know the <project>, <zone>, and <instance>
echo
"Using binaries from _output."
# on which your jenkins jobs are running. Then do:
cp
_output/release-tars/kubernetes
*
.tar.gz
.
#
unpack_binaries
# # SSH from your computer into the instance.
}
# $ gcloud compute ssh --project="<prj>" ssh --zone="<zone>" <instance>
#
function
fetch_server_version_tars
()
{
# # Generate a key by ssh'ing from the instance into itself, then exit.
clean_binaries
# $ gcloud compute ssh --project="<prj>" ssh --zone="<zone>" <instance>
local
-r
msg
=
$(
gcloud
${
CMD_GROUP
}
container get-server-config
--project
=
${
PROJECT
}
--zone
=
${
ZONE
}
|
grep
defaultClusterVersion
)
# $ ^D
# msg will look like "defaultClusterVersion: 1.0.1". Strip
#
# everything up to, including ": "
# # Copy the keys to the desired location (e.g. /var/lib/jenkins/gce_keys/).
local
-r
build_version
=
"v
${
msg
##*
:
}
"
# $ sudo mkdir -p /var/lib/jenkins/gce_keys/
fetch_tars_from_gcs
"release"
"
${
build_version
}
"
# $ sudo cp ~/.ssh/google_compute_engine /var/lib/jenkins/gce_keys/
unpack_binaries
# $ sudo cp ~/.ssh/google_compute_engine.pub /var/lib/jenkins/gce_keys/
}
#
# # Move the permissions for the keys to Jenkins.
# Use a published version like "ci/latest" (default), "release/latest",
# $ sudo chown -R jenkins /var/lib/jenkins/gce_keys/
# "release/latest-1", or "release/stable"
# $ sudo chgrp -R jenkins /var/lib/jenkins/gce_keys/
function
fetch_published_version_tars
()
{
if
[[
"
${
KUBERNETES_PROVIDER
}
"
==
"aws"
]]
;
then
clean_binaries
echo
"Skipping SSH key copying for AWS"
local
-r
published_version
=
"
${
1
}
"
else
IFS
=
'/'
read
-a
varr
<<<
"
${
published_version
}
"
mkdir
-p
${
WORKSPACE
}
/.ssh/
bucket
=
"
${
varr
[0]
}
"
cp
/var/lib/jenkins/gce_keys/google_compute_engine
${
WORKSPACE
}
/.ssh/
build_version
=
$(
gsutil
cat
gs://kubernetes-release/
${
published_version
}
.txt
)
cp
/var/lib/jenkins/gce_keys/google_compute_engine.pub
${
WORKSPACE
}
/.ssh/
echo
"Using published version
$bucket
/
$build_version
(from
${
published_version
}
)"
fi
fetch_tars_from_gcs
"
${
bucket
}
"
"
${
build_version
}
"
fi
unpack_binaries
# Set CLUSTER_API_VERSION for GKE CI
export
CLUSTER_API_VERSION
=
$(
echo
${
build_version
}
|
cut
-c
2-
)
}
# TODO(ihmccreery) I'm not sure if this is necesssary, with the workspace check
# below.
function
clean_binaries
()
{
echo
"Cleaning up binaries."
rm
-rf
kubernetes
*
}
function
fetch_tars_from_gcs
()
{
local
-r
bucket
=
"
${
1
}
"
local
-r
build_version
=
"
${
1
}
"
echo
"Pulling binaries from GCS; using server version
${
bucket
}
/
${
build_version
}
."
gsutil
-mq
cp
\
"gs://kubernetes-release/
${
bucket
}
/
${
build_version
}
/kubernetes.tar.gz"
\
"gs://kubernetes-release/
${
bucket
}
/
${
build_version
}
/kubernetes-test.tar.gz"
\
.
}
function
unpack_binaries
()
{
md5sum
kubernetes
*
.tar.gz
md5sum
kubernetes
*
.tar.gz
tar
-xzf
kubernetes.tar.gz
tar
-xzf
kubernetes.tar.gz
tar
-xzf
kubernetes-test.tar.gz
tar
-xzf
kubernetes-test.tar.gz
}
echo
"--------------------------------------------------------------------------------"
echo
"Test Environment:"
printenv
|
sort
echo
"--------------------------------------------------------------------------------"
# We get the Kubernetes tarballs unless we are going to use old ones
if
[[
"
${
JENKINS_USE_EXISTING_BINARIES
:-}
"
=
~ ^[yY]
$
]]
;
then
echo
"Using existing binaries; not cleaning, fetching, or unpacking new ones."
elif
[[
"
${
KUBE_RUN_FROM_OUTPUT
:-}
"
=
~ ^[yY]
$
]]
;
then
# TODO(spxtr) This should probably be JENKINS_USE_BINARIES_FROM_OUTPUT or
# something, rather than being prepended with KUBE, since it's sort of a
# meta-thing.
fetch_output_tars
elif
[[
"
${
JENKINS_USE_SERVER_VERSION
:-}
"
=
~ ^[yY]
$
]]
;
then
# This is for test, staging, and prod jobs on GKE, where we want to
# test what's running in GKE by default rather than some CI build.
check_dirty_workspace
fetch_server_version_tars
else
# use JENKINS_PUBLISHED_VERSION, default to 'ci/latest', since that's
# usually what we're testing.
check_dirty_workspace
fetch_published_version_tars
"
${
JENKINS_PUBLISHED_VERSION
:-
'ci/latest'
}
"
fi
# Copy GCE keys so we don't keep cycling them.
# To set this up, you must know the <project>, <zone>, and <instance>
# on which your jenkins jobs are running. Then do:
#
# # SSH from your computer into the instance.
# $ gcloud compute ssh --project="<prj>" ssh --zone="<zone>" <instance>
#
# # Generate a key by ssh'ing from the instance into itself, then exit.
# $ gcloud compute ssh --project="<prj>" ssh --zone="<zone>" <instance>
# $ ^D
#
# # Copy the keys to the desired location (e.g. /var/lib/jenkins/gce_keys/).
# $ sudo mkdir -p /var/lib/jenkins/gce_keys/
# $ sudo cp ~/.ssh/google_compute_engine /var/lib/jenkins/gce_keys/
# $ sudo cp ~/.ssh/google_compute_engine.pub /var/lib/jenkins/gce_keys/
#
# # Move the permissions for the keys to Jenkins.
# $ sudo chown -R jenkins /var/lib/jenkins/gce_keys/
# $ sudo chgrp -R jenkins /var/lib/jenkins/gce_keys/
if
[[
"
${
KUBERNETES_PROVIDER
}
"
==
"aws"
]]
;
then
echo
"Skipping SSH key copying for AWS"
else
mkdir
-p
${
WORKSPACE
}
/.ssh/
cp
/var/lib/jenkins/gce_keys/google_compute_engine
${
WORKSPACE
}
/.ssh/
cp
/var/lib/jenkins/gce_keys/google_compute_engine.pub
${
WORKSPACE
}
/.ssh/
fi
fi
cd
kubernetes
cd
kubernetes
...
@@ -177,9 +210,8 @@ if [[ "${E2E_TEST,,}" == "true" ]]; then
...
@@ -177,9 +210,8 @@ if [[ "${E2E_TEST,,}" == "true" ]]; then
${
GINKGO_TEST_ARGS
:+--test_args
=
"
${
GINKGO_TEST_ARGS
}
"
}
\
${
GINKGO_TEST_ARGS
:+--test_args
=
"
${
GINKGO_TEST_ARGS
}
"
}
\
&&
exitcode
=
0
||
exitcode
=
$?
&&
exitcode
=
0
||
exitcode
=
$?
if
[[
"
${
E2E_PUBLISH_GREEN_VERSION
:-}
"
==
"true"
&&
${
exitcode
}
==
0
&&
-n
${
build_version
:-}
]]
;
then
if
[[
"
${
E2E_PUBLISH_GREEN_VERSION
:-}
"
==
"true"
&&
${
exitcode
}
==
0
&&
-n
${
build_version
:-}
]]
;
then
echo
"publish build_version to ci/latest-green.txt:
${
build_version
}
"
echo
"Publish build_version to ci/latest-green.txt:
${
build_version
}
"
echo
"
${
build_version
}
"
>
${
WORKSPACE
}
/build_version.txt
gsutil
cp
./version gs://kubernetes-release/ci/latest-green.txt
gsutil
cp
${
WORKSPACE
}
/build_version.txt gs://kubernetes-release/ci/latest-green.txt
fi
fi
fi
fi
...
...
hack/jenkins/job-configs/kubernetes-soak.yaml
View file @
adbd8a9c
...
@@ -71,6 +71,7 @@
...
@@ -71,6 +71,7 @@
export E2E_TEST="false"
export E2E_TEST="false"
export E2E_DOWN="false"
export E2E_DOWN="false"
soak-continuous
:
|
soak-continuous
:
|
export JENKINS_USE_EXISTING_BINARIES="y"
export FAIL_ON_GCP_RESOURCE_LEAK="false"
export FAIL_ON_GCP_RESOURCE_LEAK="false"
export E2E_UP="false"
export E2E_UP="false"
export E2E_DOWN="false"
export E2E_DOWN="false"
...
...
hack/jenkins/job-configs/kubernetes-upgrades.yaml
View file @
adbd8a9c
...
@@ -192,7 +192,7 @@
...
@@ -192,7 +192,7 @@
name
:
'
upgrade-gke'
name
:
'
upgrade-gke'
provider-env
:
|
provider-env
:
|
{gke-provider-env}
{gke-provider-env}
export JENKINS_
FORCE_GET_TARS
="y"
export JENKINS_
TOLERATE_DIRTY_WORKSPACE
="y"
export FAIL_ON_GCP_RESOURCE_LEAK="false"
export FAIL_ON_GCP_RESOURCE_LEAK="false"
jobs
:
jobs
:
-
'
{provider}-{version-old}-{version-new}-upgrades'
:
-
'
{provider}-{version-old}-{version-new}-upgrades'
:
...
@@ -233,7 +233,7 @@
...
@@ -233,7 +233,7 @@
provider-env
:
|
provider-env
:
|
{gce-provider-env}
{gce-provider-env}
export NUM_NODES=5
export NUM_NODES=5
export JENKINS_
FORCE_GET_TARS
="y"
export JENKINS_
TOLERATE_DIRTY_WORKSPACE
="y"
export FAIL_ON_GCP_RESOURCE_LEAK="false"
export FAIL_ON_GCP_RESOURCE_LEAK="false"
jobs
:
jobs
:
-
'
{provider}-{version-old}-{version-new}-upgrades'
:
-
'
{provider}-{version-old}-{version-new}-upgrades'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment