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

Travis CI badges may come from travis-ci.com #1392

Closed
kennytm opened this issue May 9, 2018 · 21 comments
Closed

Travis CI badges may come from travis-ci.com #1392

kennytm opened this issue May 9, 2018 · 21 comments
Labels
C-bug 🐞 Category: unintended, undesired behavior

Comments

@kennytm
Copy link
Member

kennytm commented May 9, 2018

Currently Travis CI badges are hard-coded to use travis-ci.org. However, Travis recently announced that new open source projects will be stored on travis-ci.com and the old ones will soon be migrated.

There should be some way to choose the .com site for the badge.

@sgrif
Copy link
Contributor

sgrif commented May 10, 2018

It sounds like we'll probably just need to switch 100% to .com at some point. I'd like to get details on how specifically the migration affects status badges which isn't detailed in that blog post.

@kinggoesgaming
Copy link

How about having a two step process for now:

check if it exists on travis-ci.com and if it fails for any reason fallback to travis-ci.org

When the migration is complete from travis simply drop the fallback code

@carols10cents carols10cents added C-bug 🐞 Category: unintended, undesired behavior A-badges labels Jun 27, 2018
@Dragonrun1
Copy link

I was trying to figure out why my new crate was showing unknown status until I finally looked closely and realized the URL was wrong. I like @kinggoesgaming idea as it is the most forward-looking solution IMHO.

Just my guess on when they switch the URL on projects is when you switch from the old style GitHub hooks to the new Apps interface. I'm sure at some point they'll force everyone to make the switch but crates should have already been updated long before then.

@sysarcher
Copy link

sysarcher commented Sep 22, 2018

Now might be the time to update the URL :)

sondr3 added a commit to sondr3/git-anger-management that referenced this issue Oct 19, 2018
@sondr3
Copy link

sondr3 commented Oct 19, 2018

Now it is really starting to become time to fix this, all new projects created from the blog post a month ago will default to using travis.com over travis.org, meaning the default behavior is wrong. I'd love to fix this myself and get my hands dirty, but I don't know where to start. @steveklabnik (sorry for the tag)

@jtgeibel
Copy link
Member

@sondr3 I can point you in a few directions and mention a few areas that may be a bit tricky:

  • First, I have no idea if cargo includes its own checks on the badge attributes. If so, then similar changes will be needed there as well.
  • We store badge attributes in a jsonb column in the database, so this shouldn't require schema changes.
  • Badge attributes are validated when the crate is published. Basically, we make sure the badge metadata can deserialize into our Badge enum. We can add another field there that is an Option<TravisDomain> where TravisDomain is an enum allowing com or org. It needs to be optional so that existing TOML files aren't rejected for not including this attribute.
  • I'm less familiar with the frontend, but I think you'll need to update the component and its template. For now, I think the default needs to be org to make sure existing badges without that field will not be changed accidentally. Once all projects are migrated on travis, we could consider changing the default to com and removing the support for customizing the domain.
  • Update the cargo docs to demonstrate and explain the new option.

@sondr3
Copy link

sondr3 commented Oct 19, 2018

Doesn't sound too hard (famous last words), I'll take a look over the weekend. Thanks for the pointers @jtgeibel 😄

@jtgeibel
Copy link
Member

Sure thing! Let me know if you have any questions along the way.

@pietroalbini
Copy link
Member

Basically the situation is that the Travis migration tool isn't ready (and judging by their progress and the acquisition I think it's not going to be ready for a while) so they postponed the switch from .org and .com for existing repos to an unknown (to us) date. New repositories are added on .com though today, so we'll need to handle badges.

There are two ways we could handle this (that I can think of):

  • Make a call to the Travis API in the backend to check if the repo is on .org or .com. This is seamless to the crate author, but it will add some delay to the pages. That could be handled by caching the result for like days, but it will still affect less visited crates a lot.
  • Have the crate owners explicitly change the badge declaration to specify they're on .com. That doesn't add overhead to our backend, but it's churn for the crate authors. We will also need to find a way to make this compatible to when everyone will be migrated to .com.

@djmcgill
Copy link

djmcgill commented Feb 4, 2019

I recently encountered this issue when using cargo-readme which also generates a badge url from the manifest attribute. To be as simple as possible I just went with the explicit approach:
webern/cargo-readme#29

[badges]
travis-ci = { repository = "cargo-readme/test", tld = "com" }

n.b. only "com" and "org" are accepted in that PR. The key is optional and defaults to "org" so it's entirely backwards compatible.

When (if) travis do make the switch we can just change the default to be com.

swsnr added a commit to swsnr/mdcat that referenced this issue Feb 11, 2019
franky47 added a commit to 47ng/hashdir that referenced this issue Feb 20, 2019
As it uses the new travis-ci.com platform and
crates.io is hardcoded on travis-ci.org.
rust-lang/crates.io#1392
@pietroalbini
Copy link
Member

We talked with our contacts at Travis CI, and they're looking into providing an unified badges URL regardless of the tld. We'll have more information about this in the coming weeks, so I'd hold on adding a new attribute to the manifest for now.

@pietroalbini
Copy link
Member

Travis CI doesn't have an exact timeline yet but they'll let us know in the next week.

@pietroalbini
Copy link
Member

There is another update from Travis CI!

They implemented badges redirect on their end, so a travis-ci.org badge will redirect to .com if the repo has been migrated! There are a few small bugs on their implementation (mostly some of the repos don't properly redirect yet), but I already reported those issues and they'll fix them on their end.

Thanks to that the badges themselves are already fixed, but the links are still pointing to .org even if the repo has been migrated. What we can do to fix the issue on our end is to add a bit of JavaScript that replaces the link to use the same tld as the image once it's loaded. Anyone up to implement that?

@kennytm
Copy link
Member Author

kennytm commented May 29, 2019

if the repo has been migrated!

but what about new repos?

@pietroalbini
Copy link
Member

@kennytm that's the bug I was talking about ;)

As far as I can see it's supposed to redirect to .com even if the repository doesn't exist on .org, so new repos should be handled by that. The bug is that the redirect doesn't happen if the repos are on .org's database but marked as inactive.

@kzys
Copy link
Contributor

kzys commented Aug 27, 2019

Can we remove P-high from the issue now?

danleh pushed a commit to danleh/main_error that referenced this issue Sep 24, 2019
@glandium
Copy link

Apparently something changed on travis in the past 24 hours. I uploaded a new crate yesterday, with its CI on travis-ci.com. The badge showed "passed" properly then. But it shows "unknown" today.
However, a cursory check seems to indicate that api.travis-ci.com now serves badges for both .com and .org-hosted projects. So it would seem it'd be time for crates.io to switch to api.travis-ci.com for everything.

@kzys
Copy link
Contributor

kzys commented Nov 8, 2019

Interesting. Yes. Both https://travis-ci.com/rust-lang/crates.io/ and https://travis-ci.org/rust-lang/crates.io/ use https://api.travis-ci.com/rust-lang/crates.io.svg?branch=master.

The link issue is still annoying. https://travis-ci.com/rust-lang/crates.io/ works but https://travis-ci.org/rust-lang/crates.io/ shows "This repository was migrated and is now building on travis-ci.com" and doesn't automatically redirect to the com equivalent. So always pointing .org technically works, but asks users additional 1-click.

Always pointing .com simply doesn't work. https://travis-ci.org/kzys/2014/ is my old Travis-integrated GitHub repos, but https://travis-ci.com/kzys/2014/ shows "We couldn't find the repository".

What @pietroalbini suggested

What we can do to fix the issue on our end is to add a bit of JavaScript that replaces the link to use the same tld as the image once it's loaded. Anyone up to implement that?

would not work since api.travis-ci.com doesn't redirect to .org.

So, we may need the tld attribute, as @djmcgill suggested.

@glandium
Copy link

glandium commented Nov 8, 2019

Weird, my own github repos still on travis-ci.org have working badges on travis-ci.com. Is it because I also have active repos on travis-ci.com, but you don't?

@kzys
Copy link
Contributor

kzys commented Nov 8, 2019

Might be. I have nothing on travis-ci.com.

@Turbo87
Copy link
Member

Turbo87 commented Apr 17, 2020

we've today decided to remove the badges from the UI and only keep those that are in the README of the project, so this issue will probably resolve itself that way. more details are available in #2436

@Turbo87 Turbo87 closed this as completed Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug 🐞 Category: unintended, undesired behavior
Projects
None yet
Development

No branches or pull requests