Merge branch 'master' into flatcar-master

This commit is contained in:
Iago López Galeiras 2018-07-30 12:29:47 +02:00
commit a316664a8c
17 changed files with 36 additions and 255 deletions

View File

@ -1 +0,0 @@
../../platform/crostestutils/au_test_harness/cros_au_test_harness.py

View File

@ -1 +0,0 @@
../../platform/crostestutils/cros_run_vm_test

View File

@ -1 +0,0 @@
../../platform/crostestutils/cros_run_vm_update

View File

@ -1 +0,0 @@
../../platform/dev/host/cros_start_vm

View File

@ -1 +0,0 @@
../../platform/dev/host/cros_stop_vm

View File

@ -1,32 +0,0 @@
#!/bin/bash
# Copyright (c) 2010 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.
#
# Simple wrapper script to build a cros_workon package incrementally.
# You must already be cros_workon'ing the package in question.
# --- BEGIN COMMON.SH BOILERPLATE ---
# Load common CrOS utilities. Inside the chroot this file is installed in
# /usr/lib/crosutils. Outside the chroot we find it relative to the script's
# location.
find_common_sh() {
local common_paths=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils)
local path
SCRIPT_ROOT="${common_paths[0]}"
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
SCRIPT_ROOT="${path}"
break
fi
done
}
find_common_sh
. "${SCRIPT_ROOT}/common.sh" || exit 1
# --- END COMMON.SH BOILERPLATE ---
die_notrace \
"error: Please run cros_workon_make from chroot:/usr/bin/cros_workon_make"

View File

@ -1 +0,0 @@
../../platform/crostestutils/ctest/ctest.py

View File

@ -1,63 +0,0 @@
#!/bin/bash
# Copyright (c) 2012 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.
# $1 = hostname, $2 = port
#
# Use socat to connect to the specified host and port via one of the proxies
# defined in the environment, if the target host does not appear in the
# no_proxy environment variable.
DEST_HOST="$1"
DEST_PORT="$2"
# Determine whether the destination host is in the "no_proxy" list.
use_proxy="true"
GLOBIGNORE="*"
for a_host in ${no_proxy//,/ } ; do
case "${a_host}" in
"*") # A "*" matches all hosts.
use_proxy="false"
break
;;
.*) # Items of the form ".some.fqdn" imply match-at-end.
if [[ "${DEST_HOST}" == *"${a_host}" ]]; then
use_proxy="false"
break
fi
;;
${DEST_HOST}) # Items of the form "some.fqdn" imply exact-match.
use_proxy="false"
break
;;
esac
done
if [[ -n "${all_proxy}" ]]; then
PROXY="${all_proxy}"
TYPE=SOCKS4
PORT_ATTR=socksport
elif [[ -n "${https_proxy}" ]]; then
PROXY="${https_proxy}"
TYPE=PROXY
PORT_ATTR=proxyport
elif [[ -n "${http_proxy}" ]]; then
PROXY="${http_proxy}"
TYPE=PROXY
PORT_ATTR=proxyport
else
use_proxy="false"
fi
if [[ "${use_proxy}" == "true" ]]; then
PROXY="${PROXY#*://}"
PROXY="${PROXY%%/*}"
PROXY_HOST="${PROXY%%:*}"
PROXY_PORT="${PROXY##*:}"
PARMS="${PROXY_HOST}:${DEST_HOST}:${DEST_PORT},${PORT_ATTR}=${PROXY_PORT}"
socat_args=( "${TYPE}:${PARMS}" )
else
socat_args=( TCP:"${DEST_HOST}":"${DEST_PORT}" )
fi
exec socat STDIO "${socat_args[@]}"

View File

@ -31,7 +31,7 @@ DEFINE_boolean enable_rootfs_verification ${FLAGS_TRUE} \
DEFINE_string base_pkg "coreos-base/coreos" \
"The base portage package to base the build off of (only applies to prod images)"
DEFINE_string base_dev_pkg "coreos-base/coreos-dev" \
"The base portage package to base the build off of (only applies to dev images)"
"The base portage package to base the build off of (only applies to dev containers)"
DEFINE_string torcx_manifest "${DEFAULT_BUILD_ROOT}/torcx/${DEFAULT_BOARD}/latest/torcx_manifest.json" \
"The torcx manifest describing torcx packages for this image (or blank for none)"
DEFINE_string torcx_root "${DEFAULT_BUILD_ROOT}/torcx" \
@ -57,12 +57,11 @@ This script is used to build a CoreOS image. CoreOS comes in many
different forms. This scripts can be used to build the following:
prod - Production image for CoreOS. This image is for booting.
dev - Developer image. Like base but with additional developer packages.
container - Developer image with single filesystem, bootable by nspawn.
Examples:
build_image --board=<board> [dev] [prod] [container] - builds developer and production images.
build_image --board=<board> [prod] [container] - builds developer and production images.
...
"
show_help_if_requested "$@"
@ -107,18 +106,16 @@ fi
. "${BUILD_LIBRARY_DIR}/board_options.sh" || exit 1
. "${BUILD_LIBRARY_DIR}/build_image_util.sh" || exit 1
. "${BUILD_LIBRARY_DIR}/prod_image_util.sh" || exit 1
. "${BUILD_LIBRARY_DIR}/dev_image_util.sh" || exit 1
. "${BUILD_LIBRARY_DIR}/dev_container_util.sh" || exit 1
. "${BUILD_LIBRARY_DIR}/test_image_content.sh" || exit 1
. "${BUILD_LIBRARY_DIR}/torcx_manifest.sh" || exit 1
. "${BUILD_LIBRARY_DIR}/vm_image_util.sh" || exit 1
PROD_IMAGE=0
DEV_IMAGE=0
CONTAINER=0
for arg in "$@"; do
case "${arg}" in
prod) PROD_IMAGE=1 ;;
dev) DEV_IMAGE=1 ;;
container) CONTAINER=1 ;;
*) die_notrace "Unknown image type ${arg}" ;;
esac
@ -146,8 +143,6 @@ fi
mkdir -p "${BUILD_DIR}"
DISK_LAYOUT="${FLAGS_disk_layout:-base}"
DEV_DISK_LAYOUT="${FLAGS_disk_layout:-devel}"
CONTAINER_LAYOUT="${FLAGS_disk_layout:-container}"
if [[ -n "${FLAGS_developer_data}" ]]; then
@ -169,17 +164,9 @@ fi
fix_mtab
if [[ "${DEV_IMAGE}" -eq 1 ]]; then
IMAGE_BUILD_TYPE="dev"
create_dev_image ${FLATCAR_DEVELOPER_IMAGE_NAME} ${DEV_DISK_LAYOUT} ${FLAGS_group} ${FLAGS_base_dev_pkg}
if [[ ${FLAGS_extract_update} -eq ${FLAGS_TRUE} ]]; then
extract_update "${FLATCAR_DEVELOPER_IMAGE_NAME}" "${DEV_DISK_LAYOUT}"
fi
fi
if [[ "${CONTAINER}" -eq 1 ]]; then
IMAGE_BUILD_TYPE="container"
create_dev_image "${FLATCAR_DEVELOPER_CONTAINER_NAME}" "${CONTAINER_LAYOUT}" "${FLAGS_group}" ${FLAGS_base_dev_pkg}
create_dev_container "${FLATCAR_DEVELOPER_CONTAINER_NAME}" "${CONTAINER_LAYOUT}" "${FLAGS_group}" ${FLAGS_base_dev_pkg}
fi
if [[ "${PROD_IMAGE}" -eq 1 ]]; then
@ -236,10 +223,6 @@ if [[ "${PROD_IMAGE}" -eq 1 ]]; then
echo "Flatcar Production image created as ${FLATCAR_PRODUCTION_IMAGE_NAME}"
print_image_to_vm
fi
if [[ "${DEV_IMAGE}" -eq 1 ]]; then
echo "Developer image created as ${FLATCAR_DEVELOPER_IMAGE_NAME}"
print_image_to_vm dev
fi
command_completed

View File

@ -54,38 +54,17 @@ EOF
eselect profile set --force $(get_board_profile $BOARD)/dev
}
detect_dev_url() {
local port=":8080"
local host=$(hostname --fqdn 2>/dev/null)
if [[ -z "${host}" ]]; then
host=$(ip addr show scope global | \
awk '$1 == "inet" { sub(/[/].*/, "", $2); print $2; exit }')
fi
if [[ -n "${host}" ]]; then
echo "http://${host}${port}"
fi
}
create_dev_image() {
create_dev_container() {
local image_name=$1
local disk_layout=$2
local update_group=$3
local base_pkg="$4"
local devserver=$(detect_dev_url)
local auserver=""
if [ -z "${base_pkg}" ]; then
echo "did not get base package!"
exit 1
fi
if [[ -n "${devserver}" ]]; then
info "Using ${devserver} for local dev server URL."
auserver="${devserver}/update"
else
info "Unable do detect local dev server address."
fi
info "Building developer image ${image_name}"
local root_fs_dir="${BUILD_DIR}/rootfs"
local image_contents="${image_name%.bin}_contents.txt"
@ -102,14 +81,7 @@ create_dev_image() {
write_licenses "${root_fs_dir}" "${BUILD_DIR}/${image_licenses}"
# Setup portage for emerge and gmerge
configure_dev_portage "${root_fs_dir}" "${devserver}"
sudo_append "${root_fs_dir}/etc/flatcar/update.conf" <<EOF
SERVER=${auserver}
# For gmerge
DEVSERVER=${devserver}
EOF
configure_dev_portage "${root_fs_dir}"
# Mark the image as a developer image (input to chromeos_startup).
# TODO(arkaitzr): Remove this file when applications no longer rely on it

View File

@ -73,30 +73,6 @@
"mount":"/"
}
},
"devel": {
"3":{
"label":"USR-A",
"uuid":"7130c94a-213a-4e5a-8e26-6cce9662f132",
"type":"coreos-rootfs",
"blocks":"4194304",
"fs_blocks":"520188",
"fs_type":"ext2",
"mount":"/usr",
"features": ["prioritize", "verity"]
},
"4":{
"label":"USR-B",
"uuid":"e03dd35c-7c2d-4a47-b3fe-27f15780a57c",
"type":"coreos-rootfs",
"blocks":"4194304",
"fs_blocks":"520188"
},
"9":{
"label":"ROOT",
"fs_label":"ROOT",
"blocks":"12943360"
}
},
"vm":{
"9":{
"label":"ROOT",

View File

@ -232,7 +232,6 @@ DEFAULT_IMAGES=(
# generated manifest, but won't be included in the vendor store.
EXTRA_IMAGES=(
=app-torcx/docker-17.03
=app-torcx/docker-18.03
)
mkdir -p "${BUILD_DIR}"

View File

@ -319,7 +319,7 @@ else
fi
# Compatibility alias
FLATCAR_VERSION_STRING="${FLATCAR_VERSION}"
COREOS_VERSION_STRING="${COREOS_VERSION}"
# Calculate what today's build version should be, used by release
# scripts to provide a reasonable default value. The value is the number
@ -389,7 +389,6 @@ fi
BUILD_DIR=
# Standard filenames
FLATCAR_DEVELOPER_IMAGE_NAME="flatcar_developer_image.bin"
FLATCAR_DEVELOPER_CONTAINER_NAME="flatcar_developer_container.bin"
FLATCAR_PRODUCTION_IMAGE_NAME="flatcar_production_image.bin"

View File

@ -31,13 +31,11 @@ DEFINE_string board "${DEFAULT_BOARD}" \
DEFINE_string format "" \
"Output format, one of: ${VALID_IMG_TYPES[*]}"
DEFINE_string from "" \
"Directory containing flatcar_developer_image.bin or flatcar_production_image.bin."
"Directory containing flatcar_production_image.bin."
DEFINE_string disk_layout "" \
"The disk layout type to use for this image."
DEFINE_integer mem "${DEFAULT_MEM}" \
"Memory size for the vm config in MBs."
DEFINE_boolean dev_image "${FLAGS_FALSE}" \
"Use the development image instead of the default production image."
DEFINE_string to "" \
"Destination folder for VM output file(s)"
DEFINE_string oem_pkg "" \
@ -107,14 +105,7 @@ if [ -f "${FLAGS_from}/version.txt" ]; then
FLATCAR_VERSION_STRING="${FLATCAR_VERSION}"
fi
if [ ${FLAGS_dev_image} -eq ${FLAGS_TRUE} ]; then
set_vm_paths "${FLAGS_from}" "${FLAGS_to}" "${FLATCAR_DEVELOPER_IMAGE_NAME}"
if [[ "${FLAGS_disk_layout}" == "" ]]; then
FLAGS_disk_layout=devel
fi
else
set_vm_paths "${FLAGS_from}" "${FLAGS_to}" "${FLATCAR_PRODUCTION_IMAGE_NAME}"
fi
set_vm_paths "${FLAGS_from}" "${FLAGS_to}" "${FLATCAR_PRODUCTION_IMAGE_NAME}"
# Make sure things are cleaned up on failure
trap vm_cleanup EXIT

View File

@ -9,7 +9,6 @@ DEFAULT_MEM="1024"
DEFAULT_VMDK="ide.vmdk"
DEFAULT_VMX="flatcar.vmx"
DEFAULT_VBOX_DISK="os.vdi"
DEFAULT_QEMU_IMAGE="flatcar_developer_qemu_image.img"
# Minimum sizes for full size vm images -- needed for update.
MIN_VDISK_SIZE_FULL=9216

View File

@ -2,9 +2,8 @@
set -eux
declare -A APPID
APPID[amd64-usr]=e96281a6-d1af-4bde-9a0a-97b76e56dc57
APPID[arm64-usr]=103867da-e3a2-4c92-b0b3-7fbd7f7d8b71
APPID=e96281a6-d1af-4bde-9a0a-97b76e56dc57
BOARD=amd64-usr
declare -A RELEASE_CHANNEL
RELEASE_CHANNEL[alpha]=Alpha
@ -14,10 +13,9 @@ RELEASE_CHANNEL[stable]=Stable
download() {
local channel="$1"
local version="$2"
local board="$3"
local gs="gs://builds.release.core-os.net/${channel}/boards/${board}/${version}"
local dir="${BASEDIR}/${board}/${version}"
local gs="gs://builds.release.core-os.net/${channel}/boards/${BOARD}/${version}"
local dir="${BASEDIR}/${BOARD}/${version}"
mkdir -p "${dir}"
pushd "${dir}" >/dev/null
@ -51,9 +49,8 @@ download() {
upload() {
local channel="$1"
local version="$2"
local board="$3"
local dir="${BASEDIR}/${board}/${version}"
local dir="${BASEDIR}/${BOARD}/${version}"
local payload="${dir}/flatcar_production_update.gz"
local torcx_manifest="${dir}/torcx_manifest.json"
local torcx_manifest_sig="${dir}/torcx_manifest.json.asc"
@ -68,8 +65,8 @@ upload() {
"$(dirname $0)/../core_roller_upload" \
--user="${ROLLER_USERNAME}" \
--api_key="${ROLLER_API_KEY}" \
--app_id="${APPID[${board}]}" \
--board="${board}" \
--app_id="${APPID}" \
--board="${BOARD}" \
--version="${version}" \
--payload="${payload}"
@ -77,7 +74,7 @@ upload() {
gsutil cp \
"${torcx_manifest}" \
"${torcx_manifest_sig}" \
"gs://coreos-tectonic-torcx/manifests/${board}/${version}/"
"gs://coreos-tectonic-torcx/manifests/${BOARD}/${version}/"
# Update version in a canary channel if one is defined.
local -n canary_channel="ROLLER_CANARY_CHANNEL_${channel^^}"
@ -87,7 +84,7 @@ upload() {
--user="${ROLLER_USERNAME}" \
--key="${ROLLER_API_KEY}" \
channel update \
--app-id="${APPID[${board}]}" \
--app-id="${APPID}" \
--channel="${canary_channel}" \
--version="${version}"
fi
@ -96,17 +93,16 @@ upload() {
ready() {
local channel="$1"
local version="$2"
local board="$3"
# setting the percent will deactivate (not delete) any existing rollouts for
# this specific group.
echo "Rollout set to 0% for ${board}"
echo "Rollout set to 0%"
updateservicectl \
--server="https://public.update.core-os.net" \
--user="${ROLLER_USERNAME}" \
--key="${ROLLER_API_KEY}" \
group percent \
--app-id="${APPID[${board}]}" \
--app-id="${APPID}" \
--group-id="${channel}" \
--update-percent=0
@ -117,7 +113,7 @@ ready() {
--user="${ROLLER_USERNAME}" \
--key="${ROLLER_API_KEY}" \
channel update \
--app-id="${APPID[${board}]}" \
--app-id="${APPID}" \
--channel="${RELEASE_CHANNEL[${channel}]}" \
--publish=true \
--version="${version}"
@ -126,35 +122,21 @@ ready() {
roll() {
local channel="$1"
local hours="$2"
local board="$3"
local seconds=$((${hours} * 3600))
# Only ramp rollouts on AMD64; ARM64 is too small
if [[ "$board" = "arm64-usr" ]]; then
echo "Setting rollout for arm64-usr to 100%"
updateservicectl \
--server="https://public.update.core-os.net" \
--user="${ROLLER_USERNAME}" \
--key="${ROLLER_API_KEY}" \
group percent \
--app-id="${APPID[${board}]}" \
--group-id="${channel}" \
--update-percent=100
else
# creating a new rollout deletes any existing rollout for this group and
# automatically activates the new one.
echo "Creating linear rollout for ${board} that will get to 100% in ${hours}h"
updateservicectl \
--server="https://public.update.core-os.net" \
--user="${ROLLER_USERNAME}" \
--key="${ROLLER_API_KEY}" \
rollout create linear \
--app-id="${APPID[${board}]}" \
--group-id="${channel}" \
--duration="${seconds}" \
--frame-size="60"
fi
# creating a new rollout deletes any existing rollout for this group and
# automatically activates the new one.
echo "Creating linear rollout that will get to 100% in ${hours}h"
updateservicectl \
--server="https://public.update.core-os.net" \
--user="${ROLLER_USERNAME}" \
--key="${ROLLER_API_KEY}" \
rollout create linear \
--app-id="${APPID}" \
--group-id="${channel}" \
--duration="${seconds}" \
--frame-size="60"
}
usage() {
@ -209,15 +191,13 @@ while [[ $# > 0 ]]; do
case "${c}" in
-a)
$CMD "alpha" "${v}" "amd64-usr"
$CMD "alpha" "${v}" "arm64-usr"
$CMD "alpha" "${v}"
;;
-b)
$CMD "beta" "${v}" "amd64-usr"
$CMD "beta" "${v}" "arm64-usr"
$CMD "beta" "${v}"
;;
-s)
$CMD "stable" "${v}" "amd64-usr"
$CMD "stable" "${v}"
;;
*)
usage

View File

@ -1,17 +0,0 @@
#!/bin/bash
# Copyright (c) 2010 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.
# Start the Dev Server after making sure we are running under a chroot.
SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || exit 1
# Script must be run inside the chroot if not in 'always serve' mode.
if [[ "$1" != "--archive_dir" ]]; then
assert_inside_chroot
fi
# This is the location of the script now.
exec $(dirname ${0})/../../chroot/usr/bin/start_devserver "$@"