TruCol/Self-host-GitLab-CI-for-GitHub

Wait untill repository is deleted, instead of hardcoded 30 seconds per commit.

Opened this issue · 0 comments

a-t-0 commented
  • Fix: in: create_empty_gitlab_repository_v0:
# If it already exists, delete the repository
    delete_existing_repository "$gitlab_repo_name" "$gitlab_username"
    sleep 30
    # TODO: replace this with a while loop that waits until the repo is deleted.

    # Verify the repository is deleted.
    if [ "$(gitlab_mirror_repo_exists_in_gitlab "$gitlab_repo_name")" == "FOUND" ]; then
      # Throw an error if it is not deleted.
      echo "The GitLab repository was supposed to be deleted, yet it still exists."
      #exit 177
    fi
  fi
  • Fix: in same method, wating until repo is created:
# Create repository.
  curl -H "Content-Type:application/json" "$GITLAB_SERVER_HTTP_URL/api/v4/projects?private_token=$personal_access_token" -d "{ \"name\": \"$gitlab_repo_name\" }" > /dev/null 2>&1 &
  sleep 30

  # Verify the repository is created.
  if [ "$(gitlab_mirror_repo_exists_in_gitlab "$gitlab_repo_name")" != "FOUND" ]; then
    # Throw an error if it is not created succesfully.
    echo "The GitLab repository was supposed to be created, yet it does not yet exists."
    exit 178
  fi