Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement rover walkthrough functionality #161

Merged
merged 10 commits into from
Jun 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
**/*.log
version.txt
public/
.data
walkthrough/
.data
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ COPY ./scripts/tfstate_azurerm.sh .
COPY ./scripts/functions.sh .
COPY ./scripts/banner.sh .
COPY ./scripts/clone.sh .
COPY ./scripts/walkthrough.sh .
COPY ./scripts/sshd.sh .
COPY ./scripts/backend.hcl.tf .
COPY ./scripts/ci.sh .
Expand Down
115 changes: 68 additions & 47 deletions scripts/clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ export landingzone_branch=${landingzone_branch:="master"}

current_path=$(pwd)


function display_clone_instructions {

while (( "$#" )); do
while (("$#")); do
case "${1}" in
--intro)
echo
Expand Down Expand Up @@ -57,6 +56,14 @@ function display_clone_instructions {
echo
shift 1
;;
--clone-project-name)
echo "--clone-project-name specify the GitHub repo to download from, default is Azure/caf-terraform-landingzones"
echo
echo " Example: --clone-project-name Azure/caf-terraform-landingzones-starter --clone-branch starter will download the starter branch of the Azure/caf-terraform-landingzones-starter repo"
echo " Note: the default --cone-branch is master and this is not available in the example repo above so the starter branch is specified."
echo
shift 1
;;
--examples)
echo "By default the rover will clone the azure/caf-terraform-landingzones into the local rover folder /tf/caf/landinzones"
echo
Expand All @@ -75,6 +82,13 @@ function display_clone_instructions {
done
}

function set_clone_exports {
export clone_destination=$1
export clone_folder=$2
export clone_folder_strip=$3
export clone_project_name=$4
export landingzone_branch=$5
}

function clone_repository {
echo "@calling clone_repository"
Expand Down Expand Up @@ -103,51 +117,58 @@ function clone_repository {
function process_clone_parameter {
echo "@calling process_clone_parameter with $@"


case "${1}" in
--clone)
if [ $# -eq 1 ]; then
display_clone_instructions ${1}
exit 21
else
export caf_command="clone"
export landingzone_branch=${landingzone_branch:="master"}
export clone_project_name=${2}
export clone_folder_strip=1
fi
;;
--clone-branch)
echo $#
if [ $# -eq 1 ]; then
display_clone_instructions ${1}
exit 22
else
export landingzone_branch=${2}
fi
;;
--clone-destination)
if [ $# -eq 1 ]; then
display_clone_instructions ${1}
exit 23
else
export clone_destination=${2}
fi
;;
--clone-folder)
if [ $# -eq 1 ]; then
display_clone_instructions ${1}
exit 24
else
export clone_folder=${2}
fi
;;
--clone-folder-strip)
if [ $# -eq 1 ]; then
display_clone_instructions ${1}
exit 24
else
export clone_folder_strip=${2}
fi
;;
--clone)
if [ $# -eq 1 ]; then
display_clone_instructions ${1}
exit 21
else
export caf_command="clone"
export landingzone_branch=${landingzone_branch:="master"}
export clone_project_name=${2}
export clone_folder_strip=1
fi
;;
--clone-branch)
echo $#
if [ $# -eq 1 ]; then
display_clone_instructions ${1}
exit 22
else
export landingzone_branch=${2}
fi
;;
--clone-destination)
if [ $# -eq 1 ]; then
display_clone_instructions ${1}
exit 23
else
export clone_destination=${2}
fi
;;
--clone-folder)
if [ $# -eq 1 ]; then
display_clone_instructions ${1}
exit 24
else
export clone_folder=${2}
fi
;;
--clone-folder-strip)
if [ $# -eq 1 ]; then
display_clone_instructions ${1}
exit 24
else
export clone_folder_strip=${2}
fi
;;
--clone-project-name)
if [ $# -eq 1 ]; then
display_clone_instructions ${1}
exit 24
else
export clone_project_name=${2}
fi
;;
esac
}
Loading