generated from octoposprime/temp
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from octoposprime/renew-as-44-script-refresh-fix
Refreshing repository cloning script
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
# GitHub repository URL | ||
repo_url="https://github.com/octoposprime/op-infra.git" | ||
|
||
# Branch name that currently using | ||
branch="phase1" | ||
|
||
# Directory to clone the repository into | ||
clone_dir="$HOME/k8s/project/op-infra" | ||
|
||
# Repository cloning or updating process | ||
if [ ! -d "$clone_dir" ]; then | ||
echo "Repository not found locally. Cloning into $clone_dir..." | ||
git clone --branch "$branch" "$repo_url" "$clone_dir" --recursive | ||
cd "$clone_dir" || exit | ||
else | ||
echo "Repository already exists. Fetching updates..." | ||
cd "$clone_dir" || exit | ||
git fetch origin | ||
git checkout "$branch" | ||
git pull origin "$branch" | ||
fi | ||
|
||
# Submodules update | ||
git submodule update --init --recursive | ||
|
||
# Show changes | ||
echo "Changes in repository:" | ||
git log --oneline --decorate --graph -n 5 | ||
|
||
# Script completed message | ||
echo "Repository is up to date in $clone_dir." | ||
|