Check if test_branch exists in at least one repo among the ones in repos file#624
Check if test_branch exists in at least one repo among the ones in repos file#624adityapande-1995 wants to merge 3 commits intomasterfrom
Conversation
Signed-off-by: Aditya <aditya050995@gmail.com>
Signed-off-by: Aditya <aditya050995@gmail.com>
Signed-off-by: Aditya <aditya050995@gmail.com>
| for filename in repos_filenames: | ||
| branch_found = check_branch_exists(filename, args.test_branch) | ||
| if not branch_found: | ||
| print('Warning: None of the repos in ', filename, ' contain the branch ', args.test_branch) |
There was a problem hiding this comment.
How visible is this warning? Does it make the job yellow or do we have to notice it in the log?
IMO, it might be better to just abort the job early since it seems most likely not what the user intended and continuing with the build is probably not worth the time.
There was a problem hiding this comment.
Agreed; if the user specified a branch, but we couldn't find any of them, let's just abort the build early. It's probably not what was intended. We also have to be careful to succeed if the branch name is empty; that is the "normal" state of affairs, in which case we just want to continue on.
| urls = [] | ||
| for line in lines: | ||
| text = line.strip() | ||
| if text[-4:] == ".git": |
There was a problem hiding this comment.
It'd be nice if there is a vcs command we could use instead. I think checking for a ".git" suffix might be too brittle since I don't think it's a requirement that it's there. Also, since the repositories are already cloned locally, it seems a bit redundant to re-parse the repos files.
There was a problem hiding this comment.
That's right, this is too brittle. The .git isn't required (though it is recommended).
Actually, I wonder if it would be better to just parse these repos files as the YAML files they are. That will be way less brittle, and doesn't require us to use os.system (or this brittle parsing) at all.
Currently, if the supplied
test_branchis not found in any of the repos in the .repos file, the workflow will just skip it and run CI on the default branches. There should be an error, or at least a warning saying that none of the repos contain the branch, as discussed offline with @clalancetteCloses #620
Signed-off-by: Aditya aditya050995@gmail.com