我正在尝试使用命令“spring-boot:build-image”而不使用 Dockerfile 在 Gitlab-ci.yaml (管道)中构建 Spring Boot 应用程序的 docker 映像。该命令在终端开发工作站上运行良好。但是 Gitlab 的 CI/CD Pipeline 抛出了错误。如果有人可以提供帮助,请不胜感激。
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.6.4:build-image (default-cli) on project buildpackdemo: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:2.6.4:build-image failed: Connection to the Docker daemon at 'localhost' failed with error "[2] No such file or directory"; ensure the Docker daemon is running and accessible: com.sun.jna.LastErrorException: [2] No such file or directory -> [Help 1]
Run Code Online (Sandbox Code Playgroud)
maven-build:
image: maven:3-jdk-11
stage: build
script:
- "mvn spring-boot:build-image"
artifacts:
paths:
- target/*.jar
Run Code Online (Sandbox Code Playgroud) 大家好,我有一个快速应用程序,我正在使用 gitlab 来添加 Gitlab测试覆盖率可视化
这是我的 .gitlab-ci.yml
stages:
- test
- dockerize
- staging
- production
unit-tests:
stage: test
script:
- npm install
- npm run test
- npm run test-coverage
- cat coverage/cobertura-coverage.xml
- "echo 'Code coverage: 90.90'"
coverage: '/Code coverage: \d+\.\d+/'
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$CI_COMMIT_BRANCH == "release-v1"'
artifacts:
reports:
cobertura: coverage/cobertura-coverage.xml
tags:
- demo
dockerize-application:
stage: dockerize
script:
- echo "dockerizing application"
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"' …Run Code Online (Sandbox Code Playgroud) 构建容器可以通过绑定安装访问 docker 套接字。在管道中,以下内容将不起作用(导致空/project目录):
- docker run
--volume ${CI_PROJECT_DIR}:/project
image-name
Run Code Online (Sandbox Code Playgroud)
相反,我必须找到构建容器的容器名称并将其卷附加到我的新容器:
- |
docker_ps_output=$(docker ps --format "{{.Names}}" --filter "label=com.gitlab.gitlab-runner.job.id=${CI_JOB_ID}")
readarray -t gitlab_container_names <<<"$docker_ps_output"
for container_name in "${gitlab_container_names[@]}"
do
if [[ $container_name == *"build"* ]]; then
echo "Found build container $container_name"
export BUILD_CONTAINER_NAME=$container_name
break
else
echo "Ignoring ${container_name}. We are looking for the build container".
fi
done
if [ -z $BUILD_CONTAINER_NAME ]; then
echo "Could not find build container name"
exit 1
fi
- docker run
--volume-from=$BUILD_CONTAINER_NAME
image-name
Run Code Online (Sandbox Code Playgroud)
这是我的问题、Docker 的限制(容器无法将其卷之一安装到新容器上)还是 …
我很想使用语义发布来管理我们的语义版本控制。为此,我尝试将其集成到我们的 Gitlab CI 中。我遵循了一些示例并提供了将代码推送到存储库所需的环境变量。当语义释放开始运行时,它会抛出以下错误:
\n$ yarn semantic-release\nyarn run v1.22.10\nwarning package.json: No license field\n$ /Users/vision-ci/builds/dFCxNLEA/0/Christoph.Griehl/semantic-versioning/node_modules/.bin/semantic-release\n[11:28:47 AM] [semantic-release] \xe2\x80\xba \xe2\x84\xb9 Running semantic-release version 17.4.3\n[11:28:47 AM] [semantic-release] \xe2\x80\xba \xe2\x9c\x94 Loaded plugin "verifyConditions" from "@semantic-release/changelog"\n[11:28:47 AM] [semantic-release] \xe2\x80\xba \xe2\x9c\x94 Loaded plugin "verifyConditions" from "@semantic-release/git"\n[11:28:48 AM] [semantic-release] \xe2\x80\xba \xe2\x9c\x94 Loaded plugin "verifyConditions" from "@semantic-release/gitlab"\n[11:28:48 AM] [semantic-release] \xe2\x80\xba \xe2\x9c\x94 Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"\n[11:28:48 AM] [semantic-release] \xe2\x80\xba \xe2\x9c\x94 Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"\n[11:28:48 AM] [semantic-release] \xe2\x80\xba \xe2\x9c\x94 Loaded plugin "prepare" from "@semantic-release/changelog"\n[11:28:48 AM] [semantic-release] \xe2\x80\xba …Run Code Online (Sandbox Code Playgroud) Gitlab每次合并的时候都会进行一次合并操作,看起来很烦人。并且没有变基按钮选项。我该如何设置?
我尝试按照这些相当简单的说明将静态应用程序安全测试 (SAST) 集成到 Gitlab 上的 Android CI/CD 管道中。但是,我在使用CI lint 工具时遇到以下错误:
sast job: chosen stage does not exist; available stages are .pre, stg_build, stg_test, .post
Run Code Online (Sandbox Code Playgroud)
这是我的 .gitlab-ci.yml 的最简单版本,它重现了错误:
sast job: chosen stage does not exist; available stages are .pre, stg_build, stg_test, .post
Run Code Online (Sandbox Code Playgroud)
我在 GitLab 中发现了类似的错误:选择的阶段不存在,但这是关于尝试使用环境变量作为阶段名称。
如何防止此错误并让 SAST 处理 Gitlab 上的合并请求?