Skip to content

Commit

Permalink
Clean up Linux and Android release packaging (#4841)
Browse files Browse the repository at this point in the history
Remove currently unsupported release packaging builds (evergreen) and
simplify logic for supported release packaging builds by removing
redundant function "create_and_upload_nightly_archive". Remove
deprecated code "simple_packager" to improve readability.

b/393447640
  • Loading branch information
briantting authored Feb 5, 2025
2 parents 242c9e0 + ac60ace commit 58e8fa7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 191 deletions.
69 changes: 14 additions & 55 deletions cobalt/devinfra/kokoro/bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -238,73 +238,32 @@ upload_on_device_test_artifacts () {
echo -n "${gcs_archive_path}" > "${KOKORO_ARTIFACTS_DIR}/gcs_archive_path"
}


create_and_upload_nightly_archive () {
if [[ $# -ne 4 ]]; then
echo "Error: Exactly 4 arguments required!"
exit 1
fi

local platform=$1
local package_dir=$2
local local_archive_path=$3
local build_info_path=$4

local gcs_path_suffix="_nightly"
if [[ "${KOKORO_GOB_BRANCH_src}" != "COBALT" ]]; then
gcs_path_suffix="_${KOKORO_GOB_BRANCH_src}"
fi
local gcs_archive_path="gs://$(get_bucket_name)/${platform}${gcs_path_suffix}/$(date +%F)/${KOKORO_ROOT_BUILD_NUMBER}/"

init_gcloud

# Copy everything in package_dir but not its last path segment; gcs_archive_path already exists.
"${GSUTIL}" cp -r "${package_dir}/." "${gcs_archive_path}"
}

run_package_release_pipeline () {
# NOTE: For DinD builds, we only run the GN and Ninja steps in the container.
# Artifacts and build-products from these steps are used in subsequent steps
# for packaging and nightly post-build tasks, and do not need to be run in the
# inner container environment (which has build tools and deps).

local out_dir="${WORKSPACE_COBALT}/out/${TARGET_PLATFORM}_${CONFIG}"

# Package and upload nightly release archive.
if is_release_build && is_release_config; then
# Setup package dir.
local out_dir="${WORKSPACE_COBALT}/out/${TARGET_PLATFORM}_${CONFIG}"
local package_dir="${WORKSPACE_COBALT}/package/${PLATFORM}_${CONFIG}"
mkdir -p "${package_dir}"

# TODO(b/294130306): Move build_info to gn packaging.
local build_info_path="${out_dir}/gen/build_info.json"
cp "${build_info_path}" "${package_dir}/"
# Create reference build_info.json
cp "${out_dir}/gen/build_info.json" "${package_dir}/"

# Create release package.
export PYTHONPATH="${WORKSPACE_COBALT}"
# Create release package
local package_platform="linux"
if [[ "${PLATFORM}" =~ "android" ]]; then
python3 "${WORKSPACE_COBALT}/cobalt/build/android/package.py" \
--name="${PLATFORM}_${CONFIG}" "${out_dir}" "${package_dir}"
elif [[ "${PLATFORM}" =~ "evergreen" ]]; then
local bootloader_out_dir=
if [ -n "${BOOTLOADER:-}" ]; then
bootloader_out_dir="${WORKSPACE_COBALT}/out/${BOOTLOADER}_${CONFIG}"
fi
# Creates Evergreen package directory.
python3 "${WORKSPACE_COBALT}/cobalt/devinfra/kokoro/build/evergreen/simple_packager.py" \
"${out_dir}" \
"${package_dir}" \
"${bootloader_out_dir:-}"
else
python3 "${WORKSPACE_COBALT}/cobalt/build/linux/package.py" \
--name="${PLATFORM}_${CONFIG}" "${out_dir}" "${package_dir}"
package_platform="android"
fi

# Create and upload nightly archive.
create_and_upload_nightly_archive \
"${PLATFORM}" \
"${package_dir}" \
"${package_dir}.tar.gz" \
"${build_info_path}"
python3 "${WORKSPACE_COBALT}/cobalt/build/${package_platform}/package.py" \
--name="${PLATFORM}_${CONFIG}" "${out_dir}" "${package_dir}"

# Upload release package
local gcs_archive_path="gs://$(get_bucket_name)/${PLATFORM}_${KOKORO_GOB_BRANCH_src}/$(date +%F)/${KOKORO_ROOT_BUILD_NUMBER}/"
init_gcloud
# Ensure that only package directory contents are uploaded and not the directory itself
"${GSUTIL}" cp -r "${package_dir}/." "${gcs_archive_path}"
fi
}
51 changes: 0 additions & 51 deletions cobalt/devinfra/kokoro/build/android/simple_packager.py

This file was deleted.

85 changes: 0 additions & 85 deletions cobalt/devinfra/kokoro/build/evergreen/simple_packager.py

This file was deleted.

0 comments on commit 58e8fa7

Please sign in to comment.