Skip to content

Commit

Permalink
Add kokoro tree from commit 73c47431
Browse files Browse the repository at this point in the history
Issue: 365150653
  • Loading branch information
dahlstrom-g committed Nov 15, 2024
1 parent 8d9678c commit f4c26a2
Show file tree
Hide file tree
Showing 56 changed files with 2,887 additions and 0 deletions.
83 changes: 83 additions & 0 deletions cobalt/devinfra/kokoro/bin/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/bin/bash
set -ueEx

# Load common routines.
. $(dirname "$0")/common.sh

# Using repository root as work directory.
WORKSPACE_COBALT="${KOKORO_ARTIFACTS_DIR}/git/src"
cd "${WORKSPACE_COBALT}"

# Clean up workspace on exit or error.
trap "bash ${WORKSPACE_COBALT}/internal/kokoro/bin/cleanup.sh" EXIT INT TERM


# Linux build script.
pipeline () {
# Run common configuration steps.
configure_environment

# Build Cobalt.
local out_dir="${WORKSPACE_COBALT}/out/${TARGET_PLATFORM}_${CONFIG}"
run_gn "${out_dir}" "${TARGET_PLATFORM}" "${EXTRA_GN_ARGUMENTS:-}"
ninja_build "${out_dir}" "${TARGET}"

# Build bootloader config if set.
if [ -n "${BOOTLOADER:-}" ]; then
echo "Evergreen Loader is configured."
# Deploy static manifest.json (see b/338287855#comment24)
if [[ "${PLATFORM}" =~ "evergreen-arm-hardfp" ]]; then
cp "${WORKSPACE_COBALT}/internal/kokoro/bin/manifest.json" "${out_dir}/install/usr/share/manifest.json"
elif [[ "${PLATFORM}" =~ "evergreen-arm-softfp" ]]; then
cp "${WORKSPACE_COBALT}/internal/kokoro/bin/manifest.json" "${WORKSPACE_COBALT}/chrome/updater/version_manifest/manifest.json"
fi

local bootloader_out_dir="${WORKSPACE_COBALT}/out/${BOOTLOADER}_${CONFIG}"
run_gn \
"${bootloader_out_dir}" \
"${BOOTLOADER}" \
"${BOOTLOADER_EXTRA_GN_ARGUMENTS:-}"
ninja_build "${bootloader_out_dir}" "${BOOTLOADER_TARGET}"
else
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}/internal/kokoro/build/android/simple_packager.py" \
"${out_dir}" \
"${package_dir}" \
"${WORKSPACE_COBALT}"
elif [[ "${PLATFORM}" =~ "evergreen" ]]; then
# Creates Evergreen package directory.
python3 "${WORKSPACE_COBALT}/internal/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
}

# Run the pipeline.
pipeline
12 changes: 12 additions & 0 deletions cobalt/devinfra/kokoro/bin/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set -x

REPO_ROOT="$(dirname "$0")/../../.."
# After kokoro build finishes, changed files in c:/tmpfs get rsync'ed to a borg executor,
# from where the artifacts and reports are processed.
# Especially on Windows, the rsync can take long time, so we cleanup the cobalt workspace
# after finishing each build.
set +e
pushd $REPO_ROOT
time git clean -fdx
popd
exit 0
Loading

0 comments on commit f4c26a2

Please sign in to comment.