This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Factor out more common code from the jenkins scripts #980
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,44 @@ | ||
#! /bin/bash | ||
|
||
# This clones a project from github into a named subdirectory | ||
# If the project has a branch with the same name as this branch | ||
# then it will checkout that branch after cloning. | ||
# Otherwise it will checkout "origin/develop." | ||
# The first argument is the name of the directory to checkout | ||
# the branch into. | ||
# The second argument is the URL of the remote repository to checkout. | ||
# Usually something like https://github.com/matrix-org/sytest.git | ||
|
||
set -eux | ||
|
||
NAME=$1 | ||
PROJECT=$2 | ||
BASE=".$NAME-base" | ||
|
||
# update our clone | ||
if [ ! -d .$NAME-base ]; then | ||
git clone $PROJECT $BASE --mirror | ||
# Update our mirror. | ||
if [ ! -d ".$NAME-base" ]; then | ||
# Create a local mirror of the source repository. | ||
# This saves us from having to download the entire repository | ||
# when this script is next run. | ||
git clone "$PROJECT" "$BASE" --mirror | ||
else | ||
(cd $BASE; git fetch -p) | ||
# Fetch any updates from the source repository. | ||
(cd "$BASE"; git fetch -p) | ||
fi | ||
|
||
rm -rf $NAME | ||
git clone $BASE $NAME --shared | ||
# Remove the existing repository so that we have a clean copy | ||
rm -rf "$NAME" | ||
# Cloning with --shared means that we will share portions of the | ||
# .git directory with our local mirror. | ||
git clone "$BASE" "$NAME" --shared | ||
|
||
# Jenkins may have supplied us with the name of the branch in the | ||
# environment. Otherwise we will have to guess based on the current | ||
# commit. | ||
: ${GIT_BRANCH:="origin/$(git rev-parse --abbrev-ref HEAD)"} | ||
cd $NAME | ||
cd "$NAME" | ||
# check out the relevant branch | ||
git checkout "${GIT_BRANCH}" || ( | ||
echo >&2 "No ref ${GIT_BRANCH} found, falling back to develop" | ||
git checkout "origin/develop" | ||
) | ||
git clean -df . |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can remove all this stuff because it is vestigial code left over from when this script ran the unit tests as well as running the sytests.