Skip to content
Snippets Groups Projects
Commit 7cc42435 authored by Shivam Khandelwal's avatar Shivam Khandelwal
Browse files

Fixes in submit.sh to run as notebook

parent c6fe0432
No related branches found
No related tags found
No related merge requests found
......@@ -146,4 +146,6 @@ data/prepared/*
.DS_Store
data/
*.serialized
\ No newline at end of file
data/*
*.tar.gz
*.serialized
......@@ -46,37 +46,22 @@ bad_remote_message() {
}
get_submission_remote() {
bad_remotes=(
git@gitlab.aicrowd.com:zew/data-purchasing-challenge-2022-starter-kit.git
http://gitlab.aicrowd.com/zew/data-purchasing-challenge-2022-starter-kit.git
)
submission_remote=""
for remote in $(git remote); do
remote=$(git remote get-url $remote)
if [[ ! "$remote" =~ "$bad_remotes" ]] && echo $remote | grep "gitlab.aicrowd.com" > /dev/null; then
submission_remote=$remote
fi
done
if [[ "$submission_remote" == "" ]]; then
bad_remote_message
fi
echo "aicrowd"
}
echo $submission_remote
get_submission_remote_url() {
git remote get-url aicrowd
}
check_remote() {
log_info Checking git remote settings...
get_submission_remote > /dev/null
log_success Using $(get_submission_remote | awk -F'@' '{print $NF}' | sed 's|.git||g') as the submission repository
log_success Using $(get_submission_remote_url | awk -F'@' '{print $NF}' | sed 's|\.git||g') as the submission repository
}
setup_lfs() {
git lfs install
HTTPS_REMOTE=$(git remote -v | grep gitlab.aicrowd.com | head -1 | awk '{print $2}' | sed 's|git@gitlab.aicrowd.com:|https://gitlab.aicrowd.com|g')
git config lfs.$HTTPS_REMOTE/info/lfs.locksverify false
find . -type f -size +5M -exec git lfs track {} &> /dev/null \;
set +e
git add .gitattributes 2&> /dev/null
......@@ -92,7 +77,7 @@ setup_commits() {
git tag -am "submission-$TAG" "submission-$TAG" || (log_error "There is another submission with the same description. Please give a different description." && exit 1)
git push -f $REMOTE master
git push -f $REMOTE "submission-$TAG"
log_success "Check the submission progress in your repository: $(get_submission_remote | awk -F'@' '{print $NF}' | sed 's|.git||g')/issues"
log_success "Check the submission progress in your repository: $(get_submission_remote_url | awk -F'@' '{print $NF}' | sed 's|\.git||g')/issues"
}
check_cli_install() {
......@@ -113,10 +98,20 @@ check_cli_install() {
log_error 'You might be on older AIcrowd CLI version. Please upgrade using `pip install -U aicrowd-cli` and login again.';exit 1
fi
export OAUTH=$(python -c 'from aicrowd.contexts.config import CLIConfig;c=CLIConfig();c.load(None);print(c.get("gitlab")["oauth_token"])')
git remote add aicrowd https://oauth2:$OAUTH@gitlab.aicrowd.com/$USERNAME/zew-data-purchasing-challenge-2022-starter-kit.git 2&> /dev/null
git remote add aicrowd https://oauth2:$OAUTH@gitlab.aicrowd.com/$USERNAME/zew-data-purchasing-challenge-2022-starter-kit.git 2> /dev/null
git config lfs.https://oauth2:$OAUTH@gitlab.aicrowd.com/$USERNAME/zew-data-purchasing-challenge-2022-starter-kit.git/info/lfs.locksverify true
git config lfs.https://gitlab.aicrowd.com/$USERNAME/zew-data-purchasing-challenge-2022-starter-kit.git/info/lfs.locksverify true
retval=$?
if [ $retval -ne 0 ]; then
log_normal "Remote already exit, repository location: $(get_submission_remote | awk -F'@' '{print $NF}' | sed 's|\.git||g')";
fi
git config --global user.email > /dev/null
retval=$?
if [ $retval -ne 0 ]; then
log_normal "Remote already exit, repository location: $(get_submission_remote | awk -F'@' '{print $NF}' | sed 's|.git||g')";
export GITID=$(python -c 'from aicrowd.contexts.config import CLIConfig;c=CLIConfig();c.load(None);print(c.get("gitlab")["userid"])')
log_normal "Git setup dont have email defined, setting it to \"${GITID}-${USERNAME}@users.noreply.gitlab.aicrowd.com\""
git config --global user.email "${GITID}-${USERNAME}@users.noreply.gitlab.aicrowd.com"
git config --global user.name $USERNAME
fi
log_success "Making submission as \"${USERNAME}\""
set -e
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment