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

空仓库推送不成功给出 warning 而不是 error #62

Closed
yi-Xu-0100 opened this issue Oct 16, 2020 · 11 comments · Fixed by #95
Closed

空仓库推送不成功给出 warning 而不是 error #62

yi-Xu-0100 opened this issue Oct 16, 2020 · 11 comments · Fixed by #95
Labels
bug Something isn't working priority/high

Comments

@yi-Xu-0100
Copy link
Contributor

yi-Xu-0100 commented Oct 16, 2020

空仓库,推送不成功,是否应该作出判断,给出相应的 warning,而不是 error?
毕竟这个仓库不同步并不影响,这并不是一种必须处理的错误问题。

@Yikun Yikun added the bug Something isn't working label Oct 24, 2020
@Yikun
Copy link
Owner

Yikun commented Oct 24, 2020

现在这个empty同步是直接中断挂掉了,还是最后raise error?

@yi-Xu-0100
Copy link
Contributor Author

@Yikun 不会中断,但是最后会返回步骤失败,造成缓存无法完成。虽然都同步成功了,但是后面步骤都不会完成。

@yi-Xu-0100
Copy link
Contributor Author

yi-Xu-0100 commented Oct 24, 2020

@Yikun https://github.com/yi-Xu-0100/test/runs/1258327855

可以看下以前的这个测试,MyWiki 是空仓库,同步会因为 push fail 而使结果错误。

是否应该在 clone 的地方判断,因为 clone 的结果中包含 warning 提示。

Backup MyWiki ...
(0/3) Downloading...
Cloning into 'MyWiki'...
warning: You appear to have cloned an empty repository.
+ cd MyWiki
+ create_repo MyWiki ***
++ curl https://gitee.com/api/v5/users/yiXu0100/repos
  % Total    % Received % Xferd  Average S++ peejq d '.[] | select(.full_name=="yiXu0100/MyWiki").name' 
 Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0++ wc -l

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:04 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:04 --:--:--     0
 99  111k   99  111k    0     0  21522      0  0:00:05  0:00:05 --:--:-- 22261
100  111k  100  111k    0     0  21545      0  0:00:05  0:00:05 --:--:-- 36242
+ has_repo=1
+ '[' 1 == 0 ']'
+ git remote add gitee git@gitee.com:yiXu0100/MyWiki.git
+ update_repo
(1/3) Updating...
+ echo -e '\033[31m(1/3)\033[0m' Updating...
+ git pull -p
Your configuration specifies to merge with the ref 'refs/heads/master'
from the remote, but no such ref was fetched.
+ echo 'Update failed'
+ import_repo
+ echo -e '\033[31m(2/3)\033[0m' Importing...
+ git remote set-head origin -d
Update failed
(2/3) Importing...
+ [[ true == \t\r\u\e ]]
+ git push -f gitee 'refs/remotes/origin/*:refs/heads/*' --tags --prune
Warning: Permanently added 'gitee.com,117.28.245.92' (ECDSA) to the list of known hosts.
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
Connection to gitee.com closed by remote host.
 Push failed 
error: failed to push some refs to 'git@gitee.com:yiXu0100/MyWiki.git'

@yi-Xu-0100
Copy link
Contributor Author

我创建的 repo-list-genreator - github action 自从 v1.0.0 开始已经能够去除空仓库了!这样暂时就不会有这个空仓库推送报错的问题了!

@yi-Xu-0100
Copy link
Contributor Author

@Yikun 空仓库在新版本中仍然无法同步并给出 error,如果只使用当前的 action 可能会造成缓存模式中断和后续任务失败,建议在 python 中增加判断空仓库并跳过给出 warning 的逻辑。😀

@Yikun
Copy link
Owner

Yikun commented Mar 9, 2021

@yi-Xu-0100 这个我会尽快解决,python版本比较好改了。:)

我看链接[1]提到的git rev-list -n 1 --all这个方法感觉还不错。

[1] https://stackoverflow.com/questions/5491832/how-can-i-check-whether-a-git-repository-has-any-commits-in-it

@Yikun
Copy link
Owner

Yikun commented Mar 11, 2021

如果只使用当前的 action 可能会造成缓存模式中断和后续任务失败

昨天我没注意,你说还会影响后续任务失败吗?我试了下,似乎不会break流程 [1],只是有一个failed。因为理论上讲,所有的主流程错误都会被catch住,并且append到failed list里面

[1] https://github.com/Yikun/hub-mirror-action/pull/95/checks?check_run_id=2077891384

@yi-Xu-0100
Copy link
Contributor Author

@Yikun
我指的是当前 workflows 中这个任务之后的任务,造成整个 job 失败,应该会造成 cache 缓存失败。

当然其他的仓库同步是完成的。

@Yikun
Copy link
Owner

Yikun commented Mar 11, 2021

@yi-Xu-0100 OK,明白了,这是因为empty push失败了,加到failed list里了,如果failed list非空,会在最后退出的。

所以,你这个场景,即使修复了empty这个问题,可能也不能完全避免。感觉需要一个参数来控制最后的退出

比如类似skip_exit之类的,默认保持现状,如果用户设置为True的话,job永远成功,不会退出。这样不会break到后面的job。

@Yikun
Copy link
Owner

Yikun commented Mar 11, 2021

另外,empty这个问题已经解决了:#62 ,可以试试 uses: Yikun/hub-mirror-action@empty,没问题我就合入了。
image
[1] https://github.com/Yikun/hub-mirror-action/pull/95/checks?check_run_id=2082408627

@yi-Xu-0100
Copy link
Contributor Author

yi-Xu-0100 commented Mar 11, 2021

@Yikun 看起来非常不错👍,合并后关闭

@yi-Xu-0100 yi-Xu-0100 reopened this Mar 11, 2021
@Yikun Yikun closed this as completed in #95 Mar 11, 2021
Yikun added a commit that referenced this issue Mar 11, 2021
If the repo is empty, the repo pushing will be skipped, that means,
only empty repo will be created, and keep it empty like source repo.

Close: #62
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority/high
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants