无法在Github工作流中初始化Solr

无法在Github工作流中初始化Solr,git,go,github,solr,workflowservice,Git,Go,Github,Solr,Workflowservice,这是我在工作流中使用的GitHub操作文件 .github/workflows/go.yml name: Go on:   push:     branches: [ master development ]     tags:       - '*'   pull_request:     branches:       - '*' jobs:   test:     name: Test     runs-on: [self-hosted, linux]     services:    

这是我在工作流中使用的GitHub操作文件

.github/workflows/go.yml

name: Go

on:
  push:
    branches: [ master development ]
    tags:
      - '*'
  pull_request:
    branches:
      - '*'
jobs:
  test:
    name: Test
    runs-on: [self-hosted, linux]
    services:
      solr:
        image: solr
        ports:
          - 2010:8983
        options: solr:8.3.1 - cloud
    steps:
    - name: Set up Go 1.x
      uses: actions/setup-go@v2
      with:
        go-version: ^1.14
      id: go

    - name: Check out code into the Go module directory
      uses: actions/checkout@v2
     
    - name: Get dependencies
      run: |
        go get -v -t -d ./...
       
    - name: Test
      run: |
        mkdir build
           go test ./... -v -coverprofile build/coverage.txt -coverpkg=./...
        cat build/coverage.txt | grep -v '.pb.go' > build/coverage.out
        go tool cover -func build/coverage.out
       
    - uses: actions/upload-artifact@v2
      with:
        name: build artifacts
        path: build

在工作流的结果中,我得到了
连接被拒绝
,工作流能够拉取Solr容器,但在我的测试中,我得到了以下错误:

得到“http://localhost:2010/solr/customer/select?q=id%3A2+\u0026wt=json“:拨号tcp 127.0.0.1:2010:连接:连接被拒绝”

由于Solr容器已经被拉入,我希望我的测试能够成功地命中Solr API。

我相信您的“选项”“设置实际上是将参数传递给导致服务错误的容器。至少,当我在本地尝试它们时,这似乎是正在发生的事情。以这种方式尝试服务设置,以获得所需的显式版本:

  services:
    solr:
      image: solr:8.3.1
      ports:
        - 2010:8983

调试服务容器启动可能有点困难。但是如果你在行动日志中翻找,你应该会发现一些线索。

@mikerowehi,得到与以前相同的错误。下面是日志,我为容器启动获得了
/usr/bin/docker pull solr:8.3.1 8.3.1:从库中提取/solr…/usr/bin/docker create--name solr831_d30703--label 7784cf--network github_network…--网络别名solr-p 2010:8983-e github_ACTIONS=true-e CI=true solr:8.3.1/usr/bin/docker start/usr/bin/docker ps--all--filter id=--filter status=running--no trunc--format“{{.ID}}{{.status}}”启动不到一秒钟/usr/bin/docker port
看起来solr容器启动需要很长时间。我刚刚试着在github创建一个测试,过了几秒钟容器才真正为请求提供服务。因此,只需添加一个healthcheck来确保solr正在为请求提供服务,github工作流将在开始步骤之前确保容器是健康的。就像这样:Solr正在连接。但是我得到的错误是
“msg”:“Solr实例没有在SolrCloud模式下运行。”
@mikerowehi无法真正帮助Solr设置部分,我不太熟悉如何使用它。请接受在工作流中获取go应用程序并连接到Solr实例的答案。