首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >GitLab管道未执行docker映像的脚本部分中的命令

问GitLab管道未执行docker映像的脚本部分中的命令
EN

Stack Overflow用户
提问于 2020-09-10 00:32:01
回答 1查看 801关注 0票数 0

我尝试在.gitlab-ci.yml中运行以下作业/阶段

代码语言:javascript
复制
contract-tagging:
  image: pactfoundation/pact-cli:latest
  stage: contract-tag
  tags:
    - docker
  script:
    - broker create-version-tag --pacticipant service-name --version $CI_COMMIT_SHORT_SHA --tag production --broker-base-url http://localhost:9090

管道未执行脚本部分中的'broker‘命令。但是,阶段正在完成,状态为成功。我在日志中看到以下消息

代码语言:javascript
复制
Running before_script and script
00:01
 Could not find command "sh".
Running after_script
00:02
 Could not find command "sh".

下面是完整的日志。

代码语言:javascript
复制
Running with gitlab-runner 13.0.2 (772163a2)
   on csl-runner GwZBZUWZ
Preparing the "docker+machine" executor
00:08
 Using Docker executor with image pactfoundation/pact-cli:latest ...
 Pulling docker image pactfoundation/pact-cli:latest ...
 Using docker image sha256:d4188166dd9c3a1652ce9c63759f194f410322c6e9709df1c15efd07eba4297c for pactfoundation/pact-cli:latest ...
Preparing environment
00:02
 Running on runner-gwzbzuwz-project-7336-concurrent-0 via runner-gwzbzuwz-gitlab-nonprod-runner-agent-1599663074-8439e49e...
Getting source from Git repository
00:02
 $ git config --global http.sslVerify false; git config --global http.proxy http://proxy.local.xxxcloud.uk:yyyy; git config --global https.proxy http://proxy.local.xxxcloud.uk:yyyy;
 Fetching changes with git depth set to 50...
 Reinitialized existing Git repository in /builds/repo-name/.git/
 From https://gitlab.nonprod.xxxcloud.uk/repo-name
  * [new ref]         refs/pipelines/xxxx -> refs/pipelines/xxxx
 Checking out bb9d023e as cdc-pact-poc...
 warning: unable to rmdir 'bash-scripts': Directory not empty
 Removing .m2/repository/
 Removing bash-scripts/
 Removing target/
 Updating/initializing submodules...
Restoring cache
00:04
 Checking cache for default-1...
 No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted.
 Successfully extracted cache
Downloading artifacts
00:01
 Downloading artifacts for compile (3768666)...
 Downloading artifacts from coordinator... ok        id=3768666 responseStatus=200 OK token=Z3G8Ws6y
Running before_script and script
00:01
 Could not find command "sh".
Running after_script
00:02
 Could not find command "sh".
Saving cache
00:01
 Creating cache default-1...
 .m2/repository/: found 5176 matching files
 Archive is up to date!
 Created cache
Uploading artifacts for successful job
00:02
 Job succeeded

我在网上找不到任何解决方案。

请帮帮忙。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-09-14 19:34:54

您选择用来运行ci-stage的docker镜像使用了一个入口点,该入口点不允许使用CMD运行脚本,正如Docker executor from gitlab所期望的那样。您必须构建自己的映像,或者覆盖.gitlab-ci.yml文件中的入口点

代码语言:javascript
复制
contract-tagging:
  image:
    name: pactfoundation/pact-cli:latest
    entrypoint: ["/bin/sh"]
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63815858

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档