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

空间不足导致同步失败,希望加入可配置的clean 操作 #122

Open
appotry opened this issue Sep 4, 2021 · 5 comments
Open
Labels
feature New feature or request help wanted Extra attention is needed

Comments

@appotry
Copy link

appotry commented Sep 4, 2021

You are running out of disk space. The runner will stop working when the machine runs out of disk space. Free space left: 21 MB

同步一个仓库就清空cache,以保证空间不超标

@Yikun Yikun added the feature New feature or request label Sep 6, 2021
@Yikun
Copy link
Owner

Yikun commented Sep 6, 2021

感谢反馈,Github Action的限制为14GB [1],我认为这个是一个合理的需求,会解决下。

作为临时规避解决方案,可以参考这个,把不同的repo拆开成多个job。这个方案的好处是,可以使用原有的cache功能

[1] https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources

@appotry
Copy link
Author

appotry commented Sep 6, 2021

这个看起来是手动拆解成多个job。我自己看了下代码,临时加了两行代码解决问题了。临时方案,就没pr了
mirror.py 文件中 def push(self, force=False):函数最后加两行

        print('clean repo %s' % self.src_name)
        shutil.rmtree(local_repo.working_dir)

对这两行代码做一个环境变量做判断,基本就可以完成需求。只是没法用cache了

一个action文件,里面自动对每个repo生成一个job,这样有没有可行性? 感觉理论可行,这样就可以用cache了

@Yikun
Copy link
Owner

Yikun commented Sep 6, 2021

可以把个别大的拆成单个job(用static_list或者white_list),然后剩余的一起同步(用black_list屏蔽掉之前个别大的那些)

@Yikun
Copy link
Owner

Yikun commented Sep 6, 2021

另外关于这个特性的支持,我建议这样:

  1. 新增一个cleanup的配置项
  cleanup:
    description: "Clean up the repo cache after repo mirror, it might helps some when the repo size is too big and large than github action limitation."
    default: false
  1. Mirror类中加一个cleanup的函数,最好有一个print的info。
  2. HubMirror类里,根据配置项控制,调用一下这个mirror.cleanup。

@appotry 有兴趣实现下,提个PR吗?:)

@appotry
Copy link
Author

appotry commented Sep 7, 2021

直接在push函数后面加个判断分支处理,和单独函数来说,没什么本质区别
这个提交pr目前就算了,python不是主力语言,目前语法还没看全

@Yikun Yikun added the help wanted Extra attention is needed label Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants