diff --git a/ci/bpf/00_create_instance.sh b/ci/bpf/00_create_instance.sh deleted file mode 100755 index 434cab431af..00000000000 --- a/ci/bpf/00_create_instance.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash -ex - -# Copyright 2018- The Pixie 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. -# -# SPDX-License-Identifier: Apache-2.0 - -if [[ -z ${GCP_PROJECT} ]]; then - echo "GCP_PROJECT must be set"; - exit 1 -fi - -DEFAULT_IMAGE="projects/${GCP_PROJECT}/global/images/bpf-runner-4-14-215" -IMAGE_TO_USE="" - -if [[ $KERNEL_VERSION = '5.19' ]]; then - IMAGE_TO_USE="projects/${GCP_PROJECT}/global/images/bpf-runner-5-19-11" -elif [[ $KERNEL_VERSION = '5.15' ]]; then - IMAGE_TO_USE="projects/${GCP_PROJECT}/global/images/bpf-runner-5-15-15" -elif [[ $KERNEL_VERSION = '5.10' ]]; then - IMAGE_TO_USE="projects/${GCP_PROJECT}/global/images/bpf-runner-5-10-149" -elif [[ $KERNEL_VERSION = '5.4' ]]; then - IMAGE_TO_USE="projects/${GCP_PROJECT}/global/images/bpf-runner-5-4-19" -elif [[ $KERNEL_VERSION = '4.19' ]]; then - IMAGE_TO_USE="projects/${GCP_PROJECT}/global/images/bpf-runner-4-19-260" -elif [[ $KERNEL_VERSION = '4.14' ]]; then - IMAGE_TO_USE="projects/${GCP_PROJECT}/global/images/bpf-runner-4-14-215" -elif [[ $KERNEL_VERSION ]]; then - echo "Unsupported kernel version: ${KERNEL_VERSION}" - exit 1 -else - IMAGE_TO_USE="${DEFAULT_IMAGE}" -fi - -NAME="bpf-${KERNEL_VERSION//./-}-${BUILD_TAG/jenkins-/}" - -printenv - -gcloud components install beta --quiet - -gcloud beta compute instances create \ - "${NAME}" \ - --quiet \ - --project="${GCP_PROJECT}" \ - --zone=us-west1-b \ - --machine-type=n2d-standard-32 \ - --service-account="jenkins-worker@${GCP_PROJECT}.iam.gserviceaccount.com" \ - --scopes=https://www.googleapis.com/auth/cloud-platform \ - --network-interface=network-tier=PREMIUM,subnet=us-west1-0 \ - --maintenance-policy=MIGRATE --provisioning-model=STANDARD \ - --instance-termination-action=DELETE --max-run-duration=10800s \ - --service-account="jenkins-worker@${GCP_PROJECT}.iam.gserviceaccount.com" \ - --scopes=https://www.googleapis.com/auth/cloud-platform \ - --create-disk="auto-delete=yes,boot=yes,device-name=instance-1,image=${IMAGE_TO_USE},mode=rw,size=256,type=projects/${GCP_PROJECT}/zones/us-central1-a/diskTypes/pd-ssd" - -cleanup() { - gcloud compute instances delete \ - "${NAME}" \ - --project="${GCP_PROJECT}" \ - --zone=us-west1-b \ - --delete-disks=all \ - --quiet -} -trap cleanup EXIT - -run_on_instance() { - PASSTHROUGH_ENV=( - "BUILDABLE_FILE=${BUILDABLE_FILE}" - "TEST_FILE=${TEST_FILE}" - "BAZEL_ARGS='${BAZEL_ARGS}'" - "STASH_NAME=${STASH_NAME}" - "GCS_STASH_BUCKET=${GCS_STASH_BUCKET}" - "BUILD_TAG=${BUILD_TAG}" - "BES_FILE=${BES_FILE}" - ) - - gcloud compute ssh \ - "jenkins@${NAME}" \ - --project="${GCP_PROJECT}" \ - --zone=us-west1-b \ - --command="${PASSTHROUGH_ENV[*]} $*" -} - -scp_to_instance() { - gcloud compute scp \ - --project="${GCP_PROJECT}" \ - --zone=us-west1-b \ - "$@" -} - -MAX_SEC=300 -TIMEOUT=$(($(date -u +%s) + MAX_SEC)) - -until run_on_instance ls; do - if [[ $(date -u +%s) -gt TIMEOUT ]]; then - echo "Timed out waiting for ssh propagation" - exit 1; - fi - echo "waiting for ssh propagation" - sleep 2; -done; - -scp_to_instance ./.archive/src.tar.gz "jenkins@${NAME}":src.tar.gz -scp_to_instance ./.archive/targets.tar.gz "jenkins@${NAME}":targets.tar.gz - -run_on_instance tar -zxf src.tar.gz --no-same-owner -run_on_instance tar -zxf targets.tar.gz --no-same-owner - -run_on_instance ./ci/bpf/01_setup_instance.sh -run_on_instance ./ci/bpf/02_docker_run.sh diff --git a/ci/bpf/01_setup_instance.sh b/ci/bpf/01_setup_instance.sh deleted file mode 100755 index bba8cfa7a9a..00000000000 --- a/ci/bpf/01_setup_instance.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -e - -# Copyright 2018- The Pixie 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. -# -# SPDX-License-Identifier: Apache-2.0 - -echo "BPF Runner Kernel Version: $(uname -r)" -echo "Proc Version: $(cat /proc/version)" - -sudo usermod -aG docker "${USER}" -newgrp - docker diff --git a/ci/bpf/02_docker_run.sh b/ci/bpf/02_docker_run.sh deleted file mode 100755 index 7c2d7059b03..00000000000 --- a/ci/bpf/02_docker_run.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -e - -# Copyright 2018- The Pixie 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. -# -# SPDX-License-Identifier: Apache-2.0 - -MAX_SEC=300 -TIMEOUT=$(($(date -u +%s) + MAX_SEC)) - -until docker info; do - if [[ $(date -u +%s) -gt TIMEOUT ]]; then - echo "Timed out waiting for docker to be available" - exit 1; - fi - echo "waiting for docker" - sleep 2; -done; - -echo "Docker Version:" -docker version - -PASSTHROUGH_ENV_ARGS=( - --env "BUILDABLE_FILE=${BUILDABLE_FILE}" - --env "TEST_FILE=${TEST_FILE}" - --env "BAZEL_ARGS='${BAZEL_ARGS}'" - --env "STASH_NAME=${STASH_NAME}" - --env "GCS_STASH_BUCKET=${GCS_STASH_BUCKET}" - --env "BUILD_TAG=${BUILD_TAG}" - --env "BES_FILE=${BES_FILE}" -) - -export PX_DOCKER_RUN_AS_ROOT=True -export PX_RUN_DOCKER_EXTRA_ARGS="${PASSTHROUGH_ENV_ARGS[*]}" - -./scripts/run_docker_bpf.sh ./ci/bpf/03_run_tests.sh diff --git a/ci/bpf/03_run_tests.sh b/ci/bpf/03_run_tests.sh deleted file mode 100755 index e04dfe8e9d2..00000000000 --- a/ci/bpf/03_run_tests.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -ex - -# Copyright 2018- The Pixie 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. -# -# SPDX-License-Identifier: Apache-2.0 - -printenv - -# 3 means that some tests failed. -# 4 means that tests not present. -# 38 means that bes update failed. -check_retval() { - if [[ $1 -eq 0 || $1 -eq 3 || $1 -eq 4 || $1 -eq 38 ]]; then - echo "Bazel returned ${1}, ignoring..." - else - echo "Bazel failed with ${1}" - exit "${1}" - fi -} - -cp "${BES_FILE}" bes.bazelrc - -IFS=' ' -# Read the environment variable and set it to an array. This allows -# us to use an array access as args. -read -ra BAZEL_ARGS <<< "${BAZEL_ARGS}" - -retval=0 -bazel build "${BAZEL_ARGS[@]}" --target_pattern_file "${BUILDABLE_FILE}" || retval=$? -check_retval $retval - -retval=0 -bazel test "${BAZEL_ARGS[@]}" --target_pattern_file "${TEST_FILE}" || retval=$? -check_retval $retval - -rm -rf bazel-testlogs-archive -mkdir -p bazel-testlogs-archive -cp -a bazel-testlogs/ bazel-testlogs-archive || true - -STASH_FILE="${STASH_NAME}.tar.gz" -mkdir -p .archive && tar --exclude=.archive -czf ".archive/${STASH_FILE}" bazel-testlogs-archive/** -gsutil -o GSUtil:parallel_composite_upload_threshold=150M cp ".archive/${STASH_FILE}" "gs://${GCS_STASH_BUCKET}/${BUILD_TAG}/${STASH_FILE}" - -# With failed tests, we want to upload the testlogs, -# but then still fatal so that if there's issues parsing the testlog, -# the build still fails. -if [[ $retval -eq 3 ]]; then - exit 3 -fi