-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
images/bootstrap: added arm64 support
- Loading branch information
Showing
16 changed files
with
2,715 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
filegroup( | ||
name = "scenarios", | ||
srcs = glob(["*.py"]), | ||
) | ||
|
||
filegroup( | ||
name = "package-srcs", | ||
srcs = glob(["**"]), | ||
tags = ["automanaged"], | ||
visibility = ["//visibility:private"], | ||
) | ||
|
||
filegroup( | ||
name = "all-srcs", | ||
srcs = [":package-srcs"], | ||
tags = ["automanaged"], | ||
) | ||
|
||
py_test( | ||
name = "kubernetes_e2e_test", | ||
srcs = [ | ||
"kubernetes_e2e.py", | ||
"kubernetes_e2e_test.py", | ||
], | ||
python_version = "PY2", | ||
) | ||
|
||
py_test( | ||
name = "kubernetes_bazel_test", | ||
srcs = [ | ||
"kubernetes_bazel.py", | ||
"kubernetes_bazel_test.py", | ||
], | ||
python_version = "PY2", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# See the OWNERS docs at https://go.k8s.io/owners | ||
|
||
reviewers: | ||
- amwat | ||
- BenTheElder | ||
- MushuEE | ||
- spiffxp | ||
approvers: | ||
- amwat | ||
- BenTheElder | ||
- spiffxp | ||
emeritus_approvers: | ||
- cjwagner | ||
- fejta | ||
- krzyzacy | ||
|
||
labels: | ||
- area/scenarios |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# DEPRECATION NOTICE | ||
|
||
*October 9, 2018* `scenarios/*.py` will be moved to become part of kubetest v2, so we are | ||
not taking PRs except for urgent bug fixes. | ||
|
||
Also please bump [bootstrap image](/images/bootstrap) and | ||
[kubekins image](/images/kubekins-e2e) to take in any future changes. | ||
|
||
# Test scenarios | ||
|
||
Place scripts to run test scenarios inside this location. | ||
|
||
Test jobs are composed of two things: | ||
1) A scenario to test | ||
2) Configuration options for the scenario. | ||
|
||
Three example scenarios are: | ||
|
||
* Unit tests | ||
* Node e2e tests | ||
* e2e tests | ||
|
||
Example configurations are: | ||
|
||
* Parallel tests on gce | ||
* Build all platforms | ||
|
||
The assumption is that each scenario will be called a variety of times with | ||
different configuration options. For example at the time of this writing there | ||
are over 300 e2e jobs, each run with a slightly different set of options. | ||
|
||
## Contract | ||
|
||
The scenario assumes the calling process (bootstrap.py) has setup all | ||
prerequisites, such as checking out the right repository, setting pwd, | ||
activating service accounts, etc. | ||
|
||
The scenario also assumes that the calling process will handle all post-job | ||
works, such as recording log output, copying logs to gcs, etc. | ||
|
||
The scenario should exit 0 if and only on success. | ||
|
||
The calling process can configure the scenario by calling the scenario | ||
with different arguments. For example: `kubernetes\_build.py --fast` | ||
configures the scenario to do a fast build (one platform) and/or | ||
`kubernetes\_build.py --federation=random-project` configures the scenario | ||
to do a federation build using the random-project. | ||
|
||
Call the scenario with `-h` to see configuration options. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/usr/bin/env python | ||
|
||
# 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. | ||
|
||
# Need to figure out why this only fails on travis | ||
# pylint: disable=bad-continuation | ||
|
||
"""Executes a command.""" | ||
|
||
import argparse | ||
import os | ||
import subprocess | ||
import sys | ||
|
||
def check_with_log(*cmd): | ||
"""Log and run the command, raising on errors.""" | ||
print >>sys.stderr, 'Run:', cmd | ||
print >>sys.stderr, subprocess.check_call(cmd) | ||
|
||
def check_no_log(*cmd): | ||
"""Run the command, raising on errors, no logs""" | ||
try: | ||
subprocess.check_call(cmd) | ||
except: | ||
raise subprocess.CalledProcessError(cmd='subprocess.check_call', returncode=1) | ||
|
||
def check_output(*cmd): | ||
"""Log and run the command, return output, raising on errors.""" | ||
print >>sys.stderr, 'Run:', cmd | ||
return subprocess.check_output(cmd) | ||
|
||
|
||
def main(target, buildfile): | ||
"""Build & push to canary.""" | ||
check_with_log( | ||
'docker', 'build', '-t', target, '--no-cache=true', | ||
'--pull=true', '--file=%s' % buildfile, '.' | ||
) | ||
check_with_log('docker', 'inspect', target) | ||
|
||
user = None | ||
if os.path.exists(os.environ.get('DOCKER_USER')): | ||
with open(os.environ.get('DOCKER_USER'), 'r') as content_file: | ||
user = content_file.read() | ||
|
||
pwd = None | ||
if os.path.exists(os.environ.get('DOCKER_PASSWORD')): | ||
with open(os.environ.get('DOCKER_PASSWORD'), 'r') as content_file: | ||
pwd = content_file.read() | ||
|
||
if not user or not pwd: | ||
print >>sys.stderr, 'Logging info not exist' | ||
sys.exit(1) | ||
print >>sys.stderr, 'Logging in as %r' % user | ||
check_no_log('docker', 'login', '--username=%s' % user, '--password=%s' % pwd) | ||
|
||
os.environ.pop('DOCKER_USER', None) | ||
os.environ.pop('DOCKER_PASSWORD', None) | ||
|
||
check_with_log('docker', 'push', target) | ||
check_with_log('docker', 'logout') | ||
|
||
|
||
if __name__ == '__main__': | ||
PARSER = argparse.ArgumentParser() | ||
PARSER.add_argument( | ||
'--owner', help='Owner of the job') | ||
PARSER.add_argument( | ||
'--target', help='Build target') | ||
PARSER.add_argument( | ||
'--file', help='Build files') | ||
ARGS = PARSER.parse_args() | ||
if not ARGS.target or not ARGS.file: | ||
raise ValueError('--target and --file must be set!') | ||
if ARGS.owner: | ||
os.environ['OWNER'] = ARGS.owner | ||
main(ARGS.target, ARGS.file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env python | ||
|
||
# Copyright 2018 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. | ||
|
||
# Need to figure out why this only fails on travis | ||
# pylint: disable=bad-continuation | ||
|
||
"""Prepares for nested docker, and executes a command.""" | ||
# TODO(Q-Lee): check the necessity of this once MountPropagation is available in | ||
# prow: https://github.com/kubernetes/kubernetes/pull/59252 | ||
|
||
import argparse | ||
import os | ||
import subprocess | ||
import sys | ||
|
||
def check(*cmd): | ||
"""Log and run the command, raising on errors.""" | ||
print >>sys.stderr, 'Run:', cmd | ||
subprocess.check_call(cmd) | ||
|
||
|
||
def main(envs, cmd): | ||
"""Make important mounts r-shared, then run script and verify it exits 0.""" | ||
check("mount", "--make-rshared", "/lib/modules") | ||
check("mount", "--make-rshared", "/sys") | ||
check("mount", "--make-rshared", "/") | ||
|
||
for env in envs: | ||
key, val = env.split('=', 1) | ||
print >>sys.stderr, '%s=%s' % (key, val) | ||
os.environ[key] = val | ||
if not cmd: | ||
raise ValueError(cmd) | ||
check(*cmd) | ||
|
||
|
||
if __name__ == '__main__': | ||
PARSER = argparse.ArgumentParser() | ||
PARSER.add_argument('--env', default=[], action='append') | ||
PARSER.add_argument('cmd', nargs=1) | ||
PARSER.add_argument('args', nargs='*') | ||
ARGS = PARSER.parse_args() | ||
main(ARGS.env, ARGS.cmd + ARGS.args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env python | ||
|
||
# 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. | ||
|
||
# Need to figure out why this only fails on travis | ||
# pylint: disable=bad-continuation | ||
|
||
"""Executes a command.""" | ||
|
||
import argparse | ||
import os | ||
import subprocess | ||
import sys | ||
|
||
def check(*cmd): | ||
"""Log and run the command, raising on errors.""" | ||
print >>sys.stderr, 'Run:', cmd | ||
subprocess.check_call(cmd) | ||
|
||
|
||
def main(envs, cmd): | ||
"""Run script and verify it exits 0.""" | ||
for env in envs: | ||
key, val = env.split('=', 1) | ||
print >>sys.stderr, '%s=%s' % (key, val) | ||
os.environ[key] = val | ||
if not cmd: | ||
raise ValueError(cmd) | ||
check(*cmd) | ||
|
||
|
||
if __name__ == '__main__': | ||
PARSER = argparse.ArgumentParser() | ||
PARSER.add_argument('--env', default=[], action='append') | ||
PARSER.add_argument('cmd', nargs=1) | ||
PARSER.add_argument('args', nargs='*') | ||
ARGS = PARSER.parse_args() | ||
main(ARGS.env, ARGS.cmd + ARGS.args) |
Oops, something went wrong.