如何在GitLab CICD管道中使用docToolchain?

huangapple go评论49阅读模式
英文:

How can I use docToolchain with GitLab CICD pipeline?

问题

使用GitLab CICD管道使用docToolchain:

我想在我的GitLab项目中的CI管道中使用docToolchain(http://doctoolchain.org/docToolchain/v2.0.x/index.html)。我找到了这个示例项目(https://github.com/docToolchain/ci-cd-demo),并复制了.gitlab-ci.yml文件到我的项目中。

这是我的.gitlab-ci.yml文件:

image: doctoolchain/doctoolchain:v2.2.1
pages:
  stage: build
  script:
    - export DTC_HEADLESS=true
    - ./dtcw.bat generateSite #我在这里将命令从./dtcw更改为./dtcw.bat
    - mkdir public
    - cp -r build/microsite/output/. public/.
  artifacts:
    paths:
      - public/

但是当我运行管道时,管道失败并显示以下错误:

$ ./dtcw generateSite
/bin/bash: line 135: ./dtcw.bat: Permission denied

我首先在本地项目中安装了docToolchain,然后将其推送到我的GitLab项目中。该项目具有以下文件:dtcw.ps1、dtcw.bat、docToolchainconfig.groovy。示例项目还有一个名为dtcw的文件,但我在我的项目中没有。这就是为什么我将.gitlab-ci.yml文件更改为./dtcw.bat的原因,我还尝试了./dtcw.ps1。但在这两种情况下,都显示了"Permission denied"错误消息。我需要添加dtcw文件吗?这是什么文件?

谢谢您的帮助。

英文:

Using docToolchain with GitLab CICD pipeline:

I want to use the doctoolchain (http://doctoolchain.org/docToolchain/v2.0.x/index.html) in my GitLab Projekt in a ci pipeline. I found this example project (https://github.com/docToolchain/ci-cd-demo) and copied the .gitlab-ci.yml file in my project.

This is my .gitlab-ci.yml file:

image: doctoolchain/doctoolchain:v2.2.1
pages:
  stage: build
  script:
    - export DTC_HEADLESS=true
    - ./dtcw.bat generateSite #I changed here the command from ./dtcw to ./dtcw.bat
    - mkdir public
    - cp -r build/microsite/output/. public/.
  artifacts:
    paths:
      - public/

But when I am running the pipeline the pipeline failes and the following error is shown:

$ ./dtcw generateSite
/bin/bash: line 135: ./dtcw.bat: Permission denied

I installed the doctoolchain first in my local project and then pushed to my gitlab project. The project has the following files: dtcw.ps1, dtcw.bat, docToolchainconfig.groovy.
The example project has also a file dtcw which i do not have in my project. Thats why i changed the .gitlab-ci.yml file to ./dtcw.bat, I also tried ./dtcw.ps1. But in both cases the error messages: Permission denied is shown. Do I need to add the file dtcw? What file is this?

Thank you for your help

答案1

得分: 1

dtcw 是 doctoolchain 包装脚本。它负责获取并正确执行与您的构建相对应的 doctoolchain 二进制文件。您需要使用与您使用的映像相对应的正确版本(即 doctoolchain/doctoolchain:v2.2.1,该版本基于 Alpine Linux,因此您需要使用普通的 dtcw 文件 - dtcw.bat 文件将用于 Windows)。

要执行它,您可以选择以下方式之一:

  1. 在作业的脚本部分使用 chmod +x dtcw 使文件可执行。
  2. 显式调用 shell,如下所示:/bin/sh dtcw
英文:

dtcw is the doctoolchain wrapper script. It is responsible for retrieving and correctly executing the doctoolchain binaries for your build. You will need to use the correct one which corresponds to the image you're using (i.e. doctoolchain/doctoolchain:v2.2.1 which is based on Alpine Linux, therefore you will need to use the plain dtcw file - the dtcw.bat file would be used on windows).

To execute it you can either

  1. make the file executable using chmod +x dtcw in your job's script section
  2. call the shell explicitly like this: /bin/sh dtcw

huangapple
  • 本文由 发表于 2023年6月5日 15:36:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/76404362.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定