Test default pkg-url for GitLab and BitBucket (#322)

* Test default `pkt-url` for GitLab and BitBucket
* Fail if `cargo-build` is called when testing GitLab/BitBucket
* Fix use of `remote_exists` in `GhCrateMeta::launch_baseline_find_tasks`
   
   If `Method::HEAD` fails, try `Method::GET` since some servers reject
   `Method::HEAD`, e.g. bbuseruploads.s3.amazonaws.com

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-08-27 20:45:55 +10:00 committed by GitHub
parent f973d32ff6
commit e39a02aa92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 58 additions and 3 deletions

View file

@ -59,9 +59,11 @@ impl GhCrateMeta {
AutoAbortJoinHandle::spawn(async move {
debug!("Checking for package at: '{url}'");
remote_exists(client, url.clone(), Method::HEAD)
.await
.map(|exists| exists.then_some((url, pkg_fmt)))
Ok(
(remote_exists(client.clone(), url.clone(), Method::HEAD).await?
|| remote_exists(client, url.clone(), Method::GET).await?)
.then_some((url, pkg_fmt)),
)
})
})
}