summaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build.sh33
-rwxr-xr-xscripts/go.sh9
2 files changed, 31 insertions, 11 deletions
diff --git a/scripts/build.sh b/scripts/build.sh
index d5dd14acc..d73eaee77 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -16,6 +16,9 @@
source $(dirname $0)/common.sh
+# Install required packages for make_repository.sh et al.
+sudo apt-get update && sudo apt-get install -y dpkg-sig coreutils apt-utils
+
# Build runsc.
runsc=$(build -c opt //runsc)
@@ -24,17 +27,19 @@ pkg=$(build -c opt --host_force_python=py2 //runsc:runsc-debian)
# Build a repository, if the key is available.
if [[ -v KOKORO_REPO_KEY ]]; then
- repo=$(tools/make_repository.sh "${KOKORO_REPO_KEY}" gvisor-bot@google.com ${pkg})
+ repo=$(tools/make_repository.sh "${KOKORO_KEYSTORE_DIR}/${KOKORO_REPO_KEY}" gvisor-bot@google.com ${pkg})
fi
# Install installs artifacts.
install() {
- local dir="$1"
- mkdir -p "${dir}"
- cp -f "${runsc}" "${dir}"/runsc
- sha512sum "${dir}"/runsc | awk '{print $1 " runsc"}' > "${dir}"/runsc.sha512
+ local -r binaries_dir="$1"
+ local -r repo_dir="$2"
+ mkdir -p "${binaries_dir}"
+ cp -f "${runsc}" "${binaries_dir}"/runsc
+ sha512sum "${binaries_dir}"/runsc | awk '{print $1 " runsc"}' > "${binaries_dir}"/runsc.sha512
if [[ -v repo ]]; then
- rm -rf "${dir}"/repo && cp -a "${repo}" "$dir"/repo
+ rm -rf "${repo_dir}" && mkdir -p "$(dirname "${repo_dir}")"
+ cp -a "${repo}" "${repo_dir}"
fi
}
@@ -44,8 +49,11 @@ install() {
if [[ -v KOKORO_ARTIFACTS_DIR ]]; then
if [[ "${KOKORO_BUILD_NIGHTLY}" == "true" ]]; then
# The "latest" directory and current date.
- install "${KOKORO_ARTIFACTS_DIR}/nightly/latest"
- install "${KOKORO_ARTIFACTS_DIR}/nightly/$(date -Idate)"
+ stamp="$(date -Idate)"
+ install "${KOKORO_ARTIFACTS_DIR}/nightly/latest" \
+ "${KOKORO_ARTIFACTS_DIR}/dists/nightly/main"
+ install "${KOKORO_ARTIFACTS_DIR}/nightly/${stamp}" \
+ "${KOKORO_ARTIFACTS_DIR}/dists/nightly/${stamp}"
else
# Is it a tagged release? Build that instead. In that case, we also try to
# update the base release directory, in case this is an update. Finally, we
@@ -57,11 +65,14 @@ if [[ -v KOKORO_ARTIFACTS_DIR ]]; then
for tag in ${tags}; do
name=$(echo "${tag}" | cut -d'-' -f2)
base=$(echo "${name}" | cut -d'.' -f1)
- install "${KOKORO_ARTIFACTS_DIR}/release/${name}"
+ install "${KOKORO_ARTIFACTS_DIR}/release/${name}" \
+ "${KOKORO_ARTIFACTS_DIR}/dists/${name}/main"
if [[ "${base}" != "${tag}" ]]; then
- install "${KOKORO_ARTIFACTS_DIR}/release/${base}"
+ install "${KOKORO_ARTIFACTS_DIR}/release/${base}" \
+ "${KOKORO_ARTIFACTS_DIR}/dists/${base}/main"
fi
- install "${KOKORO_ARTIFACTS_DIR}/release/latest"
+ install "${KOKORO_ARTIFACTS_DIR}/release/latest" \
+ "${KOKORO_ARTIFACTS_DIR}/dists/latest/main"
done
fi
fi
diff --git a/scripts/go.sh b/scripts/go.sh
index e49d76c6d..f24fad04c 100755
--- a/scripts/go.sh
+++ b/scripts/go.sh
@@ -30,5 +30,14 @@ go build ./...
# Push, if required.
if [[ "${KOKORO_GO_PUSH}" == "true" ]]; then
+ if [[ -v KOKORO_GITHUB_ACCESS_TOKEN ]]; then
+ git config --global credential.helper cache
+ git credential approve <<EOF
+protocol=https
+host=github.com
+username=$(cat "${KOKORO_KEYSTORE_DIR}/${KOKORO_GITHUB_ACCESS_TOKEN}")
+password=x-oauth-basic
+EOF
+ fi
git push origin go:go
fi