一个计算机技术爱好者与学习者

0%

好好学Hexo:Travis CI失效

1. 问题描述

2021年8月8日,趁着周末空闲修改了一些文章,然后发了新版。但是,发现网站没有更新。
看看邮件,没有收到travis ci的邮件,再仔细想想,貌似好久没有收到travis ci的邮件了。
登录Travis CI查看构建记录,好家伙,上次构建还是5月份的!问题大了!

到底是怎么回事?Travis CI有bug不能用了?GitHub封杀了Travis CI?Travis CI规则改了,开源项目也有构建次数限制?…不知道具体什么原因,本文我们就来排查一下。

2. 手动触发

1、登录Travis CI

2、点击 voidking/hexo-deploy 项目,点击右上角 More options,点击 Trigger build 进行手动触发构建

3、Branch 保持默认 master ,CUSTOM COMMIT MESSAGE 输入随意内容,CUSTOM CONFIG 不填

4、点击 Trigger custom build,就看到了具体的报错了

弹框提示 Oh no! You tried to trigger a build for voidking/hexo-deploy but the request was rejected.
Requests Tab页提示 Could not authorize build request for voidking/hexo-deploy.
从5月7日至今,一直是这个错误。

3. 猜想和验证

3.1. Travis CI授权过期了?

根据报错信息,很容易联想到授权过期,因为之前还好好的,突然不能用了。

1、进入GitHub Applications settings页面,配置Travis CI。
2、检查了一遍,并没有授权过期一说,没有什么问题。
3、保险起见,调整了一下 Repository access ,保存。
然而问题并没有解决,说明不是授权过期问题。

3.2. 缺少 .travis.yml ?

Travis CI论坛上有人是因为缺少 .travis.yml 文件导致。

In your case, it’s due to a missing .travis.yml.

怀疑自己也是误删了 .travis.yml 文件,但是检查了一遍,并没有误删。

3.3. 需要换免费版?

Travis CI论坛上还有人没有找到原因,最终换了Github Actions。

I kept struggling on this, and finally left travis.com for Github Actions :persevere: Now I can build & deploy again

如果非换不可的话,我打算换成Travis CI免费版,毕竟更加熟悉。但是工作量很大,很多地方都需要重新配置。我不信需要这么麻烦!

3.4. 需要加入组织?

stackoverflow上有人说需要为组织选择一个plan,莫非现在必须要加入组织才能使用Travis CI?

It’s also worth mentioning that this happens if you do not have a plan selected for your organization. First, you need to select a plan (Travis does not automatically select the free plan for you). Then, you can trigger a build and see if things work.

If that does not work, you’re likely out of builds and will need to upgrade the account.

于是,创建了一个Organizationsbegoodcoder
然而创建组织后并没有解决问题。PS:个人感觉组织和个人账号的区别,主要是组织可以创建团队。

3.5. Plan! Plan! Plan!

stackoverflow上有多个优质回答提到了Plan,这个Plan是个啥?

‘Could not authorize build request …’ usually occurs due to

  1. Has not activated either a free plan or a paid plan.
  2. Expiration of the subscription.
  3. Ran out of free trial build credits available for private repositories.
    Travis CI is always-free only for public repositories. The free plan also provides 10,000 build credits try out building private repositories. Read updated info on Billing FAQ.

1、Travis CI右上角点击账号,选择Settings

2、点击页面上的Plan

3、选择Free plan

4、再次手动触发配送,成功!

以上,Travis CI失效的问题就定位并解决了,需要选择一个Plan!