mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-17 18:06:59 +02:00
.github: split git repo init part into prepare_git_repo
We need to split the beginning of setting up the top-level git repo into a new function prepare_git_repo, and call it in the beginning of each script. That is to prevent some corner cases, where applying multiple patches does not work because the latter overwrites the former patch. So we should not set up the git repo again in each apply_patch, but only in the beggining, prepare_git_repo.
This commit is contained in:
parent
b1e2d22d03
commit
1cdf93de4d
@ -31,6 +31,14 @@ function get_ebuild_filename() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function prepare_git_repo() {
|
||||||
|
git config user.name "${BUILDBOT_USERNAME}"
|
||||||
|
git config user.email "${BUILDBOT_USEREMAIL}"
|
||||||
|
git reset --hard HEAD
|
||||||
|
git fetch origin
|
||||||
|
git checkout -B "${BASE_BRANCH}" "origin/${BASE_BRANCH}"
|
||||||
|
}
|
||||||
|
|
||||||
# caller needs to set pass a parameter as a branch name to be created.
|
# caller needs to set pass a parameter as a branch name to be created.
|
||||||
function checkout_branches() {
|
function checkout_branches() {
|
||||||
TARGET_BRANCH=$1
|
TARGET_BRANCH=$1
|
||||||
@ -81,11 +89,6 @@ function generate_patches() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function apply_patches() {
|
function apply_patches() {
|
||||||
git config user.name "${BUILDBOT_USERNAME}"
|
|
||||||
git config user.email "${BUILDBOT_USEREMAIL}"
|
|
||||||
git reset --hard HEAD
|
|
||||||
git fetch origin
|
|
||||||
git checkout -B "${BASE_BRANCH}" "origin/${BASE_BRANCH}"
|
|
||||||
git am "${SDK_OUTER_SRCDIR}"/third_party/coreos-overlay/0*.patch
|
git am "${SDK_OUTER_SRCDIR}"/third_party/coreos-overlay/0*.patch
|
||||||
rm -f "${SDK_OUTER_SRCDIR}"/third_party/coreos-overlay/0*.patch
|
rm -f "${SDK_OUTER_SRCDIR}"/third_party/coreos-overlay/0*.patch
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ UPDATE_NEEDED=1
|
|||||||
|
|
||||||
. .github/workflows/common.sh
|
. .github/workflows/common.sh
|
||||||
|
|
||||||
|
prepare_git_repo
|
||||||
|
|
||||||
if ! checkout_branches "containerd-${VERSION_NEW}-${TARGET}"; then
|
if ! checkout_branches "containerd-${VERSION_NEW}-${TARGET}"; then
|
||||||
UPDATE_NEEDED=0
|
UPDATE_NEEDED=0
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -6,6 +6,8 @@ UPDATE_NEEDED=1
|
|||||||
|
|
||||||
. .github/workflows/common.sh
|
. .github/workflows/common.sh
|
||||||
|
|
||||||
|
prepare_git_repo
|
||||||
|
|
||||||
if ! checkout_branches "docker-${VERSION_NEW}-${TARGET}"; then
|
if ! checkout_branches "docker-${VERSION_NEW}-${TARGET}"; then
|
||||||
UPDATE_NEEDED=0
|
UPDATE_NEEDED=0
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -6,6 +6,8 @@ UPDATE_NEEDED=1
|
|||||||
|
|
||||||
. .github/workflows/common.sh
|
. .github/workflows/common.sh
|
||||||
|
|
||||||
|
prepare_git_repo
|
||||||
|
|
||||||
if ! checkout_branches "${VERSION_NEW}-${TARGET}"; then
|
if ! checkout_branches "${VERSION_NEW}-${TARGET}"; then
|
||||||
UPDATE_NEEDED=0
|
UPDATE_NEEDED=0
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -8,6 +8,8 @@ UPDATE_NEEDED=1
|
|||||||
|
|
||||||
. .github/workflows/common.sh
|
. .github/workflows/common.sh
|
||||||
|
|
||||||
|
prepare_git_repo
|
||||||
|
|
||||||
if ! checkout_branches "go-${VERSION_NEW}-${TARGET}"; then
|
if ! checkout_branches "go-${VERSION_NEW}-${TARGET}"; then
|
||||||
UPDATE_NEEDED=0
|
UPDATE_NEEDED=0
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -8,6 +8,8 @@ UPDATE_NEEDED=1
|
|||||||
|
|
||||||
. .github/workflows/common.sh
|
. .github/workflows/common.sh
|
||||||
|
|
||||||
|
prepare_git_repo
|
||||||
|
|
||||||
if ! checkout_branches "linux-${VERSION_NEW}-${TARGET}"; then
|
if ! checkout_branches "linux-${VERSION_NEW}-${TARGET}"; then
|
||||||
UPDATE_NEEDED=0
|
UPDATE_NEEDED=0
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -6,6 +6,8 @@ UPDATE_NEEDED=1
|
|||||||
|
|
||||||
. .github/workflows/common.sh
|
. .github/workflows/common.sh
|
||||||
|
|
||||||
|
prepare_git_repo
|
||||||
|
|
||||||
if ! checkout_branches "runc-${VERSION_NEW}-${TARGET}"; then
|
if ! checkout_branches "runc-${VERSION_NEW}-${TARGET}"; then
|
||||||
UPDATE_NEEDED=0
|
UPDATE_NEEDED=0
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -6,6 +6,8 @@ UPDATE_NEEDED=1
|
|||||||
|
|
||||||
. .github/workflows/common.sh
|
. .github/workflows/common.sh
|
||||||
|
|
||||||
|
prepare_git_repo
|
||||||
|
|
||||||
if ! checkout_branches "rust-${VERSION_NEW}-${TARGET}"; then
|
if ! checkout_branches "rust-${VERSION_NEW}-${TARGET}"; then
|
||||||
UPDATE_NEEDED=0
|
UPDATE_NEEDED=0
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user