管道中未使用 Heroku APT 文件

Heroku APT file is not used in the Pipeline

多年来我一直在 Heroku 中使用 Apt 文件以在 Dyno 中使用 graphicmagic 包。

现在我想设置 Heroku Pipeline 测试,但是 Heroku 根本没有在测试构建中安装 apt 包。所以使用 graphicmagic 的测试失败了。

有什么方法可以在 Heroku Pipeline 测试的构建中安装 apt 包吗?

构建日志在这里:

应用程序构建日志(最后安装 Apt 包)

   -----> Building on the Heroku-20 stack
   -----> Using buildpacks:
          1. heroku/nodejs
          2. https://github.com/heroku/heroku-buildpack-apt
   -----> Node.js app detected
          
   -----> Creating runtime environment
          
          NPM_CONFIG_LOGLEVEL=error
          NODE_VERBOSE=false
          NODE_ENV=test
          NODE_MODULES_CACHE=true
          
   -----> Installing binaries
          engines.node (package.json):  10.23.*
          engines.npm (package.json):   6.14.8
          
          Resolving node version 10.23.*...
          Downloading and installing node 10.23.3...
          Bootstrapping npm 6.14.8 (replacing 6.14.11)...
          npm 6.14.8 installed
          
   -----> Restoring cache
          - node_modules
          
   -----> Installing dependencies
          Installing node modules
          
          > PayJsRouter@1.40.0 preinstall /tmp/build_6e87a3cd
          > npx npm-force-resolutions
          
          npx: installed 6 in 2.301s
          
          > core-js@2.6.11 postinstall /tmp/build_6e87a3cd/node_modules/core-js
          > node -e "try{require('./postinstall')}catch(e){}"
          
          
          > protobufjs@6.10.1 postinstall /tmp/build_6e87a3cd/node_modules/protobufjs
          > node scripts/postinstall
          
          
          > fsevents@1.2.13 install /tmp/build_6e87a3cd/node_modules/babel/node_modules/fsevents
          > node install.js
          
          
          Skipping 'fsevents' build as platform linux is not supported
          
          > fsevents@1.2.13 install /tmp/build_6e87a3cd/node_modules/steal-tools/node_modules/fsevents
          > node install.js
          
          
          Skipping 'fsevents' build as platform linux is not supported
          
          > fsevents@1.2.13 install /tmp/build_6e87a3cd/node_modules/nodemon/node_modules/fsevents
          > node install.js
          
          
          Skipping 'fsevents' build as platform linux is not supported
          
          > nodemon@1.19.4 postinstall /tmp/build_6e87a3cd/node_modules/nodemon
          > node bin/postinstall || exit 0
          
          Love nodemon? You can now support the project via the open collective:
           > https://opencollective.com/nodemon/donate
          
          
          > PayJsRouter@1.40.0 postinstall /tmp/build_6e87a3cd
          > npm run build-steal && npm run build-lodash && npm run build-prepare
          
          
          > PayJsRouter@1.40.0 build-steal /tmp/build_6e87a3cd
          > node ./scripts/buildSteal
          
          
          > PayJsRouter@1.40.0 build-lodash /tmp/build_6e87a3cd
          > node ./node_modules/lodash-cli/bin/lodash compat exports=umd modularize --development --output node_modules/lodash/
          
          Created 420 modules in 13.616 seconds.
          
          > PayJsRouter@1.40.0 build-prepare /tmp/build_6e87a3cd
          > mkdir -p ./public/dist/templates
          
          added 1681 packages in 66.104s
          
   -----> Build
          Running build
          
          > PayJsRouter@1.40.0 build /tmp/build_6e87a3cd
          > grunt steal-build
          
          ... MANY LINES OF BUILD OUTPUT
          
          Build was successful.
          
          Done.
          
   -----> Caching build
          - node_modules
          
   -----> Pruning devDependencies
          Skipping because NODE_ENV is 'test'
          
   -----> Cleanup
          Running heroku-cleanup
          
          > PayJsRouter@1.40.0 heroku-cleanup /tmp/build_6e87a3cd
          > npm prune --production
          
          added 458 packages from 863 contributors, removed 1041 packages and audited 643 packages in 28.358s
          
          38 packages are looking for funding
            run `npm fund` for details
          
          found 44 vulnerabilities (13 low, 11 moderate, 19 high, 1 critical)
            run `npm audit fix` to fix them, or `npm audit` for details
          
   -----> Build succeeded!
   -----> Apt app detected
   -----> Reusing cache
   -----> Updating apt caches
          Get:1 http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease [81.6 kB]
          Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
          Get:3 http://archive.ubuntu.com/ubuntu focal-security InRelease [109 kB]
          Get:4 http://apt.postgresql.org/pub/repos/apt focal-pgdg/main amd64 Packages [310 kB]
          Get:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
          Get:6 http://archive.ubuntu.com/ubuntu focal-security/main amd64 Packages [778 kB]
          Get:7 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 Packages [684 kB]
          Get:8 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1,194 kB]
          Get:9 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [952 kB]
          Fetched 4,222 kB in 1s (3,431 kB/s)
          Reading package lists...
   -----> Fetching .debs for graphicsmagick
          Reading package lists...
          Building dependency tree...
          The following additional packages will be installed:
            libgraphicsmagick-q16-3
          Suggested packages:
            graphicsmagick-dbg
          The following NEW packages will be installed:
            graphicsmagick libgraphicsmagick-q16-3
          0 upgraded, 2 newly installed, 0 to remove and 20 not upgraded.
          Need to get 0 B/1,794 kB of archives.
          After this operation, 8,566 kB of additional disk space will be used.
          Download complete and in download only mode
   -----> Fetching .debs for libpng-dev
          Reading package lists...
          Building dependency tree...
          0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 20 not upgraded.
          Need to get 0 B/175 kB of archives.
          After this operation, 0 B of additional disk space will be used.
          Download complete and in download only mode
   -----> Fetching .debs for zlib1g-dev
          Reading package lists...
          Building dependency tree...
          0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 20 not upgraded.
          Need to get 0 B/155 kB of archives.
          After this operation, 0 B of additional disk space will be used.
          Download complete and in download only mode
   -----> Installing graphicsmagick_1.4+really1.3.35-1_amd64.deb
   -----> Installing libgraphicsmagick-q16-3_1.4+really1.3.35-1_amd64.deb
   -----> Installing libpng-dev_1.6.37-2_amd64.deb
   -----> Installing zlib1g-dev_1%3a1.2.11.dfsg-2ubuntu1.2_amd64.deb
   -----> Writing profile script
   -----> Rewrite package-config files
   -----> Discovering process types
          Procfile declares types -> web, worker
   -----> Compressing...
          Done: 82.1M
   -----> Launching...
          Released v823
          https://xyz.herokuapp.com/ deployed to Heroku

管道测试构建日志(不存在安装 Apt 包)

   -----> Building on the Heroku-20 stack
   -----> Auto detecting buildpacks...
          buildpack detected
   -----> Node.js app detected
          
   -----> Creating runtime environment
          
          NPM_CONFIG_PRODUCTION=false
          NPM_CONFIG_LOGLEVEL=error
          NODE_VERBOSE=false
          NODE_ENV=testing
          NODE_MODULES_CACHE=true
          
   -----> Installing binaries
          engines.node (package.json):  10.23.*
          engines.npm (package.json):   6.14.8
          
          Resolving node version 10.23.*...
          Downloading and installing node 10.23.3...
          Bootstrapping npm 6.14.8 (replacing 6.14.11)...
          npm 6.14.8 installed
          
   -----> Restoring cache
          - node_modules
          
   -----> Installing dependencies
          Installing node modules
   .       
          > PayJsRouter@1.40.0 preinstall /app
          > npx npm-force-resolutions
          
          npx: installed 6 in 2.844s
          
          > core-js@2.6.11 postinstall /app/node_modules/core-js
          > node -e "try{require('./postinstall')}catch(e){}"
          
          
          > protobufjs@6.10.1 postinstall /app/node_modules/protobufjs
          > node scripts/postinstall
          
          
          > fsevents@1.2.13 install /app/node_modules/babel/node_modules/fsevents
          > node install.js
          
          
          Skipping 'fsevents' build as platform linux is not supported
          
          > fsevents@1.2.13 install /app/node_modules/steal-tools/node_modules/fsevents
          > node install.js
          
          
          Skipping 'fsevents' build as platform linux is not supported
          
          > fsevents@1.2.13 install /app/node_modules/nodemon/node_modules/fsevents
          > node install.js
          
          
          Skipping 'fsevents' build as platform linux is not supported
          
          > nodemon@1.19.4 postinstall /app/node_modules/nodemon
          > node bin/postinstall || exit 0
          
          Love nodemon? You can now support the project via the open collective:
           > https://opencollective.com/nodemon/donate
          
          
          > PayJsRouter@1.40.0 postinstall /app
          > npm run build-steal && npm run build-lodash && npm run build-prepare
          
          
          > PayJsRouter@1.40.0 build-steal /app
          > node ./scripts/buildSteal
          
          
          > PayJsRouter@1.40.0 build-lodash /app
          > node ./node_modules/lodash-cli/bin/lodash compat exports=umd modularize --development --output node_modules/lodash/
          
          Created 420 modules in 17.29 seconds.
          
          > PayJsRouter@1.40.0 build-prepare /app
          > mkdir -p ./public/dist/templates
          
          added 1738 packages in 85.344s
          
   -----> Build
          Running build
          
          > PayJsRouter@1.40.0 build /app
          > grunt steal-build
          
          ... MANY LINES OF BUILD OUTPUT

          Build was successful.
          
          Done.
          
   -----> Caching build
          - node_modules
          
   -----> Pruning devDependencies
          Skipping because NODE_ENV is not 'production'
          
   -----> Build succeeded!
   -----> No test-setup command provided. Skipping.

正在自动检测。无法识别您的 Apt buildpack:

   -----> Auto detecting buildpacks...
          buildpack detected
   -----> Node.js app detected

对于您的应用程序,使用 heroku buildpacks:set 设置构建包就足够了。
对于管道,您需要 app.json 和您的构建包:

{
  "buildpacks": [
    {
      "url": "heroku/nodejs"
    },
    {
      "url": "https://github.com/heroku/heroku-buildpack-apt"
    }
  ]
}

要阅读的资源:

https://devcenter.heroku.com/articles/heroku-ci and https://devcenter.heroku.com/articles/app-json-schema#buildpacks