#Is there a way to get the git info from
1 messages · Page 1 of 1 (latest)
My use case is, I have a module that runs sonar scans and sonar needs the vcs information to do a proper comparison. Curious if this is possible today.
What kind of git info? Like the head of pull/123/merge in that case?
sonar needs prID, prTarget, prSource (names of the branches) or branchName if running in a branch and not a PR
Got it. I think @rocky stump has probably pulled this thread the most. Wdyt?
hm, i don't think we do. i think this would be https://github.com/dagger/dagger/issues/8520
similar to how we have contextual directories
we need to have contextual git
thankfully this might not be too far off: https://github.com/dagger/dagger/pull/9730
this is the first step in being able to even do this
however, it's not fully there, but it's getting a lot closer than we were previously
awesome! This would be super useful!
I guess there is no workaround for now. I may end up hardcoding an arbitrary branch. If not, sonar runs a scan against main and since it has nothing to compare to it fails.
mmm yeah you could always attach the info through the constructor?
yeah, I ended up doing this:
https://github.com/jpadams/cypress-test-llm-ts/blob/main/cypress-test-writer/src/index.ts#L10-L25
Interesting. I didn't want to default the branch because I am using the null'ness to determine whether to attach branch info or pr info if not. But if it's a static arbitrary branch I can check for that too
when passing a git repo as directory, is it not possible to use a branch or a PR ref?
referring to a module via dagger -m github.com... works with refs like @nonmainbranch or @pull/123/merge but I can't do the same with dagger.Directory() argument
Interesting I can refer to a branch using # like this https://docs.dagger.io/api/arguments/#reference-schemes-for-remote-repositories. I still can't get the PR though (as there isn't a branch in the upstream repo). The inconsistency between referring to a module with @ and a "version" for Directory with # is also confusing.
Agree the inconsistency is confusing! #pr/123/merge or #pr/123/head should work for PR though