Consolidate kokoro scripts
- Move artifact regexs
- Point continuous/headless/release at build.sh
- rename continuous.sh to build.sh, and check KOKORO_JOB_NAME to change
settings
Change-Id: I765c7db0130b3f11d2d5cdbe7cb9dfe95f7c574d
diff --git a/kokoro/continuous.sh b/kokoro/build.sh
similarity index 80%
rename from kokoro/continuous.sh
rename to kokoro/build.sh
index 2fadd09..434fa7d 100644
--- a/kokoro/continuous.sh
+++ b/kokoro/build.sh
@@ -3,6 +3,16 @@
set -e
set -x
+if [[ ${KOKORO_JOB_NAME} =~ release$ ]]; then
+ readonly BUILD_TYPE=release
+elif [[ ${KOKORO_JOB_NAME} =~ continuous$ ]]; then
+ readonly BUILD_TYPE=continuous
+elif [[ ${KOKORO_JOB_NAME} =~ headless$ ]]; then
+ readonly BUILD_TYPE=headless
+else
+ echo "Invalid job name: ${KOKORO_JOB_NAME}" && exit 1
+fi
+
# Symlink the Makefile, like it would be if repo checked this out.
# Otherwise, sourcing setup.sh doesn't work as expected.
ln -sfr git/continuous-build/build/Makefile git/continuous-build/Makefile
@@ -26,8 +36,15 @@
sudo apt-get install -y haveged
sudo /etc/init.d/haveged start
+case "${BUILD_TYPE}" in
+ headless)
+ export HEADLESS_BUILD=true
+ ;;
+esac
+
m docker-all
m docker-sdcard
+m docker-recovery
pushd ${ROOTDIR}
python3 ${ROOTDIR}/build/create_release_manifest.py \
diff --git a/kokoro/common.cfg b/kokoro/common.cfg
new file mode 100644
index 0000000..77c58e0
--- /dev/null
+++ b/kokoro/common.cfg
@@ -0,0 +1,19 @@
+gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/docker/aiy-board-builder.tar"
+gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/pbuilder/base.tgz"
+gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/rootfs/latest/rootfs.raw.img"
+gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/rootfs/latest/rootfs.raw.img.sha256sum"
+
+action {
+ define_artifacts {
+ regex: "boot.img"
+ regex: "flash.sh"
+ regex: "manifest.xml"
+ regex: "partition-table-*.img"
+ regex: "recovery.img"
+ regex: "rootfs.img"
+ regex: "rootfs.raw.img"
+ regex: "rootfs.raw.img.sha256sum"
+ regex: "sdcard.img"
+ regex: "u-boot.imx"
+ }
+}
diff --git a/kokoro/continuous.cfg b/kokoro/continuous.cfg
index 8533a30..9824960 100644
--- a/kokoro/continuous.cfg
+++ b/kokoro/continuous.cfg
@@ -1,16 +1 @@
-build_file: "continuous-build/build/kokoro/continuous.sh"
-gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/rootfs/latest/rootfs.raw.img"
-gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/rootfs/latest/rootfs.raw.img.sha256sum"
-gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/docker/aiy-board-builder.tar"
-gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/pbuilder/base.tgz"
-action {
- define_artifacts {
- regex: "boot.img"
- regex: "flash.sh"
- regex: "manifest.xml"
- regex: "sdcard.img"
- regex: "partition-table-*.img"
- regex: "rootfs.img"
- regex: "u-boot.imx"
- }
-}
+build_file: "continuous-build/build/kokoro/build.sh"
diff --git a/kokoro/headless.cfg b/kokoro/headless.cfg
index 478ab3e..9824960 100644
--- a/kokoro/headless.cfg
+++ b/kokoro/headless.cfg
@@ -1,16 +1 @@
-build_file: "continuous-build/build/kokoro/headless.sh"
-gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/rootfs/latest/rootfs.raw.img"
-gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/rootfs/latest/rootfs.raw.img.sha256sum"
-gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/docker/aiy-board-builder.tar"
-gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/pbuilder/base.tgz"
-action {
- define_artifacts {
- regex: "boot.img"
- regex: "flash.sh"
- regex: "manifest.xml"
- regex: "sdcard.img"
- regex: "partition-table-*.img"
- regex: "rootfs.img"
- regex: "u-boot.imx"
- }
-}
+build_file: "continuous-build/build/kokoro/build.sh"
diff --git a/kokoro/headless.sh b/kokoro/headless.sh
deleted file mode 100644
index 9897b70..0000000
--- a/kokoro/headless.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/bash
-
-set -e
-set -x
-
-# Symlink the Makefile, like it would be if repo checked this out.
-# Otherwise, sourcing setup.sh doesn't work as expected.
-ln -sfr git/continuous-build/build/Makefile git/continuous-build/Makefile
-
-# Sourcing this only works in the directory above build...
-pushd git/continuous-build
-source build/setup.sh
-popd
-
-export IS_GLINUX=true
-export TARBALL_FETCH_ROOT_DIRECTORY=${KOKORO_GFILE_DIR}
-export PREBUILT_MODULES_ROOT=${KOKORO_GFILE_DIR}
-export PREBUILT_DOCKER_ROOT=${KOKORO_GFILE_DIR}
-export FETCH_PBUILDER_DIRECTORY=${KOKORO_GFILE_DIR}
-export PACKAGES_FETCH_ROOT_DIRECTORY=${KOKORO_GFILE_DIR}
-export PACKAGES_REVISION=.
-export ROOTFS_REVISION=.
-export FETCH_PACKAGES=false
-export HEADLESS_BUILD=true
-
-m docker-all
-m docker-sdcard
-
-pushd ${ROOTDIR}
-python3 ${ROOTDIR}/build/create_release_manifest.py \
- -i ${ROOTDIR}/manifest/default.xml \
- -o ${KOKORO_ARTIFACTS_DIR}/manifest.xml
-popd
-
-cp ${ROOTDIR}/board/flash.sh ${KOKORO_ARTIFACTS_DIR}
-chmod -x ${KOKORO_ARTIFACTS_DIR}/flash.sh
-cp ${PRODUCT_OUT}/u-boot.imx ${KOKORO_ARTIFACTS_DIR}
-cp ${PRODUCT_OUT}/boot.img ${KOKORO_ARTIFACTS_DIR}
-cp ${PRODUCT_OUT}/partition-table-*.img ${KOKORO_ARTIFACTS_DIR}
-cp ${PRODUCT_OUT}/rootfs.img ${KOKORO_ARTIFACTS_DIR}
-cp ${PRODUCT_OUT}/sdcard.img ${KOKORO_ARTIFACTS_DIR}
diff --git a/kokoro/release.cfg b/kokoro/release.cfg
index c5d1c7f..9824960 100644
--- a/kokoro/release.cfg
+++ b/kokoro/release.cfg
@@ -1,19 +1 @@
-build_file: "continuous-build/build/kokoro/release.sh"
-gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/rootfs/latest/rootfs.raw.img"
-gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/rootfs/latest/rootfs.raw.img.sha256sum"
-gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/docker/aiy-board-builder.tar"
-gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/pbuilder/base.tgz"
-
-action {
- define_artifacts {
- regex: "boot.img"
- regex: "flash.sh"
- regex: "manifest.xml"
- regex: "sdcard.img"
- regex: "partition-table-*.img"
- regex: "rootfs.img"
- regex: "u-boot.imx"
-
- regex: "debian_repo/**"
- }
-}
+build_file: "continuous-build/build/kokoro/build.sh"
diff --git a/kokoro/release.sh b/kokoro/release.sh
deleted file mode 100644
index a317592..0000000
--- a/kokoro/release.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-set -e
-set -x
-
-# Run continuous.sh first
-SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-bash ${SCRIPT_DIR}/continuous.sh
diff --git a/kokoro/rootfs.cfg b/kokoro/rootfs.cfg
index 669be2b..216f446 100644
--- a/kokoro/rootfs.cfg
+++ b/kokoro/rootfs.cfg
@@ -1,10 +1 @@
build_file: "continuous-build/build/kokoro/rootfs.sh"
-
-gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/docker/aiy-board-builder.tar"
-
-action {
- define_artifacts {
- regex: "rootfs.raw.img"
- regex: "rootfs.raw.img.sha256sum"
- }
-}