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

Feature/undo failure repo #152

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 4 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
22 changes: 18 additions & 4 deletions scripts/repositories/common/create-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@ function MSG_ERROR {
if [ "$2" != 0 ]
then
echo ""

# do all or nothing ! In case something goes wrong while creating or importing a repository, the created repository and the local directory will be deleted.
cd ..

az repos delete --id "$repo_id" --org "$organization" -p "$project" --yes
if [ "$?" == 0 ]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.

Reply with "@sonatype-lift help" for info about LiftBot commands.
Reply with "@sonatype-lift ignore" to tell LiftBot to leave out the above finding from this PR.
Reply with "@sonatype-lift ignoreall" to tell LiftBot to leave out all the findings from this PR and from the status bar in Github.

When talking to LiftBot, you need to refresh the page to see its response. Click here to get to know more about LiftBot commands.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m LiftBot and I automatically analyze new code in code review, and comment when I find potential bugs. I also accept comments as commands. Just @sonatype-lift followed by the command: ignore to mark as false positive, unignore to undo, ignoreall to ignore all issues in this PR, exclude <file|path|tool|issue> to discover config file snippets, and help to see this message. Click here to add LiftBot to another repo.

then
rm -rf "$directory"
fi

echo -e "${red}The repository made will be deleted, try again!"

echo -e "${red}A problem occured in the step: $1."
echo -e "Stopping the script..."
echo -e "${white}"
Expand All @@ -100,7 +112,8 @@ fi
[ "$directory_tmp" != "" ] && directory=$(echo "$directory_tmp" | sed 's/\\/\//g')
if [ "$directory" != "" ]
then
[ "$action" == "create" ] && mkdir -p "$directory"
[ "$action" == "create" ]
mkdir -p "$directory"
cd "$directory"
MSG_ERROR "Cding into the directory given." $?
fi
Expand Down Expand Up @@ -458,12 +471,13 @@ then
fi
elif [ "$action" = "create" ]
then
MSG_ERROR "Cding into the directory given." "$?"
#cd "$directory"
MSG_ERROR "Cding into the directory given." $?
clone_git_project_create
MSG_ERROR "Cloning empty repo." $?
MSG_ERROR "Cloning empty repo." $?
git checkout -b master
cp "$absoluteFolderScriptPath/README.md" .
git a dd -A
git add -A
git commit -m "Adding README"
git push -u origin --all
if [ "$strategy" != "" ]
Expand Down