From c653d99ac837c7bb0bcca998394b8c2022bde191 Mon Sep 17 00:00:00 2001 From: Marcia Ramos Date: Fri, 28 May 2021 11:26:47 +0100 Subject: [PATCH 1/3] Fixes Charts cloning issue --- install/clone.sh | 104 ++++++++++++++++++++++++++++++----------------- 1 file changed, 66 insertions(+), 38 deletions(-) diff --git a/install/clone.sh b/install/clone.sh index 8fc53ca..4dea7be 100644 --- a/install/clone.sh +++ b/install/clone.sh @@ -13,35 +13,43 @@ test_install_clone() { # Repos associative array ('path' 'name') # Use $k to retrieve the path and $repos_array[$k] to retrieve the name -typeset -A repos_array -repos_array=('gitlab-docs' 'GitLab Docs' 'gitlab' 'GitLab' 'gitlab-runner' 'GitLab Runner' 'omnibus-gitlab' 'Omnibus GitLab' 'charts/gitlab' 'GitLab Charts') # Clone through SSH - GitLab team member clone_repos_ssh() { + # Define array of repos (except Charts) + typeset -A repos_array + repos_array=('gitlab-docs' 'GitLab Docs' 'gitlab' 'GitLab' 'gitlab-runner' 'GitLab Runner' 'omnibus-gitlab' 'Omnibus GitLab') + # Clone all repos except Charts tput setaf 3 - read "REPLY?All repos will be cloned into "`tput bold`"$GL"`tput sgr0 ; tput setaf 3`". This will take some time. Continue (y/n)?"`ok_sound` + read "REPLY?All repos will be cloned through SSH into "`tput bold`"$GL"`tput sgr0 ; tput setaf 3`". This will take some time. Continue (y/n)?"`ok_sound` tput sgr0 if [[ $REPLY =~ ^[Yy]$ ]] ; then for k in "${(@k)repos_array}" ; do echo `tput setaf 5`"Cloning $repos_array[$k]..."`tput sgr0` cd $GL - if [[ $k == 'charts/gitlab' ]]; then - echo `tput bold` "$ git clone git@gitlab.com:gitlab-org/$k.git charts" `tput sgr0` ; git clone git@gitlab.com:gitlab-org/$k.git charts - else - echo `tput bold` "$ git clone git@gitlab.com:gitlab-org/$k.git" `tput sgr0` ; git clone git@gitlab.com:gitlab-org/$k.git - fi - echo `tput bold` "$ git config pull.rebase false" `tput sgr0` ; git config pull.rebase false + echo `tput bold` "$ git clone git@gitlab.com:gitlab-org/$k.git" `tput sgr0` + git clone git@gitlab.com:gitlab-org/$k.git + echo `tput bold` "$ git config pull.rebase false" `tput sgr0` + git config pull.rebase false if (( $? )) ; then echo `tput setaf 1` "Failed to clone $repos_array[$k]." `tput sgr0` else tput setaf 2; echo "Cloned $repos_array[$k] into $PWD"; tput sgr0 fi - cd $DSHELL done - # Set default paths and symlinks - default_paths - user_variables - echo "PORT='3000'" >> functions/assets/user-variables.sh + # Clone Charts + echo `tput setaf 5`"Cloning GitLab Charts..."`tput sgr0` + cd $GL + echo `tput bold` "$ git clone git@gitlab.com:gitlab-org/charts/gitlab.git charts" `tput sgr0` + git clone git@gitlab.com:gitlab-org/charts/gitlab.git charts + tput setaf 2; echo "Charts cloned into $PWD"; tput sgr0 + echo `tput bold` "$ git config pull.rebase false" `tput sgr0` + git config pull.rebase false + cd $DSHELL + # Set default paths and symlinks + default_paths + user_variables + echo "PORT='3000'" >> functions/assets/user-variables.sh else echo "Ok. Aborting." fi @@ -49,32 +57,42 @@ clone_repos_ssh() { # Clone through SSH - non-GitLab team member clone_repos_ssh_non-gl() { + # Define array of repos (except Charts) + typeset -A repos_array + repos_array=('gitlab-docs' 'GitLab Docs' 'gitlab' 'GitLab' 'gitlab-runner' 'GitLab Runner' 'omnibus-gitlab' 'Omnibus GitLab') tput setaf 3 - read "REPLY?All repos will be cloned into "`tput bold`"$GL"`tput sgr0 ; tput setaf 3`". This will take some time. Continue (y/n)?"`ok_sound` + read "REPLY?All repos will be cloned through SSH into "`tput bold`"$GL"`tput sgr0 ; tput setaf 3`". This will take some time. Continue (y/n)?"`ok_sound` tput sgr0 if [[ $REPLY =~ ^[Yy]$ ]] ; then + # Clone all repos except Charts echo "Enter the namespace your projects were forked into:"`ok_sound` read NAMESPACE for k in "${(@k)repos_array}" ; do echo `tput setaf 5`"Cloning $repos_array[$k]..."`tput sgr0` cd $GL - if [[ $k == 'charts/gitlab' ]]; then - echo `tput bold` "$ git clone git@gitlab.com:$NAMESPACE/$k.git charts" `tput sgr0` ; git clone git@gitlab.com:$NAMESPACE/$k.git charts - else - echo `tput bold` "$ git clone git@gitlab.com:$NAMESPACE/$k.git" `tput sgr0` ; git clone git@gitlab.com:$NAMESPACE/$k.git - fi - echo `tput bold` "$ git config pull.rebase false" `tput sgr0` ; git config pull.rebase false + echo `tput bold` "$ git clone git@gitlab.com:$NAMESPACE/$k.git" `tput sgr0` + git clone git@gitlab.com:$NAMESPACE/$k.git + echo `tput bold` "$ git config pull.rebase false" `tput sgr0` + git config pull.rebase false if (( $? )) ; then echo `tput setaf 1` "Failed to clone $repos_array[$k]." `tput sgr0` else tput setaf 2; echo "Cloned $repos_array[$k] into $PWD"; tput sgr0 fi - cd $DSHELL done - # Set default paths and symlinks - default_paths - user_variables - echo "PORT='3000'" >> functions/assets/user-variables.sh + # Clone Charts + echo `tput setaf 5`"Cloning GitLab Charts..."`tput sgr0` + cd $GL + echo `tput bold` "$ git clone git@gitlab.com:$NAMESPACE/charts/gitlab.git charts" `tput sgr0` + git clone git@gitlab.com:$NAMESPACE/charts/gitlab.git charts + tput setaf 2; echo "Charts cloned into $PWD"; tput sgr0 + echo `tput bold` "$ git config pull.rebase false" `tput sgr0` + git config pull.rebase false + cd $DSHELL + # Set default paths and symlinks + default_paths + user_variables + echo "PORT='3000'" >> functions/assets/user-variables.sh else echo "Ok. Aborting." fi @@ -82,32 +100,42 @@ clone_repos_ssh_non-gl() { # Clone through HTTPS clone_repos_https() { + # Define array of repos (except Charts) + typeset -A repos_array + repos_array=('gitlab-docs' 'GitLab Docs' 'gitlab' 'GitLab' 'gitlab-runner' 'GitLab Runner' 'omnibus-gitlab' 'Omnibus GitLab') tput setaf 3 - read "REPLY?All repos will be cloned into "`tput bold`"$GL"`tput sgr0 ; tput setaf 3`". This will take some time. Continue (y/n)?"`ok_sound` + read "REPLY?All repos will be cloned through HTTPS into "`tput bold`"$GL"`tput sgr0 ; tput setaf 3`". This will take some time. Continue (y/n)?"`ok_sound` tput sgr0 if [[ $REPLY =~ ^[Yy]$ ]] ; then + # Clone all repos except Charts echo "Enter the namespace your projects were forked into:"`ok_sound` read NAMESPACE for k in "${(@k)repos_array}" ; do echo `tput setaf 5`"Cloning $repos_array[$k]..."`tput sgr0` cd $GL - if [[ $k == 'charts/gitlab' ]]; then - echo `tput bold` "$ git clone https://gitlab.com/$NAMESPACE/$k.git charts" `tput sgr0` ; git clone https://gitlab.com/$NAMESPACE/$k.git charts - else - echo `tput bold` "$ git clone https://gitlab.com/$NAMESPACE/$k.git" `tput sgr0` ; git clone https://gitlab.com/$NAMESPACE/$k.git - fi - echo `tput bold` "$ git config pull.rebase false" `tput sgr0` ; git config pull.rebase false + echo `tput bold` "$ git clone https://gitlab.com/$NAMESPACE/$k.git" `tput sgr0` + git clone https://gitlab.com/$NAMESPACE/$k.git + echo `tput bold` "$ git config pull.rebase false" `tput sgr0` + git config pull.rebase false if (( $? )) ; then echo `tput setaf 1` "Failed to clone $repos_array[$k]." `tput sgr0` else tput setaf 2; echo "Cloned $repos_array[$k] into $PWD"; tput sgr0 fi - cd $DSHELL done - # Set default paths and symlinks - default_paths - user_variables - echo "PORT='3000'" >> functions/assets/user-variables.sh + # Clone Charts + echo `tput setaf 5`"Cloning GitLab Charts..."`tput sgr0` + cd $GL + echo `tput bold` "$ git clone https://gitlab.com/$NAMESPACE/charts/gitlab.git charts" `tput sgr0` + git clone https://gitlab.com/$NAMESPACE/charts/gitlab.git charts + tput setaf 2; echo "Charts cloned into $PWD"; tput sgr0 + echo `tput bold` "$ git config pull.rebase false" `tput sgr0` + git config pull.rebase false + cd $DSHELL + # Set default paths and symlinks + default_paths + user_variables + echo "PORT='3000'" >> functions/assets/user-variables.sh else echo "Ok. Aborting." fi -- GitLab From cc92e180b16217fe3ea6bef16fd9f5e5b95b3971 Mon Sep 17 00:00:00 2001 From: Marcia Ramos Date: Fri, 28 May 2021 11:27:03 +0100 Subject: [PATCH 2/3] Minor rewording --- install/ssh_gitlab.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ssh_gitlab.sh b/install/ssh_gitlab.sh index 867ca4d..d31c5e0 100644 --- a/install/ssh_gitlab.sh +++ b/install/ssh_gitlab.sh @@ -17,7 +17,7 @@ ssh-gitlab(){ ssh_ask(){ ok_sound - read "REPLY?`tput setaf 3`Do you want to add an existing SSH key pair (y/n)? `tput sgr0`" + read "REPLY?`tput setaf 3`Would you like to add an existing SSH key pair (y/n)? `tput sgr0`" if [[ $REPLY =~ ^[Yy]$ ]] ; then ssh_user_key else -- GitLab From 7be118d8afeccb190f38608648b3074e523c29d2 Mon Sep 17 00:00:00 2001 From: Marcia Ramos Date: Fri, 28 May 2021 12:30:36 +0100 Subject: [PATCH 3/3] Fix Charts in clone_temp --- install/clone-temp.sh | 53 +++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/install/clone-temp.sh b/install/clone-temp.sh index a8dc56e..7e8bdf0 100644 --- a/install/clone-temp.sh +++ b/install/clone-temp.sh @@ -48,32 +48,24 @@ clone_temp(){ } clone_repos_ssh_new(){ - # Clone repos + # Define array of repos (except Charts) + typeset -A repos_array + repos_array=('gitlab-docs' 'GitLab Docs' 'gitlab' 'GitLab' 'gitlab-runner' 'GitLab Runner' 'omnibus-gitlab' 'Omnibus GitLab') echo `tput setaf 5`"Cloning repositories..."`tput sgr0` ok_sound ; tput setaf 3 - read "REPLY?All repos will be cloned into "`tput bold`"$GL"`tput sgr0 ; tput setaf 3`". This will take some time. Continue (y/n)?`tput sgr0`"`ok_sound` + read "REPLY?All repos will be cloned through SSH into "`tput bold`"$GL"`tput sgr0 ; tput setaf 3`". This will take some time. Continue (y/n)?`tput sgr0`"`ok_sound` if [[ $REPLY =~ ^[Yy]$ ]] ; then + # Clone all repos except Charts for k in "${(@k)repos_array}" ; do - echo `tput setaf 5`"Cloning $repos_array[$k]..."`tput sgr0` cd $GL - if [[ $k == 'charts/gitlab' ]]; then - echo `tput bold` "$ git clone git@gitlab.com:gitlab-org/$k.git charts" `tput sgr0` - git clone git@gitlab.com:gitlab-org/$k.git charts - if [[ $? != 0 ]] ; then - error_sound ; echo `tput setaf 1` "Failed to clone $repos_array[$k]." `tput sgr0` - else - tput setaf 2; echo "Cloned $repos_array[$k] into $PWD"; tput sgr0 - echo "The path to `tput bold`$repos_array[$k]`tput sgr0` is `tput bold`$GL$k"`tput sgr0` - fi + echo `tput setaf 5`"Cloning $repos_array[$k]..."`tput sgr0` + echo `tput bold` "$ git clone git@gitlab.com:gitlab-org/$k.git" `tput sgr0` + git clone git@gitlab.com:gitlab-org/$k.git + if [[ $? != 0 ]] ; then + error_sound ; echo `tput setaf 1` "Failed to clone $repos_array[$k]." `tput sgr0` else - echo `tput bold` "$ git clone git@gitlab.com:gitlab-org/$k.git" `tput sgr0` - git clone git@gitlab.com:gitlab-org/$k.git - if [[ $? != 0 ]] ; then - error_sound ; echo `tput setaf 1` "Failed to clone $repos_array[$k]." `tput sgr0` - else - tput setaf 2; echo "Cloned $repos_array[$k] into $PWD"; tput sgr0 - echo "The path to `tput bold`$repos_array[$k]`tput sgr0` is `tput bold`$GL$k"`tput sgr0` - fi + tput setaf 2; echo "Cloned $repos_array[$k] into $PWD"; tput sgr0 + echo "The path to `tput bold`$repos_array[$k]`tput sgr0` is `tput bold`$GL$k"`tput sgr0` fi # Define paths case $k in @@ -85,10 +77,6 @@ clone_repos_ssh_new(){ export DOC=$GL'gitlab-docs' echo "DOC='$DOC'" >> $DSHELL/functions/assets/default-paths.sh ;; - charts/gitlab) - export CHAR=$GL'charts' - echo "CHAR='$CHAR'" >> $DSHELL/functions/assets/default-paths.sh - ;; gitlab-runner) export RUN=$GL'gitlab-runner' echo "RUN='$RUN'" >> $DSHELL/functions/assets/default-paths.sh @@ -99,6 +87,22 @@ clone_repos_ssh_new(){ ;; esac done + # Clone Charts + echo `tput setaf 5`"Cloning GitLab Charts..."`tput sgr0` + cd $GL + echo `tput bold` "$ git clone git@gitlab.com:gitlab-org/charts/gitlab.git charts" `tput sgr0` + git clone git@gitlab.com:gitlab-org/charts/gitlab.git charts + if [[ $? != 0 ]] ; then + error_sound ; echo `tput setaf 1` "Failed to clone GitLab Charts." `tput sgr0` + else + tput setaf 2; echo "Cloned GitLab Charts into $PWD"; tput sgr0 + export CHAR=$GL'charts' + echo "CHAR='$CHAR'" >> $DSHELL/functions/assets/default-paths.sh + echo "The path to `tput bold`GitLab Charts`tput sgr0` is `tput bold`$CHAR"`tput sgr0` + echo `tput bold` "$ git config pull.rebase false" `tput sgr0` + git config pull.rebase false + fi + # Source paths source $DSHELL/functions/assets/default-paths.sh cd $DSHELL # Set GitLab Docs port to 3000 @@ -111,6 +115,7 @@ clone_repos_ssh_new(){ export PORT="3000" echo "PORT='3000'" >> $DSHELL/functions/assets/user-variables.sh tput setaf 2 ; echo "Preview GitLab Docs on port 3000." ; tput sgr0 + # Symlink content folders symlink_gitlab symlinks -- GitLab