Skip to content

Commit

Permalink
Refactor release packaging
Browse files Browse the repository at this point in the history
Simply and reduce release packaging pipeline for linux and android.
Removes legacy support. Evergreen support remains incomplete.

b/393447640
  • Loading branch information
briantting committed Jan 31, 2025
1 parent 8bca239 commit 2e489a9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 224 deletions.
1 change: 1 addition & 0 deletions cobalt/build/android/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@


def lay_out(out_dir, base_dir):
shutil.copy2(os.path.join(out_dir, 'gen', 'build_info.json'), base_dir)
shutil.copy2(os.path.join(out_dir, 'apks/Cobalt.apk'), base_dir)
shutil.copytree(
os.path.join(out_dir, 'content'),
Expand Down
1 change: 1 addition & 0 deletions cobalt/build/linux/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@


def lay_out(out_dir, base_dir):
shutil.copy2(os.path.join(out_dir, 'gen', 'build_info.json'), base_dir)
place_in_base_dir = [
'cobalt',
'content_shell.pak',
Expand Down
37 changes: 2 additions & 35 deletions cobalt/devinfra/kokoro/bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,41 +42,8 @@ pipeline () {
echo "Evergreen Loader is not configured."
fi

# Package and upload nightly release archive.
if is_release_build && is_release_config; then
# Setup package dir.
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 release package.
if [[ "${PLATFORM}" =~ "android" ]]; then
# Creates Android package directory.
python3 "${WORKSPACE_COBALT}/cobalt/devinfra/kokoro/build/android/simple_packager.py" \
"${out_dir}" \
"${package_dir}" \
"${WORKSPACE_COBALT}"
elif [[ "${PLATFORM}" =~ "evergreen" ]]; then
# Creates Evergreen package directory.
python3 "${WORKSPACE_COBALT}/cobalt/devinfra/kokoro/build/evergreen/simple_packager.py" \
"${out_dir}" \
"${package_dir}" \
"${bootloader_out_dir:-}"
else
# Sets package directory as out directory.
package_dir="${out_dir}"
fi

# Create and upload nightly archive.
create_and_upload_nightly_archive \
"${PLATFORM}" \
"${package_dir}" \
"${package_dir}.tar.gz" \
"${build_info_path}"
fi
# Potentially create and upload release package
run_package_release_pipeline
}

# Run the pipeline.
Expand Down
65 changes: 12 additions & 53 deletions cobalt/devinfra/kokoro/bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -247,72 +247,31 @@ 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

"${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=cobalt-android "${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=cobalt-linux "${out_dir}" "${package_dir}"
package_platform="android"
fi
python3 "${WORKSPACE_COBALT}/cobalt/build/${package_platform}/package.py" \
--name="${PLATFORM}_${CONFIG}" "${out_dir}" "${package_dir}"

# Create and upload nightly archive.
create_and_upload_nightly_archive \
"${PLATFORM}" \
"${package_dir}" \
"${package_dir}.tar.gz" \
"${build_info_path}"
# Upload release package
local gcs_archive_path="gs://$(get_bucket_name)/${PLATFORM}_${KOKORO_GOB_BRANCH_src}/$(date +%F)/${KOKORO_ROOT_BUILD_NUMBER}/"
init_gcloud
"${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 2e489a9

Please sign in to comment.