sourcegraph / sourcegraph-public-snapshot

Code AI platform with Code Search & Cody
https://sourcegraph.com
Other
10.1k stars 1.27k forks source link

How to change the docker command in auto-indexing? #60849

Open zhangype opened 6 months ago

zhangype commented 6 months ago

I'm self-hosted customer. I want to change the dind host configuration and maven settings. How can I change the docker command in auto-indexing? A sample command is as follows. docker run --add-host='maven.oa.com:IP' -v $(pwd):/sources -v /data/app/devtools/maven/conf/settings.xml:/settings.xml --env JVM_VERSION=8 sourcegraph/scip-java:0.9.5 scip-java index -- --batch-mode clean verify -Dmaven.test.skip=true -s /settings.xml -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true -Dmaven.resolver.transport=wagon 企业微信截图_16934447268146 image

varungandhi-src commented 6 months ago

Via @keynmol in Slack:

it is possible to pass a custom set of arguments to whatever command we execute in Maven, this is done via adding -- to the default list, and listing the arguments after

I think that should cover your SSL related arguments.


Could you clarify if you really need to modify the full set of Docker arguments such as adding --add-host? We don't support modifying the list directly today, but perhaps you can work around that by either modifying /etc/hosts on the executor itself, since you're on a self-hosted instance (this forum thread:

Docker maps the host’s /etc/hosts into the container at startup


@zhangype please let us know if that answers the questions you had

zhangype commented 6 months ago

Via @keynmol in Slack:

it is possible to pass a custom set of arguments to whatever command we execute in Maven, this is done via adding -- to the default list, and listing the arguments after

I think that should cover your SSL related arguments.

Could you clarify if you really need to modify the full set of Docker arguments such as adding --add-host? We don't support modifying the list directly today, but perhaps you can work around that by either modifying /etc/hosts on the executor itself, since you're on a self-hosted instance (this forum thread:

Docker maps the host’s /etc/hosts into the container at startup

@zhangype please let us know if that answers the questions you had

I add the configuration but still couldn't connect to private maven repository.

argumentsConfig logOutput

I have modified the /etc/hosts file in the executor and dind containers, and tested that the executor and dind containers can connect to the maven repository. But the auto-indexing still fails to connect to the private maven repository.

hostConfig testConnect

zhangype commented 6 months ago

@varungandhi-src

keynmol commented 6 months ago

Hey @zhangype, it seems you have an old version of scip-java running - 0.8.13 vs latest 0.9.9.

In particular, I believe you're affected by a bug in handling of trailing arguments, which was fixed in 0.9.7 (see issue https://github.com/sourcegraph/scip-java/issues/650)

I recommend updating the java indexer version in site configuration, by adding something like

  "codeIntelAutoIndexing.indexerMap": {
    "java": "sourcegraph/scip-java:0.9.9"
  },

We also have latest (latest tag) and latest-snapshot (latest main branch commit, for those living on the bleeding edge)

Please try changing the version and let me know if it helps.

zhangype commented 6 months ago

Hey @zhangype, it seems you have an old version of scip-java running - 0.8.13 vs latest 0.9.9.

In particular, I believe you're affected by a bug in handling of trailing arguments, which was fixed in 0.9.7 (see issue sourcegraph/scip-java#650)

I recommend updating the java indexer version in site configuration, by adding something like

  "codeIntelAutoIndexing.indexerMap": {
    "java": "sourcegraph/scip-java:0.9.9"
  },

We also have latest (latest tag) and latest-snapshot (latest main branch commit, for those living on the bleeding edge)

Please try changing the version and let me know if it helps.

I used scip-java 0.9.9, but still couldn't connect to the private maven repository. I think it's possible that the /etc/hosts file isn't working. But you can see my previous reply, I have tested that the /etc/hosts file is valid. @keynmol use099

zhangype commented 6 months ago

Hey @varungandhi-src and @keynmol. By the way, I deployed sourcegraph-executor this way. The version of Sourcegraph I'm currently using is 5.0.0.