Skip to content

Commit

Permalink
Run scenarios as presubmit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ole Markus With committed Jun 18, 2021
1 parent 451f47f commit 55abcda
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
13 changes: 13 additions & 0 deletions tests/e2e/kubetest2-kops/deployer/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,19 @@ func (d *deployer) verifyKopsFlags() error {
return errors.New("missing required --kops-binary-path when --kops-version-marker is not used")
}

// when we use a binary path, we want to use the corresponding nodeup et.al
if d.KopsBinaryPath != "" {
baseUrl := os.Getenv("KOPS_BASE_URL")
if baseUrl == "" {
stageLocation, err := defaultStageLocation(d.KopsRoot)
if err != nil {
return err
}
d.KopsBaseURL = strings.Replace(stageLocation, "gs://", "https://storage.googleapis.com/", 1)
}

}

switch d.CloudProvider {
case "aws":
case "gce":
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/scenarios/addon-resource-tracking/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ ${KUBETEST2} \
haveds

# Upgrade to a version that should adopt existing resources and apply the change below
KOPS_BASE_URL="$(curl -s https://storage.googleapis.com/kops-ci/bin/latest-ci-updown-green.txt)"
KOPS=$(kops-download-from-base)
KOPS=$(kops-acquire-latest)

cp "${KOPS}" "${WORKSPACE}/kops"

Expand Down
4 changes: 1 addition & 3 deletions tests/e2e/scenarios/aws-ebs-csi/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ source "${REPO_ROOT}"/tests/e2e/scenarios/lib/common.sh

REPORT_DIR="${ARTIFACTS:-$(pwd)/_artifacts}/aws-ebs-csi-driver/"

export KOPS_BASE_URL
KOPS_BASE_URL="$(curl -s https://storage.googleapis.com/kops-ci/bin/latest-ci-updown-green.txt)"
KOPS=$(kops-download-from-base)
KOPS=$(kops-acquire-latest)

OVERRIDES="${OVERRIDES-} --override=cluster.spec.cloudConfig.awsEBSCSIDriver.enabled=true"
OVERRIDES="$OVERRIDES --override=cluster.spec.snapshotController.enabled=true"
Expand Down
21 changes: 16 additions & 5 deletions tests/e2e/scenarios/lib/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ set -o xtrace
echo "CLOUD_PROVIDER=${CLOUD_PROVIDER}"
echo "CLUSTER_NAME=${CLUSTER_NAME}"

if [[ -n "${KOPS_BASE_URL-}" ]]; then
unset KOPS_BASE_URL
fi

if [[ -z "${WORKSPACE-}" ]]; then
export WORKSPACE
WORKSPACE=$(mktemp -dt kops.XXXXXXXXX)
Expand Down Expand Up @@ -61,7 +57,7 @@ if [[ -z "${AWS_SSH_PUBLIC_KEY_FILE-}" ]]; then
export AWS_SSH_PUBLIC_KEY_FILE="${HOME}/.ssh/id_rsa.pub"
fi

KUBETEST2="kubetest2 kops -v=2 --cloud-provider=${CLOUD_PROVIDER} --cluster-name=${CLUSTER_NAME:-}"
KUBETEST2="kubetest2 kops -v=2 --cloud-provider=${CLOUD_PROVIDER} --cluster-name=${CLUSTER_NAME:-} --kops-root=${REPO_ROOT}"
KUBETEST2="${KUBETEST2} --admin-access=${ADMIN_ACCESS:-} --env=KOPS_FEATURE_FLAGS=${KOPS_FEATURE_FLAGS}"

# Always tear-down the cluster when we're done
Expand Down Expand Up @@ -97,6 +93,21 @@ function kops-base-from-marker() {
fi
}

# This function will download the latest kops if in a periodic job, otherwise build from the current tree
function kops-acquire-latest() {
if [[ "${JOB_TYPE-}" == "periodic" ]]; then
export KOPS_BASE_URL
KOPS_BASE_URL="$(curl -s https://storage.googleapis.com/kops-ci/bin/latest-ci-updown-green.txt)"
kops-download-from-base
else
if [[ -n "${KOPS_BASE_URL-}" ]]; then
unset KOPS_BASE_URL
fi
$KUBETEST2 --build
echo "${REPO_ROOT}"/.bazelbuild/dist/linux/amd64/kops
fi
}

function kops-up() {
local create_args
create_args="--networking ${NETWORKING} ${OVERRIDES-}"
Expand Down

0 comments on commit 55abcda

Please sign in to comment.