mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-12 23:46:59 +02:00
A number of places refer to these paths and that number is going to grow. Since the standard pattern is to use environment variables for commonly used paths it is time to add ones for these: REPO_CACHE_DIR REPO_MANIFESTS_DIR
68 lines
2.2 KiB
Bash
Executable File
68 lines
2.2 KiB
Bash
Executable File
#!/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
|
|
|
|
# Default to the current release for the new SDK version (minus dev build id)
|
|
DEFAULT_SDK="${COREOS_VERSION_STRING%+*}"
|
|
|
|
DEFINE_integer build "${TODAYS_VERSION}" \
|
|
"Branch name (aka 'build'), should be days since 2013-7-1"
|
|
DEFINE_integer branch 0 "Branch revision, should be 0"
|
|
DEFINE_string patch 0 "Branch patch id, should be 0"
|
|
DEFINE_string track "dev-channel" "Set the given track to this new branch"
|
|
DEFINE_string sdk_version "${DEFAULT_SDK}" "Set the SDK build to use"
|
|
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
|
|
|
|
BRANCH_NAME="build-${FLAGS_build}"
|
|
TAG_NAME="v${FLAGS_build}.${FLAGS_branch}.${FLAGS_patch}"
|
|
|
|
cd "${REPO_MANIFESTS_DIR}"
|
|
|
|
# Clean up existing branch manifest(s) excluding:
|
|
# - the current branch if the file already exists.
|
|
# - one previous branch, useful for comparing releases.
|
|
OLD_BRANCHES=$(find -maxdepth 1 -name 'build-*.xml' \
|
|
-not -name "${BRANCH_NAME}.xml" | sort -rn | tail -n -1)
|
|
git rm -f ${OLD_BRANCHES}
|
|
|
|
repo manifest -o "${BRANCH_NAME}.xml" -r
|
|
tee version.txt <<EOF
|
|
COREOS_BUILD=${FLAGS_build}
|
|
COREOS_BRANCH=${FLAGS_branch}
|
|
COREOS_PATCH=${FLAGS_patch}
|
|
COREOS_SDK_VERSION=${FLAGS_sdk_version}
|
|
EOF
|
|
ln -sf "${BRANCH_NAME}.xml" release.xml
|
|
git add "${BRANCH_NAME}.xml" release.xml version.txt
|
|
info "Creating ${BRANCH_NAME} and tag ${TAG_NAME}"
|
|
git commit -m "add(${BRANCH_NAME}): Add manifest for ${TAG_NAME}"
|
|
git branch -f "${BRANCH_NAME}"
|
|
git tag -m "CoreOS ${TAG_NAME}" "${TAG_NAME}"
|
|
|
|
|
|
PUSH_TRACK=
|
|
if [[ -n "${FLAGS_track}" ]]; then
|
|
git branch -f "${FLAGS_track}"
|
|
info "Updating track ${FLAGS_track}"
|
|
PUSH_TRACK=1
|
|
fi
|
|
|
|
if [[ ${FLAGS_push} -eq ${FLAGS_TRUE} ]]; then
|
|
git push "${FLAGS_remote}" \
|
|
"HEAD:refs/heads/master" \
|
|
"refs/heads/${BRANCH_NAME}" \
|
|
${PUSH_TRACK:+"+refs/heads/${FLAGS_track}"} \
|
|
"refs/tags/${TAG_NAME}"
|
|
fi
|