簡體   English   中英

linux 上的電子構建無法定期創建 rpm 包

[英]electron build on linux fails to create an rpm package periodically

使用 Electron 和 ElectronNet 我有一個 azure devops 管道設置,它將使用*-latest圖像構建在 linux、windows 和 osx 上構建應用程序。 在 linux 上,它被配置為同時輸出rpmdeb包,但是周期性的 rpm 包將無法使用此輸出構建。 當這種情況發生時,它通常會發生一段時間,然后在沒有任何干預的情況下停止發生。 我什至在第二天重新運行了失敗的工作,並且構建在 rpm 和 deb 構建中都完全成功。 deb 構建從未失敗。

真的在尋找關於如何讓它一直成功或出了什么問題的任何想法。 我的搜索功能並沒有真正找到任何有用的東西。

Package Electron App for Platform linux...
    • electron-builder  version=22.8.1 os=5.4.0-1026-azure
    • artifacts will be published if draft release exists  reason=CI detected
    • loaded configuration  file=/home/vsts/work/1/s/src/Prefix.App/obj/desktop/-encodedCommand/bin/electron-builder.json
    • description is missed in the package.json  appPackageFile=/home/vsts/work/1/s/src/Prefix.App/obj/desktop/-encodedCommand/package.json
    • packaging       platform=linux arch=x64 electron=9.2.0 appOutDir=/home/vsts/work/1/s/dist/linux-unpacked
    • downloading     url=https://github.com/electron/electron/releases/download/v9.2.0/electron-v9.2.0-linux-x64.zip size=73 MB parts=4
    • downloaded      url=https://github.com/electron/electron/releases/download/v9.2.0/electron-v9.2.0-linux-x64.zip duration=1.841s
    • building        target=deb arch=x64 file=/home/vsts/work/1/s/dist/stackify-prefix.deb
    • application Linux category is set to default "Utility"  reason=linux.category is not set and cannot map from macOS docs=https://www.electron.build/configuration/linux
    • downloading     url=https://github.com/electron-userland/electron-builder-binaries/releases/download/fpm-1.9.3-2.3.1-linux-x86_64/fpm-1.9.3-2.3.1-linux-x86_64.7z size=5.0 MB parts=1
    • downloaded      url=https://github.com/electron-userland/electron-builder-binaries/releases/download/fpm-1.9.3-2.3.1-linux-x86_64/fpm-1.9.3-2.3.1-linux-x86_64.7z duration=798ms
    • building        target=rpm arch=x64 file=/home/vsts/work/1/s/dist/stackify-prefix.rpm
    • application Linux category is set to default "Utility"  reason=linux.category is not set and cannot map from macOS docs=https://www.electron.build/configuration/linux
    ⨯ cannot execute  cause=exit status 1
                      out={:timestamp=>"2020-10-08T17:32:40.544179+0000", :message=>"Process failed: rpmbuild failed (exit code 1). Full command was:[\"rpmbuild\", \"-bb\", \"--target\", \"x86_64-unknown-linux\", \"--define\", \"buildroot /tmp/package-rpm-build-72bf79147c0f3c704c50ec33b5227ad320ace97152807fea175c575ab616/BUILD\", \"--define\", \"_topdir /tmp/package-rpm-build-72bf79147c0f3c704c50ec33b5227ad320ace97152807fea175c575ab616\", \"--define\", \"_sourcedir /tmp/package-rpm-build-72bf79147c0f3c704c50ec33b5227ad320ace97152807fea175c575ab616\", \"--define\", \"_rpmdir /tmp/package-rpm-build-72bf79147c0f3c704c50ec33b5227ad320ace97152807fea175c575ab616/RPMS\", \"--define\", \"_tmppath /tmp\", \"/tmp/package-rpm-build-72bf79147c0f3c704c50ec33b5227ad320ace97152807fea175c575ab616/SPECS/Prefix.spec\"]", :level=>:error}
                      command=/home/vsts/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86_64/fpm -s dir --force -t rpm -d libXScrnSaver --rpm-os linux --rpm-compression xzmt --architecture amd64 --name prefix --after-install /tmp/t-KD6Fyh/2-after-install --after-remove /tmp/t-KD6Fyh/3-after-remove --description '' --version 1.0.0 --package /home/vsts/work/1/s/dist/stackify-prefix.rpm --maintainer Stackify --url 'https://github.com/ElectronNET/Electron.NET#readme' --vendor Stackify --license MIT --iteration 0.8.25-rc.1+72 --name=Prefix --after-install=../../../../../build/linux/postinst --after-remove=../../../../../build/linux/postrm /home/vsts/work/1/s/dist/linux-unpacked/=/opt/Prefix /home/vsts/work/1/s/build/assets/Prefix_256.png=/usr/share/icons/hicolor/0x0/apps/Prefix.png /tmp/t-KD6Fyh/5-Prefix.desktop=/usr/share/applications/Prefix.desktop
                      workingDir=
 ... done

發生這種情況是因為還使用了 GitVersion 版本,並且電子構建器使用--iteration參數將FullSemVer變量傳遞給 fpm 命令。 當正在構建的分支具有語義上合適的標簽時,(例如:1.2.3)FullSemVer 看起來像1.2.3.0 但是,如果分支沒有這樣的標簽,它看起來像1.2.3-beta.1+1並且由於非法字符而導致 rpm 構建失敗。

為了解決這個問題,我將迭代參數硬編碼到electron.manifest.json

   "rpm": {
      "fpm": [
        "--iteration=1.0.0"
      ]
    }

然后在電子構建之前添加一個任務以在構建之前更新值。

- pwsh: |
   $variable = '--iteration=' + $env:GITVERSION_MAJORMINORPATCH
   (Get-Content -Path .\path\to\electron.manifest.json -Raw) -replace '--iteration=1.0.0', $variable | Set-Content -Path .\path\to\electron.manifest.json

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM