gitlab runner 运行失败

  • Choerodon平台版本: 0.23.0

  • 遇到问题的执行步骤:
    创建应用服务,同步到gitlab创建成功代码库,CI/CD Jobs自动运行,报错如下:

  • 文档地址:

  • 环境信息(如:节点信息):

  • 报错日志:
    Running with gitlab-runner 11.11.4 (e828d3bc)

2 on runner-57cf9bb57c-hc7sl 3-NHaVye

3Using Kubernetes namespace: devops-system

00:00

4Using Kubernetes executor with image registry.cn-shanghai.aliyuncs.com/choerodon-tools/cibase:0.9.1

6Waiting for pod devops-system/runner-3-nhavye-project-17-concurrent-07gg6m to be running, status is Pending

00:18

7Waiting for pod devops-system/runner-3-nhavye-project-17-concurrent-07gg6m to be running, status is Pending

8Waiting for pod devops-system/runner-3-nhavye-project-17-concurrent-07gg6m to be running, status is Pending

9Waiting for pod devops-system/runner-3-nhavye-project-17-concurrent-07gg6m to be running, status is Pending

10Waiting for pod devops-system/runner-3-nhavye-project-17-concurrent-07gg6m to be running, status is Pending

11Waiting for pod devops-system/runner-3-nhavye-project-17-concurrent-07gg6m to be running, status is Pending

12Running on runner-3-nhavye-project-17-concurrent-07gg6m via runner-57cf9bb57c-hc7sl…

14Initialized empty Git repository in /builds/operation-test-devops001/test-micro001/.git/

00:01

15Fetching changes with git depth set to 50…

16Created fresh repository.

17From http://10.74.162.45:8080/operation-test-devops001/test-micro001

18 * [new ref] refs/pipelines/13 -> refs/pipelines/13

19 * [new branch] develop -> origin/develop

20Checking out 9d2fb3a7 as develop…

21Skipping Git submodules setup

25$ http_status_code=curl -o .auto_devops.sh -s -m 10 --connect-timeout 10 -w %{http_code} "${CHOERODON_URL}/devops/ci?token=${Token}&type=microservice" # collapsed multi-line command

00:00

29ERROR: Job failed: command terminated with exit code 1

  • 原因分析:

    提出您分析问题的过程,以便我们能更准确的找到问题所在

  • 疑问:

    提出您对于遇到和解决该问题时的疑问

你好, 能贴下ci文件内容吗?

image: registry.cn-shanghai.aliyuncs.com/choerodon-tools/cibase:0.9.1

stages:

  • build
  • release

build:
stage: build
script:
- update_pom_version
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent test -Dmaven.test.failure.ignore=true -DskipTests=false -U
- mvn --batch-mode verify sonar:sonar -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_LOGIN -Dsonar.gitlab.project_id=$CI_PROJECT_PATH -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -Dsonar.analysis.serviceGroup=$GROUP_NAME -Dsonar.analysis.commitId=$CI_COMMIT_SHA -Dsonar.projectKey=${GROUP_NAME}:${PROJECT_NAME}
- mvn package spring-boot:repackage
- mv target/app.jar $PWD/docker
- kaniko -c $PWD/docker -f $PWD/docker/Dockerfile -d ${DOCKER_REGISTRY}/${GROUP_NAME}/${PROJECT_NAME}:${CI_COMMIT_TAG}

release:
stage: release
script:
- chart_build

.auto_devops: &auto_devops |
http_status_code=curl -o .auto_devops.sh -s -m 10 --connect-timeout 10 -w %{http_code} "${CHOERODON_URL}/devops/ci?token=${Token}&type=microservice"
if [ “$http_status_code” != “200” ]; then
cat .auto_devops.sh
exit 1
fi
source .auto_devops.sh

before_script:

  • *auto_devops

你在runner的before_script的第一行加这个

echo "${CHOERODON_URL}/devops/ci?token=${Token}&type=microservice"

然后把打印出的地址放到浏览器的地址栏去请求试试

你这个 CHOERODON_URL 配的是网关的地址吗? 怎么从命名看着像 devops-service的域名?

是getaway的,devops-service是单独的域名。

那你使用curl去请求你的地址看看状态码:

curl -I ${你在job中打印出的信息}

[WARNING] The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is missing, no dependency information available

827[WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failure to find org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced

828[INFO]

829[INFO] — sonar-maven-plugin:3.7.0.1746:sonar (default-cli) @ test-micro001 —

830[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.pom

831[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.pom (3.0 kB at 4.4 kB/s)

832[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.pom

833[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.pom (5.3 kB at 6.5 kB/s)

834[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/sonarsource/scanner/api/sonar-scanner-api/2.14.0.2002/sonar-scanner-api-2.14.0.2002.pom

835[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/sonarsource/scanner/api/sonar-scanner-api/2.14.0.2002/sonar-scanner-api-2.14.0.2002.pom (5.2 kB at 6.3 kB/s)

836[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/sonarsource/scanner/api/sonar-scanner-api-parent/2.14.0.2002/sonar-scanner-api-parent-2.14.0.2002.pom

837[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/sonarsource/scanner/api/sonar-scanner-api-parent/2.14.0.2002/sonar-scanner-api-parent-2.14.0.2002.pom (4.8 kB at 7.8 kB/s)

838[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar

839[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/sonarsource/scanner/api/sonar-scanner-api/2.14.0.2002/sonar-scanner-api-2.14.0.2002.jar

840[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.jar

841[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar (28 kB at 13 kB/s)

842[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.jar (262 kB at 21 kB/s)

843[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/sonarsource/scanner/api/sonar-scanner-api/2.14.0.2002/sonar-scanner-api-2.14.0.2002.jar (625 kB at 23 kB/s)

844[INFO] User cache: /root/.sonar/cache

845[ERROR] SonarQube server [] can not be reached

846[INFO] ------------------------------------------------------------------------

847[INFO] BUILD FAILURE

848[INFO] ------------------------------------------------------------------------

849[INFO] Total time: 03:43 min

850[INFO] Finished at: 2020-11-03T11:51:45+08:00

851[INFO] ------------------------------------------------------------------------

852[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project test-micro001: Unable to execute SonarQube: Fail to get bootstrap index from server: Expected URL scheme ‘http’ or ‘https’ but no colon was found -> [Help 1]

853[ERROR]

854[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

855[ERROR] Re-run Maven using the -X switch to enable full debug logging.

856[ERROR]

857[ERROR] For more information about the errors and possible solutions, please read the following articles:

858[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

859ERROR: Job failed: command terminated with exit code 1

你上面这个是 sonarqube 地址有问题, 你部署 devops-service 时,配置中是否有配置 sonarqube 相关的属性?

请问这个在redis里面是哪个key ,删掉应该可以了。

默认在 db3 key为hoth:clinet field为sonar