【问题标题】:How do I configure bitbucket-pipelines.yml to use cmake or make on repo?如何配置 bitbucket-pipelines.yml 以在 repo 上使用 cmake 或 make?
【发布时间】:2020-05-05 19:30:54
【问题描述】:

我有一个 C++ 存储库,我已在提交时启动了一个管道。它目前处于“默认”状态,直到我让它工作,然后我会更具体地使用它。

以下是 YML。请注意,我已经注释掉了 Docker Hub 映像的构建和推送。我不想每次都构建一个新图像,并且顶部指定的图像已经处于我需要构建我的 repo 的状态。

这就是交易,我想将我的 C++ 代码(它是一个 CMAKE 项目)部署到该 docker 映像上并构建(制作)它。但我有这个错误:

+ make make: *** No targets specified and no makefile found. Stop.

我无法找到/理解有关此流程步骤的文档。如何针对这个 Docker 镜像创建我的代码库?

bitbucket-pipelines.yml:

# You can specify a custom docker image from Docker Hub as your build environment.
image: scottieg40/linux:buildEnv

pipelines:
default:
# - step:
    # services:
      # - docker
    # script: # Modify the commands below to build your repository.
      # Set $DOCKER_HUB_USERNAME and $DOCKER_HUB_PASSWORD as environment variables in repository settings
      # - export IMAGE_NAME=scottieg40/linux:$BITBUCKET_COMMIT

      # build the Docker image (this will use the Dockerfile in the root of the repo)
      # - docker build -t $IMAGE_NAME .
      # authenticate with the Docker Hub registry
      # - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
      # push the new Docker image to the Docker registry
      # - docker push $IMAGE_NAME
- step:
    script:
    - ls
    - cmake
    - make

【问题讨论】:

    标签: c++ docker bitbucket-pipelines


    【解决方案1】:

    我想通了。在意识到 YML 脚本部分中的所有内容都是 bash 之后,我的 -ls 显示我的代码已经准备好构建。

    反复试验让我明白了这一点:Stackoverflow answer that help

    答案是:

    - step: 
      script: 
      - cmake . 
      - cmake --build . --target all
    

    我希望这对任何人都有帮助。

    【讨论】:

      猜你喜欢
      • 2020-07-25
      • 2017-12-04
      • 1970-01-01
      • 1970-01-01
      • 2015-09-13
      • 2021-06-13
      • 2020-08-21
      • 1970-01-01
      • 2011-08-16
      相关资源
      最近更新 更多