【问题标题】:drone ci publish generated latex pdf无人机 ci 发布生成的乳胶 pdf
【发布时间】:2018-12-28 15:30:45
【问题描述】:

实际上我正在使用 travis,但我想换成无人机。

对于所有 tex 文档,我使用带有容器的小型 Makefile 来生成我的 pdf 文件并将其部署到我的存储库中。

但由于我使用的是 gitea,所以我想设置与无人机的集成管道,但我不知道如何配置 .drone.yml 以在每个标签 als 版本上部署我的 pdf 文件。

实际上我正在使用以下.drone.yml,我很高兴地说,目前构建过程运行良好。

clone:
  git:
    image: plugins/git
    tags: true

pipeline:
  pdf:
    image: volkerraschek/docker-latex:latest
    pull: true
    commands:
    - make

这是我的Makefile

# Docker Image
IMAGE := volkerraschek/docker-latex:latest

# Input tex-file and output pdf-file
FILE := index
TEX_NAME := ${FILE}.tex
PDF_NAME := ${FILE}.pdf

latexmk:
    latexmk \
        -shell-escape \
        -synctex=1 \
        -interaction=nonstopmode \
        -file-line-error \
        -pdf ${TEX_NAME}

docker-latexmk:
    docker run \
        --rm \
        --user="$(shell id -u):$(shell id -g)" \
        --net="none" \
        --volume="${PWD}:/data" ${IMAGE} \
        make latexmk

当我推送一个新的 git 标签时,我的drone.yml 中缺少哪些标签和条件来将我的 index.pdf 部署为 gitea 中的发布?

沃尔克

【问题讨论】:

    标签: continuous-deployment drone gitea


    【解决方案1】:

    我的 gitea / 无人机对上有这个设置。这是我的.drone.yml的MWE:

    pipeline:
      build:
        image: tianon/latex
        commands:
          - pdflatex <filename.tex>
      gitea_release:
        image: plugins/gitea-release
        base_url: <gitea domain>
        secrets: [gitea_token]
        files: <filename.pdf>
        when:
          event: tag
    

    因此,我们不是在 Makefile 中设置 docker 构建,而是添加一个使用 docker 镜像和 Latex 的步骤,编译 pdf,并使用管道步骤来发布。

    您还必须设置您的无人机存储库以触发标签上的构建并设置要使用的 gitea API 令牌。要设置 API 令牌,您可以使用命令行界面:

    $ drone secret add <org/repo> --name gitea_token --value <token value> --image plugins/gitea-release
    

    您可以在 Web UI 的存储库设置中设置无人机存储库以触发构建。

    请注意,您可能还必须在您的 gitea 设置中允许*.pdf 附件,因为默认情况下它们是不允许的。在您的 gitea app.ini 中将其添加到附件部分:

    [attachment]
    ENABLED = true
    PATH = /data/gitea/attachments
    MAX_SIZE = 10
    ALLOWED_TYPES = */*
    

    【讨论】:

      【解决方案2】:

      除了 Gabe 的回答之外,如果您使用的是 NGINX 反向代理,您可能还必须允许在 nginx.conf 中上传更大的文件。 (这适用于所有文件类型,而不仅仅是 .pdf)

      server {
      
        [ ... ]
      
        location / {
          client_max_body_size 10M;      # add this line
          proxy_pass http://gitea:3000;
        }
      
      }
      

      这解决了我的问题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-01-18
        • 1970-01-01
        • 2011-02-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多