Вызовите проблему TestContainers в Jenkins для CI/CD в Spring Boot в Windows (невозможно подключиться к Ryuk по адресу 1JAVA

Программисты JAVA общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 Вызовите проблему TestContainers в Jenkins для CI/CD в Spring Boot в Windows (невозможно подключиться к Ryuk по адресу 1

Сообщение Anonymous »

Я хочу запускать все тесты, написанные в JUnit, и интеграционные тесты через Jenkins как процесс CI/CD при загрузке Spring.
Я создал grrovy-файл, файл dockerfile и docker Compose yml для Jenkins .
Вот отличный файл, показанный ниже

Код: Выделить всё

import hudson.plugins.git.UserRemoteConfig
import hudson.plugins.git.BranchSpec
import hudson.plugins.git.GitSCM
import jenkins.model.*
import org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition

def instance = Jenkins.getInstance()

def jobName = "flightsearchapi"
def job = instance.getItem(jobName)

if (job != null) {
job.delete()
}

def pipelineJob = instance.createProject(org.jenkinsci.plugins.workflow.job.WorkflowJob, jobName)
def definition = new CpsScmFlowDefinition(
new GitSCM(
[
new UserRemoteConfig("https://github.com/Rapter1990/flightsearchapi.git", null, null, null)
],
[new BranchSpec("*/development/issue-2/implement-jenkins-for-ci-cd")],
false, Collections.emptyList(),
null, null, Collections.emptyList()
),
"Jenkinsfile"
)
definition.setLightweight(true)
pipelineJob.setDefinition(definition)
pipelineJob.save()

println("Pipeline job '${jobName}' has been successfully created!")
Вот файл docker, показанный ниже

Код: Выделить всё

FROM jenkins/jenkins:lts

# Plugin list
COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN jenkins-plugin-cli --plugin-file /usr/share/jenkins/ref/plugins.txt

# For Groovy scripts, init.d directory
COPY init.groovy.d/ /var/jenkins_home/init.groovy.d/

# Install Docker CLI
USER root
RUN apt-get update && apt-get install -y docker.io
< /code>
Вот файл yml-compose docker < /p>
version: '3.9'

services:
jenkins:
build:
context: .
dockerfile: Dockerfile
container_name: jenkins-server
ports:
- "8080:8080"    # Expose Jenkins UI on port 8080
- "50000:50000"  # Expose port for Jenkins agents
volumes:
- jenkins_home:/var/jenkins_home   # Persistent Jenkins data
- /var/run/docker.sock:/var/run/docker.sock # Mount Docker socket for Docker builds
- ../k8s:/var/jenkins_home/k8s # Mount Kubernetes configuration files (optional)
- ./init.groovy.d:/var/jenkins_home/init.groovy.d # Mount Jenkins init scripts (optional)
environment:
JAVA_OPTS: "-Djenkins.install.runSetupWizard=false" # Skip setup wizard (optional)
user: root # Run as root to allow installing dependencies

volumes:
jenkins_home:
Когда я запускаю docker-compose через docker-compose up -d и запускаю конвейер, я получаю ошибку, показанную ниже

Код: Выделить всё

12:47:17.631 [main] INFO org.testcontainers.DockerClientFactory -- Docker host IP address is 172.17.0.1
12:47:17.679 [main] INFO org.testcontainers.DockerClientFactory -- Connected to docker:
Server Version: 20.10.21
API Version: 1.41
Operating System: Docker Desktop
Total Memory: 12678 MB
12:47:17.790 [main] INFO tc.testcontainers/ryuk:0.11.0 -- Creating container for image: testcontainers/ryuk:0.11.0
12:47:17.814 [main] INFO org.testcontainers.utility.RegistryAuthLocator -- Failure when attempting to lookup auth config. Please ignore if you don't have images in an authenticated registry. Details: (dockerImageName: testcontainers/ryuk:0.11.0, configFile: /root/.docker/config.json, configEnv: DOCKER_AUTH_CONFIG). Falling back to docker-java default behaviour. Exception message: Status 404: No config supplied. Checked in order: /root/.docker/config.json (file not found), DOCKER_AUTH_CONFIG (not set)
12:47:18.097 [main] INFO tc.testcontainers/ryuk:0.11.0 -- Container testcontainers/ryuk:0.11.0 is starting: a821037942a489255c5ee014be369aecbeb7793ff5b60a9b7189497e103051cd
12:47:18.906 [main] INFO tc.testcontainers/ryuk:0.11.0 -- Container testcontainers/ryuk:0.11.0 started in PT1.1156687S
12:47:18.917 [testcontainers-ryuk] WARN org.testcontainers.utility.RyukResourceReaper -- Can not connect to Ryuk at 172.17.0.1:30511
java.net.ConnectException: Connection refused
он работает с Linux, но не может работать на Windows.
Как я могу решить проблему?

Подробнее здесь: https://stackoverflow.com/questions/793 ... dows-can-n
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «JAVA»