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

标签 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:
      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

在工作流的结果中,我得到 connection refused ,工作流能够 pull 出 Solr 容器,但在我的测试中,我收到以下错误:
获取“http://localhost:2010/solr/customer/select?q=id%3A2+\u0026wt=json”:调用 tcp 127.0.0.1:2010:连接:连接被拒绝”
由于 Solr 容器已被 pull 出,我希望我的测试能够成功访问 Solr API。

最佳答案

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

  services:
    solr:
      image: solr:8.3.1
      ports:
        - 2010:8983
调试服务容器启动可能有点困难。但是,如果您在操作日志中四处挖掘,您应该会找到一些线索。

关于git - 无法在 Github 工作流程中初始化 Solr,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64100239/

相关文章:

sql-server - Golang 连接到 SQL Server 错误 - "TLS Handshake failed: Cannot read handshake packet: EOF"

git - 文件夹重命名后在 GitHub 中查看历史记录

git - bash PS1 中的动态元素

go - 什么是 npm-outdated 的 Go(mod)等价物?

go - 更新opentelemetry普罗米修斯导出商中的标签

git - AWS CodeDeploy 找不到私有(private)存储库 "could not download bundle"的 github tar 链接

git - 在 Julia 中提交包时出错

linux - 如何为 Git 命令设置自动完成功能?

git - Android Studio - 无法使用新系统和旧备份文件将我的代码推送到 GitHub Enterprise...怎么办

git - 将 Github 存储库移植到另一种语言