crosvm/ci/kokoro/build-merge-into-chromeos.sh
Dennis Kempin ca66addad0 Update merge_bot to support merging across repos
We will be merging from the upstream repo into the cros repo. The
script can be run from both an upstream and a cros checkout, it
will setup the required remotes.

The CLI changes a little. We now require a revision to merge from
needs to be specified, since the script is not setting up the
upstream remote.

CI jobs will simply use HEAD, as the version to merge is already
checked out by the CI system.

BUG=b:233913643
TEST=
./merge_bot update-merges HEAD
./merge_bot update-merges origin/main
./merge_bot update-dry-runs HEAD

Change-Id: I247e1edc3ad951becf5d59b63efd74914bb2205f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3687222
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-03 19:12:04 +00:00

41 lines
1.3 KiB
Bash
Executable file

#!/bin/bash
# Copyright 2021 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -e
# Python script to check for at least version 3.9
VERSION_CHECK="
import sys
sys.exit(sys.version_info.major != 3 or sys.version_info.minor < 9)
"
main() {
cd "${KOKORO_ARTIFACTS_DIR}/git/crosvm"
# Ensure we have at least python 3.9. Kokoro does not and requires us to use pyenv to install
# The required version.
if ! python3 -c "$VERSION_CHECK"; then
pyenv install --verbose --skip-existing 3.9.5
pyenv global 3.9.5
fi
# Extra packages required by merge_bot
if ! pip show argh; then
pip install argh
fi
# Run git cookie auth daemon to pull git http cookies for this GCE instance.
local gcompute_path="${KOKORO_ARTIFACTS_DIR}/gcompute-tools"
git clone "https://gerrit.googlesource.com/gcompute-tools" "$gcompute_path"
${gcompute_path}/git-cookie-authdaemon
# Overwrite kokoro default with service account we are actually using to submit code.
git config user.name "Crosvm Bot"
git config user.email "crosvm-bot@crosvm-packages.iam.gserviceaccount.com"
./tools/chromeos/merge_bot -v update-merges --is-bot HEAD
./tools/chromeos/merge_bot -v update-dry-runs --is-bot HEAD
}
main