【问题标题】:Bitbucket Pipeline: Store .pdf artifact after pdfLaTeXBitbucket Pipeline:在 pdfLaTeX 之后存储 .pdf 工件
【发布时间】:2020-04-13 01:47:35
【问题描述】:

我尝试将 Bitbucket 的管道功能用于 LaTeX git 存储库。我只想构建我的 .tex 文件并将 .pdf 工件存储到存储库下载文件夹。我在here 找到了一些有用的指南,在SO 找到了类似的答案。

这是我的 pipeline.yml

options:
  docker: true

image: kaspersoerensen/latex-docker

pipelines:
  default:
    - step:
        script:
          - pdflatex --shell-escape TEST.tex # Build once
          #- bibtex TEST # Build bibtex
          - pdflatex -shell-escape TEST.tex # Build again
          - pdflatex -shell-escape TEST.tex # And last time
          - curl -X POST --user "${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"TEST.pdf"

为了设置curl,我使用了来自 Atlassian 的官方guideline

一切似乎都很好,构建成功,没有任何错误。

问题:我的存储库下载文件夹不包含任何工件。

编辑

构建输出:

Build setup
4s
pdflatex --shell-escape TEST.tex
1s
pdflatex -shell-escape TEST.tex
1s
pdflatex -shell-escape TEST.tex
1s
curl -X POST --user "${BB_AUTH_STRING}" "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"TEST.pdf"
<1s
Build teardown

Docker 输出:

time="2019-12-20T14:56:23.511294820Z" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"
time="2019-12-20T14:56:23.511451739Z" level=warning msg="[!] DON'T BIND ON ANY IP ADDRESS WITHOUT setting --tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING [!]"
time="2019-12-20T14:56:23.544238141Z" level=warning msg="failed to load plugin io.containerd.snapshotter.v1.btrfs" error="path /var/lib/docker/165536.165536/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter" 
time="2019-12-20T14:56:23.562813661Z" level=warning msg="failed to load plugin io.containerd.snapshotter.v1.aufs" error="modprobe aufs failed: "ip: can't find device 'aufs'\nmodprobe: can't change directory to '/lib/modules': No such file or directory\n": exit status 1" 
time="2019-12-20T14:56:23.563473734Z" level=warning msg="failed to load plugin io.containerd.snapshotter.v1.zfs" error="path /var/lib/docker/165536.165536/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter" 
time="2019-12-20T14:56:23.563610398Z" level=warning msg="could not use snapshotter btrfs in metadata plugin" error="path /var/lib/docker/165536.165536/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter" 
time="2019-12-20T14:56:23.563626718Z" level=warning msg="could not use snapshotter aufs in metadata plugin" error="modprobe aufs failed: "ip: can't find device 'aufs'\nmodprobe: can't change directory to '/lib/modules': No such file or directory\n": exit status 1" 
time="2019-12-20T14:56:23.563636848Z" level=warning msg="could not use snapshotter zfs in metadata plugin" error="path /var/lib/docker/165536.165536/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter" 
time="2019-12-20T14:56:23.695604523Z" level=warning msg="Running modprobe bridge br_netfilter failed with message: ip: can't find device 'bridge'\nbridge                167936  1 br_netfilter\nstp                    16384  1 bridge\nllc                    16384  2 bridge,stp\nip: can't find device 'br_netfilter'\nbr_netfilter           24576  0 \nbridge                167936  1 br_netfilter\nmodprobe: can't change directory to '/lib/modules': No such file or directory\n, error: exit status 1"
time="2019-12-20T14:56:23.706219675Z" level=warning msg="Running modprobe nf_nat failed with message: `ip: can't find device 'nf_nat'\nnf_nat_ipv6            16384  1 ip6table_nat\nnf_nat_ipv4            16384  2 ipt_MASQUERADE,iptable_nat\nnf_nat                 32768  3 nf_nat_ipv6,xt_nat,nf_nat_ipv4\nnf_conntrack          139264  8 nf_nat_ipv6,nf_conntrack_netlink,xt_nat,xt_conntrack,ip_vs,ipt_MASQUERADE,nf_nat_ipv4,nf_nat\nlibcrc32c              16384  3 ip_vs,nf_nat,nf_conntrack\nmodprobe: can't change directory to '/lib/modules': No such file or directory`, error: exit status 1"
time="2019-12-20T14:56:23.716309547Z" level=warning msg="Running modprobe xt_conntrack failed with message: `ip: can't find device 'xt_conntrack'\nxt_conntrack           16384 42 \nnf_conntrack          139264  8 nf_nat_ipv6,nf_conntrack_netlink,xt_nat,xt_conntrack,ip_vs,ipt_MASQUERADE,nf_nat_ipv4,nf_nat\nmodprobe: can't change directory to '/lib/modules': No such file or directory`, error: exit status 1"

【问题讨论】:

    标签: continuous-integration bitbucket bitbucket-pipelines


    【解决方案1】:

    我建议使用bitbucket-upload-file 管道而不是使用 curl 发送 API 请求来上传 Bitbucket 中的文件。如果出现问题,管道将提供更好的反馈。这是一个示例:

     options:
       docker: true
    
     image: kaspersoerensen/latex-docker
    
     pipelines:
       default:
         - step:
             name: Build the pdf
             script:
               - pdflatex --shell-escape TEST.tex
             artifacts:
               - TEST.pdf
         - step:
             name: Upload
             script:
               - pipe: atlassian/bitbucket-upload-file:0.1.2
                 variables:
                   BITBUCKET_USERNAME: $BITBUCKET_USERNAME
                   BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD
                   FILENAME: 'TEST.pdf'
    

    请注意,我将构建和上传的步骤分开,这被认为是构建管道的好方法。

    【讨论】:

      【解决方案2】:

      感谢所有花时间回答我问题的人。

      现在我找到了这样一个可行的解决方案:

      1. 一般来说遵循这个写得很好的guide
      2. 请务必使用两因素身份验证!
      3. BB_AUTH_STRING 必须是 YOUR_USERNAME:YOUR_APP_PASSWORD(不要使用应用密码标签!这是我的错)
      4. 使用以下 .yml 代码。

      .

      image: dme26/latex-builder:latest
      pipelines: 
        default:
        - step:
          script:  
          - pdflatex TEST.tex; pdflatex TEST.tex
          - ls
          - curl -X POST "https://${BB_AUTH_STRING}@api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"TEST.pdf"
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-03-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-03-22
        • 1970-01-01
        相关资源
        最近更新 更多