Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error if BP_NGINX_VERSION is set and no "workspace/buildpack.yml" is present #539

Open
MischaFrank opened this issue Apr 28, 2023 · 1 comment

Comments

@MischaFrank
Copy link

Expected Behavior

Nginx version can be set via env variable (as recommended in README) without buildpack.yml in project root.

Current Behavior

Error if used with pack and --env BP_NGINX_VERSION=1.22.* without buildpack.yml:

===> DETECTING
======== Output: paketo-buildpacks/nginx@0.13.2 ========
parsing version failed: open /workspace/buildpack.yml: no such file or directory
err: paketo-buildpacks/nginx@0.13.2 (1)

Steps to Reproduce

  1. Create empty project with nginx.conf
  2. Run pack build nginx-test-app:test --env BP_NGINX_VERSION=1.22.1

Possible Solution

Don't try to parse buildpack.yml if BP_NGINX_VERSION is set.
Run detect.go:62-92 in else block.

@Waterstraal
Copy link

Running into this issue as well.

Command:

pack build angular-test-app -b paketo-buildpacks/web-servers `
  --env "BP_WEB_SERVER_ROOT=dist/angular-test-app" `
  --env "BP_WEB_SERVER_ENABLE_PUSH_STATE=true" `
  --env "BP_NGINX_VERSION=1.21.0" `
  --env "BP_NODE_VERSION=18.16.1" `
  --env "BP_INCLUDE_FILES=dist/*:nginx.conf"

Output:

base: Pulling from paketobuildpacks/builder
Digest: sha256:17ea21162ba8c7717d3ead3ee3836a368aced7f02f2e59658e52029bd6d149e7
Status: Image is up to date for paketobuildpacks/builder:base
base-cnb: Pulling from paketobuildpacks/run
Digest: sha256:1af9935d8987fd52b2266d288200c9482d1dd5529860bbf5bc2d248de1cb1a38
Status: Image is up to date for paketobuildpacks/run:base-cnb
0.16.5: Pulling from buildpacksio/lifecycle
Digest: sha256:6328c7b662c452111e39f1f5d5d097292d07c218ba4a873f0ad0c2cb67710869
Status: Image is up to date for buildpacksio/lifecycle:0.16.5
===> ANALYZING
[analyzer] Restoring data for SBOM from previous image
===> DETECTING
[detector] ======== Output: paketo-buildpacks/yarn-install@1.1.3 ========
[detector] no 'yarn.lock' file found in the project path /workspace
[detector] ======== Output: paketo-buildpacks/nginx@0.15.3 ========
[detector] parsing version failed: open /workspace/buildpack.yml: no such file or directory
[detector] ======== Output: paketo-buildpacks/procfile@5.6.4 ========
[detector] SKIPPED: No procfile found from either source path or binding.
[detector] ======== Output: paketo-buildpacks/image-labels@4.5.2 ========
[detector]   Build Configuration:
[detector]     $BP_IMAGE_LABELS       arbitrary image labels
[detector]     $BP_OCI_AUTHORS        the org.opencontainers.image.authors image label
[detector]     $BP_OCI_CREATED        the org.opencontainers.image.created image label
[detector]     $BP_OCI_DESCRIPTION    the org.opencontainers.image.description image label
[detector]     $BP_OCI_DOCUMENTATION  the org.opencontainers.image.documentation image label
[detector]     $BP_OCI_LICENSES       the org.opencontainers.image.licenses image label
[detector]     $BP_OCI_REF_NAME       the org.opencontainers.image.ref.name image label
[detector]     $BP_OCI_REVISION       the org.opencontainers.image.revision image label
[detector]     $BP_OCI_SOURCE         the org.opencontainers.image.source image label
[detector]     $BP_OCI_TITLE          the org.opencontainers.image.title image label
[detector]     $BP_OCI_URL            the org.opencontainers.image.url image label
[detector]     $BP_OCI_VENDOR         the org.opencontainers.image.vendor image label
[detector]     $BP_OCI_VERSION        the org.opencontainers.image.version image label
[detector] SKIPPED: No supported environment variables were set
[detector] ======== Results ========
[detector] pass: paketo-buildpacks/ca-certificates@3.6.3
[detector] pass: paketo-buildpacks/watchexec@2.8.3
[detector] pass: paketo-buildpacks/node-engine@1.6.0
[detector] pass: paketo-buildpacks/yarn@1.1.9
[detector] fail: paketo-buildpacks/yarn-install@1.1.3
[detector] pass: paketo-buildpacks/node-run-script@1.0.10
[detector] err:  paketo-buildpacks/nginx@0.15.3 (1)
[detector] skip: paketo-buildpacks/procfile@5.6.4
[detector] skip: paketo-buildpacks/environment-variables@4.5.3
[detector] skip: paketo-buildpacks/image-labels@4.5.2
[detector] pass: paketo-buildpacks/source-removal@0.2.0
[detector] ======== Output: paketo-buildpacks/nginx@0.15.3 ========
[detector] parsing version failed: open /workspace/buildpack.yml: no such file or directory
[detector] ======== Output: paketo-buildpacks/procfile@5.6.4 ========
[detector] SKIPPED: No procfile found from either source path or binding.
[detector] ======== Output: paketo-buildpacks/image-labels@4.5.2 ========
[detector]   Build Configuration:
[detector]     $BP_IMAGE_LABELS       arbitrary image labels
[detector]     $BP_OCI_AUTHORS        the org.opencontainers.image.authors image label
[detector]     $BP_OCI_CREATED        the org.opencontainers.image.created image label
[detector]     $BP_OCI_DESCRIPTION    the org.opencontainers.image.description image label
[detector]     $BP_OCI_DOCUMENTATION  the org.opencontainers.image.documentation image label
[detector]     $BP_OCI_LICENSES       the org.opencontainers.image.licenses image label
[detector]     $BP_OCI_REF_NAME       the org.opencontainers.image.ref.name image label
[detector]     $BP_OCI_REVISION       the org.opencontainers.image.revision image label
[detector]     $BP_OCI_SOURCE         the org.opencontainers.image.source image label
[detector]     $BP_OCI_TITLE          the org.opencontainers.image.title image label
[detector]     $BP_OCI_URL            the org.opencontainers.image.url image label
[detector]     $BP_OCI_VENDOR         the org.opencontainers.image.vendor image label
[detector]     $BP_OCI_VERSION        the org.opencontainers.image.version image label
[detector] SKIPPED: No supported environment variables were set
[detector] ======== Results ========
[detector] pass: paketo-buildpacks/ca-certificates@3.6.3
[detector] pass: paketo-buildpacks/watchexec@2.8.3
[detector] pass: paketo-buildpacks/node-engine@1.6.0
[detector] pass: paketo-buildpacks/npm-install@1.1.4
[detector] pass: paketo-buildpacks/node-run-script@1.0.10
[detector] err:  paketo-buildpacks/nginx@0.15.3 (1)
[detector] skip: paketo-buildpacks/procfile@5.6.4
[detector] skip: paketo-buildpacks/environment-variables@4.5.3
[detector] skip: paketo-buildpacks/image-labels@4.5.2
[detector] pass: paketo-buildpacks/source-removal@0.2.0
[detector] ======== Output: paketo-buildpacks/yarn-install@1.1.3 ========
[detector] no 'yarn.lock' file found in the project path /workspace
[detector] ======== Output: paketo-buildpacks/procfile@5.6.4 ========
[detector] SKIPPED: No procfile found from either source path or binding.
[detector] ======== Output: paketo-buildpacks/image-labels@4.5.2 ========
[detector]   Build Configuration:
[detector]     $BP_IMAGE_LABELS       arbitrary image labels
[detector]     $BP_OCI_AUTHORS        the org.opencontainers.image.authors image label
[detector]     $BP_OCI_CREATED        the org.opencontainers.image.created image label
[detector]     $BP_OCI_DESCRIPTION    the org.opencontainers.image.description image label
[detector]     $BP_OCI_DOCUMENTATION  the org.opencontainers.image.documentation image label
[detector]     $BP_OCI_LICENSES       the org.opencontainers.image.licenses image label
[detector]     $BP_OCI_REF_NAME       the org.opencontainers.image.ref.name image label
[detector]     $BP_OCI_REVISION       the org.opencontainers.image.revision image label
[detector]     $BP_OCI_SOURCE         the org.opencontainers.image.source image label
[detector]     $BP_OCI_TITLE          the org.opencontainers.image.title image label
[detector]     $BP_OCI_URL            the org.opencontainers.image.url image label
[detector]     $BP_OCI_VENDOR         the org.opencontainers.image.vendor image label
[detector]     $BP_OCI_VERSION        the org.opencontainers.image.version image label
[detector] SKIPPED: No supported environment variables were set
[detector] ======== Results ========
[detector] pass: paketo-buildpacks/ca-certificates@3.6.3
[detector] pass: paketo-buildpacks/watchexec@2.8.3
[detector] pass: paketo-buildpacks/node-engine@1.6.0
[detector] pass: paketo-buildpacks/yarn@1.1.9
[detector] fail: paketo-buildpacks/yarn-install@1.1.3
[detector] pass: paketo-buildpacks/node-run-script@1.0.10
[detector] pass: paketo-buildpacks/httpd@0.7.11
[detector] skip: paketo-buildpacks/procfile@5.6.4
[detector] skip: paketo-buildpacks/environment-variables@4.5.3
[detector] skip: paketo-buildpacks/image-labels@4.5.2
[detector] pass: paketo-buildpacks/source-removal@0.2.0
[detector] ======== Output: paketo-buildpacks/procfile@5.6.4 ========
[detector] SKIPPED: No procfile found from either source path or binding.
[detector] ======== Output: paketo-buildpacks/image-labels@4.5.2 ========
[detector]   Build Configuration:
[detector]     $BP_IMAGE_LABELS       arbitrary image labels
[detector]     $BP_OCI_AUTHORS        the org.opencontainers.image.authors image label
[detector]     $BP_OCI_CREATED        the org.opencontainers.image.created image label
[detector]     $BP_OCI_DESCRIPTION    the org.opencontainers.image.description image label
[detector]     $BP_OCI_DOCUMENTATION  the org.opencontainers.image.documentation image label
[detector]     $BP_OCI_LICENSES       the org.opencontainers.image.licenses image label
[detector]     $BP_OCI_REF_NAME       the org.opencontainers.image.ref.name image label
[detector]     $BP_OCI_REVISION       the org.opencontainers.image.revision image label
[detector]     $BP_OCI_SOURCE         the org.opencontainers.image.source image label
[detector]     $BP_OCI_TITLE          the org.opencontainers.image.title image label
[detector]     $BP_OCI_URL            the org.opencontainers.image.url image label
[detector]     $BP_OCI_VENDOR         the org.opencontainers.image.vendor image label
[detector]     $BP_OCI_VERSION        the org.opencontainers.image.version image label
[detector] SKIPPED: No supported environment variables were set
[detector] ======== Results ========
[detector] pass: paketo-buildpacks/ca-certificates@3.6.3
[detector] pass: paketo-buildpacks/watchexec@2.8.3
[detector] pass: paketo-buildpacks/node-engine@1.6.0
[detector] pass: paketo-buildpacks/npm-install@1.1.4
[detector] pass: paketo-buildpacks/node-run-script@1.0.10
[detector] pass: paketo-buildpacks/httpd@0.7.11
[detector] skip: paketo-buildpacks/procfile@5.6.4
[detector] skip: paketo-buildpacks/environment-variables@4.5.3
[detector] skip: paketo-buildpacks/image-labels@4.5.2
[detector] pass: paketo-buildpacks/source-removal@0.2.0
[detector] Resolving plan... (try #1)
[detector] fail: paketo-buildpacks/npm-install@1.1.4 requires npm
[detector] Resolving plan... (try #2)
[detector] fail: paketo-buildpacks/httpd@0.7.11 provides unused httpd
[detector] Resolving plan... (try #3)
[detector] fail: paketo-buildpacks/npm-install@1.1.4 requires npm
[detector] Resolving plan... (try #4)
[detector] skip: paketo-buildpacks/watchexec@2.8.3 provides unused watchexec
[detector] fail: paketo-buildpacks/httpd@0.7.11 provides unused httpd
[detector] ======== Output: paketo-buildpacks/nginx@0.15.3 ========
[detector] parsing version failed: open /workspace/buildpack.yml: no such file or directory
[detector] ======== Output: paketo-buildpacks/procfile@5.6.4 ========
[detector] SKIPPED: No procfile found from either source path or binding.
[detector] ======== Output: paketo-buildpacks/image-labels@4.5.2 ========
[detector]   Build Configuration:
[detector]     $BP_IMAGE_LABELS       arbitrary image labels
[detector]     $BP_OCI_AUTHORS        the org.opencontainers.image.authors image label
[detector]     $BP_OCI_CREATED        the org.opencontainers.image.created image label
[detector]     $BP_OCI_DESCRIPTION    the org.opencontainers.image.description image label
[detector]     $BP_OCI_DOCUMENTATION  the org.opencontainers.image.documentation image label
[detector]     $BP_OCI_LICENSES       the org.opencontainers.image.licenses image label
[detector]     $BP_OCI_REF_NAME       the org.opencontainers.image.ref.name image label
[detector]     $BP_OCI_REVISION       the org.opencontainers.image.revision image label
[detector]     $BP_OCI_SOURCE         the org.opencontainers.image.source image label
[detector]     $BP_OCI_TITLE          the org.opencontainers.image.title image label
[detector]     $BP_OCI_URL            the org.opencontainers.image.url image label
[detector]     $BP_OCI_VENDOR         the org.opencontainers.image.vendor image label
[detector]     $BP_OCI_VERSION        the org.opencontainers.image.version image label
[detector] SKIPPED: No supported environment variables were set
[detector] ======== Results ========
[detector] pass: paketo-buildpacks/ca-certificates@3.6.3
[detector] pass: paketo-buildpacks/watchexec@2.8.3
[detector] err:  paketo-buildpacks/nginx@0.15.3 (1)
[detector] skip: paketo-buildpacks/procfile@5.6.4
[detector] skip: paketo-buildpacks/environment-variables@4.5.3
[detector] skip: paketo-buildpacks/image-labels@4.5.2
[detector] pass: paketo-buildpacks/source-removal@0.2.0
[detector] ======== Output: paketo-buildpacks/procfile@5.6.4 ========
[detector] SKIPPED: No procfile found from either source path or binding.
[detector] ======== Output: paketo-buildpacks/image-labels@4.5.2 ========
[detector]   Build Configuration:
[detector]     $BP_IMAGE_LABELS       arbitrary image labels
[detector]     $BP_OCI_AUTHORS        the org.opencontainers.image.authors image label
[detector]     $BP_OCI_CREATED        the org.opencontainers.image.created image label
[detector]     $BP_OCI_DESCRIPTION    the org.opencontainers.image.description image label
[detector]     $BP_OCI_DOCUMENTATION  the org.opencontainers.image.documentation image label
[detector]     $BP_OCI_LICENSES       the org.opencontainers.image.licenses image label
[detector]     $BP_OCI_REF_NAME       the org.opencontainers.image.ref.name image label
[detector]     $BP_OCI_REVISION       the org.opencontainers.image.revision image label
[detector]     $BP_OCI_SOURCE         the org.opencontainers.image.source image label
[detector]     $BP_OCI_TITLE          the org.opencontainers.image.title image label
[detector]     $BP_OCI_URL            the org.opencontainers.image.url image label
[detector]     $BP_OCI_VENDOR         the org.opencontainers.image.vendor image label
[detector]     $BP_OCI_VERSION        the org.opencontainers.image.version image label
[detector] SKIPPED: No supported environment variables were set
[detector] ======== Results ========
[detector] pass: paketo-buildpacks/ca-certificates@3.6.3
[detector] pass: paketo-buildpacks/watchexec@2.8.3
[detector] pass: paketo-buildpacks/httpd@0.7.11
[detector] skip: paketo-buildpacks/procfile@5.6.4
[detector] skip: paketo-buildpacks/environment-variables@4.5.3
[detector] skip: paketo-buildpacks/image-labels@4.5.2
[detector] pass: paketo-buildpacks/source-removal@0.2.0
[detector] Resolving plan... (try #1)
[detector] fail: paketo-buildpacks/httpd@0.7.11 provides unused httpd
[detector] Resolving plan... (try #2)
[detector] skip: paketo-buildpacks/watchexec@2.8.3 provides unused watchexec
[detector] fail: paketo-buildpacks/httpd@0.7.11 provides unused httpd
[detector] ERROR: No buildpack groups passed detection.
[detector] ERROR: failed to detect: buildpack(s) failed with err
ERROR: failed to build: executing lifecycle: failed with status code: 21

When I remove BP_NGINX_VERSION it works without errors.

Command:

pack build angular-test-app -b paketo-buildpacks/web-servers `
  --env "BP_WEB_SERVER_ROOT=dist/angular-test-app" `
  --env "BP_WEB_SERVER_ENABLE_PUSH_STATE=true" `
  --env "BP_NODE_VERSION=18.16.1" `
  --env "BP_INCLUDE_FILES=dist/*:nginx.conf"

Output:

base: Pulling from paketobuildpacks/builder
Digest: sha256:17ea21162ba8c7717d3ead3ee3836a368aced7f02f2e59658e52029bd6d149e7
Status: Image is up to date for paketobuildpacks/builder:base
base-cnb: Pulling from paketobuildpacks/run
Digest: sha256:1af9935d8987fd52b2266d288200c9482d1dd5529860bbf5bc2d248de1cb1a38
Status: Image is up to date for paketobuildpacks/run:base-cnb
0.16.5: Pulling from buildpacksio/lifecycle
Digest: sha256:6328c7b662c452111e39f1f5d5d097292d07c218ba4a873f0ad0c2cb67710869
Status: Image is up to date for buildpacksio/lifecycle:0.16.5
===> ANALYZING
[analyzer] Restoring data for SBOM from previous image
===> DETECTING
[detector] 6 of 10 buildpacks participating
[detector] paketo-buildpacks/ca-certificates 3.6.3
[detector] paketo-buildpacks/node-engine     1.6.0
[detector] paketo-buildpacks/npm-install     1.1.4
[detector] paketo-buildpacks/node-run-script 1.0.10
[detector] paketo-buildpacks/nginx           0.15.3
[detector] paketo-buildpacks/source-removal  0.2.0
===> RESTORING
[restorer] Restoring metadata for "paketo-buildpacks/ca-certificates:helper" from app image
[restorer] Restoring metadata for "paketo-buildpacks/node-engine:node" from cache
[restorer] Restoring metadata for "paketo-buildpacks/npm-install:build-modules" from cache
[restorer] Restoring metadata for "paketo-buildpacks/nginx:nginx" from app image
[restorer] Restoring data for "paketo-buildpacks/node-engine:node" from cache
[restorer] Restoring data for "paketo-buildpacks/npm-install:build-modules" from cache
[restorer] Restoring data for SBOM from cache
===> BUILDING
[builder] 
[builder] Paketo Buildpack for CA Certificates 3.6.3
[builder]   https://github.com/paketo-buildpacks/ca-certificates
[builder]   Launch Helper: Reusing cached layer
[builder] Paketo Buildpack for Node Engine 1.6.0
[builder]   Resolving Node Engine version
[builder]     Candidate version sources (in priority order):
[builder]       BP_NODE_VERSION -> "18.16.1"
[builder]                       -> ""
[builder]       <unknown>       -> ""
[builder] 
[builder]     Selected Node Engine version (using BP_NODE_VERSION): 18.16.1
[builder]
[builder]   Reusing cached layer /layers/paketo-buildpacks_node-engine/node
[builder]
[builder] Paketo Buildpack for NPM Install 1.1.4
[builder]   Resolving installation process
[builder]     Process inputs:
[builder]       node_modules      -> "Found"
[builder]       npm-cache         -> "Not found"
[builder]       package-lock.json -> "Found"
[builder]
[builder]     Selected NPM build process: 'npm rebuild'
[builder]
[builder]   Reusing cached layer /layers/paketo-buildpacks_npm-install/build-modules
[builder] 
[builder] Paketo Buildpack for Node Run Script 1.0.10
[builder]   Executing build process
[builder]     Running 'npm run build'
[builder]       
[builder]       > angular-test-app@0.0.0 build
[builder]       > ng build
[builder]
[builder]       - Generating browser application bundles (phase: setup)...
[builder]       ✔ Browser application bundle generation complete.
[builder]       ✔ Browser application bundle generation complete.
[builder]       - Copying assets...
[builder]       ✔ Copying assets complete.
[builder]       - Generating index html...
[builder]       ✔ Index html generation complete.
[builder]
[builder]       Initial Chunk Files           | Names         |  Raw Size | Estimated Transfer Size
[builder]       main.71e0bfb2a5a0650c.js      | main          | 181.37 kB |                49.88 kB
[builder]       polyfills.253171eeaad64eda.js | polyfills     |  33.03 kB |                10.67 kB
[builder]       runtime.0bf8a733167df5be.js   | runtime       | 910 bytes |               517 bytes
[builder]       styles.ef46db3751d8e999.css   | styles        |   0 bytes |                       -
[builder]
[builder]       | Initial Total | 215.28 kB |                61.06 kB
[builder]
[builder]       Build at: 2024-04-22T15:19:39.909Z - Hash: 5ba873db0d455073 - Time: 10288ms
[builder]       npm notice 
[builder]       npm notice New major version of npm available! 9.5.1 -> 10.5.2
[builder]       npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.5.2>
[builder]       npm notice Run `npm install -g npm@10.5.2` to update!
[builder]       npm notice
[builder]
[builder]     Completed in 11.771s
[builder]
[builder] Paketo Buildpack for Nginx Server 0.15.3
[builder]   Resolving Nginx Server version
[builder]     Candidate version sources (in priority order):
[builder]       buildpack.toml -> "1.25.*"
[builder]
[builder]     Selected Nginx Server version (using buildpack.toml): 1.25.1
[builder]
[builder]   Reusing cached layer /layers/paketo-buildpacks_nginx/nginx
[builder]
===> EXPORTING
[exporter] Reusing layer 'paketo-buildpacks/ca-certificates:helper'
[exporter] Reusing layer 'paketo-buildpacks/nginx:nginx'
[exporter] Reusing layer 'buildpacksio/lifecycle:launch.sbom'
[exporter] Reusing 1/1 app layer(s)
[exporter] Reusing layer 'buildpacksio/lifecycle:launcher'
[exporter] Reusing layer 'buildpacksio/lifecycle:config'
[exporter] Reusing layer 'buildpacksio/lifecycle:process-types'
[exporter] Adding label 'io.buildpacks.lifecycle.metadata'
[exporter] Adding label 'io.buildpacks.build.metadata'
[exporter] Adding label 'io.buildpacks.project.metadata'
[exporter] Setting default process type 'web'
[exporter] Saving angular-test-app...
[exporter] *** Images (1605aa884641):
[exporter]       angular-test-app
[exporter] Reusing cache layer 'paketo-buildpacks/node-engine:node'
[exporter] Reusing cache layer 'paketo-buildpacks/npm-install:build-modules'
[exporter] Reusing cache layer 'buildpacksio/lifecycle:cache.sbom'
Successfully built image angular-test-app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants