-
Notifications
You must be signed in to change notification settings - Fork 580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
e2e tests #606
Closed
Closed
e2e tests #606
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,9 @@ | ||
# This file is a line-delimited list of MD5 checksums of AWS keys that should | ||
# not be used with the CAPA e2e tests or any janitorial work that occurs after | ||
# the test execution. | ||
# | ||
# To add a new key to the file, execute: | ||
# | ||
# $ echo "${AWS_ACCESS_KEY_ID}" | { md5sum 2>/dev/null || md5; } | awk '{print $1}' >> hack/e2e-aws-disallowed.txt | ||
|
||
afbf8e5c5622470940b050594f82c47e |
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,45 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2019 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. | ||
|
||
################################################################################ | ||
# usage: e2e-aws-janitor.sh [FLAGS] | ||
# This program is a wrapper for running the aws-janitor command with a check | ||
# that prevents disallowed AWS keys from being used. | ||
# | ||
# FLAGS | ||
# To see a full list of flags supported by this program, run "aws-janitor -h" | ||
################################################################################ | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. | ||
cd "${REPO_ROOT}" || exit 1 | ||
|
||
# Require the aws-janitor command. | ||
command -v aws-janitor >/dev/null 2>&1 || \ | ||
{ echo "aws-janitor not found" 1>&2; exit 1; } | ||
|
||
# Prevent a disallowed AWS key from being used. | ||
if grep -iqF "$(echo "${AWS_ACCESS_KEY_ID-}" | \ | ||
{ md5sum 2>/dev/null || md5; } | \ | ||
awk '{print $1}')" hack/e2e-aws-disallowed.txt; then | ||
echo "The provided AWS key is not allowed" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
exec aws-janitor -all "${@-}" |
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,46 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2019 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
################################################################################ | ||
# usage: e2e-aws-resources-list.sh [FLAGS] | ||
# This program is a wrapper for running the aws-resources-list command with | ||
# a check that prevents disallowed AWS keys from being used. | ||
# | ||
# FLAGS | ||
# To see a full list of flags supported by this program, run | ||
# "aws-resources-list -h" | ||
################################################################################ | ||
|
||
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. | ||
cd "${REPO_ROOT}" || exit 1 | ||
|
||
# Require the aws-resources-list command. | ||
command -v aws-resources-list >/dev/null 2>&1 || \ | ||
{ echo "aws-resources-list not found" 1>&2; exit 1; } | ||
|
||
# Prevent a disallowed AWS key from being used. | ||
if grep -iqF "$(echo "${AWS_ACCESS_KEY_ID-}" | \ | ||
{ md5sum 2>/dev/null || md5; } | \ | ||
awk '{print $1}')" hack/e2e-aws-disallowed.txt; then | ||
echo "The provided AWS key is not allowed" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
exec aws-resources-list "${@-}" |
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,88 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2019 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. | ||
|
||
################################################################################ | ||
# usage: e2e.sh | ||
# This program runs the e2e tests. | ||
# | ||
# ENVIRONMENT VARIABLES | ||
# JANITOR_ENABLED | ||
# Set to 1 to run the aws-janitor command after running the e2e tests. | ||
################################################################################ | ||
|
||
set -o nounset | ||
set -o pipefail | ||
|
||
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. | ||
cd "${REPO_ROOT}" || exit 1 | ||
|
||
# If BOSKOS_HOST is set then acquire an AWS account from Boskos. | ||
if [ -n "${BOSKOS_HOST:-}" ]; then | ||
# Check out the account from Boskos and store the produced environment | ||
# variables in a temporary file. | ||
account_env_var_file="$(mktemp)" | ||
python hack/checkout_account.py 1>"${account_env_var_file}" | ||
checkout_account_status="${?}" | ||
|
||
# If the checkout process was a success then load the account's | ||
# environment variables into this process. | ||
# shellcheck disable=SC1090 | ||
[ "${checkout_account_status}" = "0" ] && . "${account_env_var_file}" | ||
|
||
# Always remove the account environment variable file. It contains | ||
# sensitive information. | ||
rm -f "${account_env_var_file}" | ||
|
||
if [ ! "${checkout_account_status}" = "0" ]; then | ||
echo "error getting account from boskos" 1>&2 | ||
exit "${checkout_account_status}" | ||
fi | ||
fi | ||
|
||
# Prevent a disallowed AWS key from being used. | ||
if grep -iqF "$(echo "${AWS_ACCESS_KEY_ID-}" | \ | ||
{ md5sum 2>/dev/null || md5; } | \ | ||
awk '{print $1}')" hack/e2e-aws-disallowed.txt; then | ||
echo "The provided AWS key is not allowed" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
bazel test --define='gotags=e2e' --test_output all //test/e2e/... | ||
bazel_status="${?}" | ||
|
||
# If the artifacts environment variable is set then coalesce the test results. | ||
[ -z "${ARTIFACTS:-}" ] || python hack/coalesce.py | ||
|
||
# If Boskos is being used then release the AWS account back to Boskos. | ||
[ -z "${BOSKOS_HOST:-}" ] || hack/checkin_account.py | ||
|
||
# The janitor is typically not run as part of the e2e process, but rather | ||
# in a parallel process via a service on the same cluster that runs Prow and | ||
# Boskos. | ||
# | ||
# However, setting JANITOR_ENABLED=1 tells this program to run the janitor | ||
# after the e2e test is executed. | ||
if [ "${JANITOR_ENABLED:-0}" = "1" ]; then | ||
if ! command -v aws-janitor >/dev/null 2>&1; then | ||
echo "skipping janitor; aws-janitor not found" 1>&2 | ||
else | ||
aws-janitor -all -v 2 | ||
fi | ||
else | ||
echo "skipping janitor; JANITOR_ENABLED=${JANITOR_ENABLED}" 1>&2 | ||
fi | ||
|
||
exit "${bazel_status}" |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ashish-amarnath,
Are you suggesting the definition of a target named
WARNING
? If so, do you mean the text should be echoed? I am sorry, but I do not understand the proposed change.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I missed this comment.
The suggestion was to add a comment to caution users not to change the
JANITOR_ENABLED
flag.