add(master_release): Add script for updating master's version.txt

This is intended to be called after branch_release and all official
builds from that new branch are complete. Then updating master's
version.txt will switch things to start using that new release as the
source for binary packages.

Complete documentation for this whole process coming soon. :)
This commit is contained in:
Michael Marineau 2013-07-03 11:40:36 -04:00
parent ff7b7b064d
commit 1099dbe319

37
master_release Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
# Copyright (c) 2013 The CoreOS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || exit 1
COREOS_EPOCH=1372636800 # Mon Jul 1 00:00:00 UTC 2013
TODAYS_VERSION=$(( (`date +%s` - ${COREOS_EPOCH}) / 86400 ))
TODAYS_VERSION=$(printf "%04d" "${TODAYS_VERSION}")
DEFINE_string master "master" "Manifest master branch to update."
DEFINE_string branch "build-${TODAYS_VERSION}" \
"Manifest branch, tag, or other ref to get version from."
DEFINE_boolean push ${FLAGS_FALSE} "Push to public manifest repository."
DEFINE_string remote "origin" "Remote name or URL to push to."
# Parse flags
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
switch_to_strict_mode
info "Running repo init -b ${FLAGS_master}"
repo init -b "${FLAGS_master}"
info "Updating version.txt from ${FLAGS_branch}"
cd "${GCLIENT_ROOT}/.repo/manifests"
git checkout "${FLAGS_branch}" version.txt
git add version.txt
git commit -m "bump(version): Update version from ${FLAGS_branch}"
if [[ ${FLAGS_push} -eq ${FLAGS_TRUE} ]]; then
info "Pushing to ${FLAGS_remote} ${FLAGS_master}"
git push "${FLAGS_remote}" "HEAD:refs/heads/${FLAGS_master}"
fi