buildpacks
buildpacks copied to clipboard
Unable to detect node.js (python runtime is used instead)
pack build --path . \
--builder=gcr.io/buildpacks/builder:v1 \
--run-image gcr.io/buildpacks/gcp/run:v1 \
cpca-frontend:0.4
v1: Pulling from buildpacks/builder
Digest: sha256:81bd48b6df506fbdf5ce4e4fe1002f8e94676bfecefc6481373507097a122c4b
Status: Image is up to date for gcr.io/buildpacks/builder:v1
v1: Pulling from buildpacks/gcp/run
3a165760c9b0: Already exists
14e0163c1914: Already exists
3c2cba919283: Already exists
a32c8ca7034a: Already exists
7136bdbcd1a4: Already exists
Digest: sha256:778ebbfeb810ca2f590a8a8792e048a68bb023983052c80f19a9d191dee7c161
Status: Downloaded newer image for gcr.io/buildpacks/gcp/run:v1
===> DETECTING
3 of 4 buildpacks participating
google.python.runtime 0.9.1
google.config.entrypoint 0.9.0
google.utils.label 0.0.1
===> ANALYZING
===> RESTORING
===> BUILDING
=== Python - Runtime ([email protected]) ===
Using runtime version from GOOGLE_RUNTIME_VERSION: 14.15.5
Failure: (ID: 3bb836d3) Runtime version 14.15.5 does not exist at https://storage.googleapis.com/gcp-buildpacks/python/python-14.15.5.tar.gz (status 403). You can specify the version with GOOGLE_RUNTIME_VERSION.
--------------------------------------------------------------------------------
Sorry your project couldn't be built.
Our documentation explains ways to configure Buildpacks to better recognise your project:
-> https://github.com/GoogleCloudPlatform/buildpacks/blob/main/README.md
If you think you've found an issue, please report it:
-> https://github.com/GoogleCloudPlatform/buildpacks/issues/new
--------------------------------------------------------------------------------
ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle: failed with status code: 145
make: *** [Makefile:39: build] Error 1
The structure of the repository:
drwxr-xr-x 8 dmitry dmitry 4.0K Apr 29 16:48 .
drwxr-xr-x 4 dmitry dmitry 4.0K Apr 29 15:05 ..
drwxr-xr-x 8 dmitry dmitry 4.0K Apr 29 16:58 .git
drwxr-xr-x 3 dmitry dmitry 4.0K Apr 28 21:08 .kubernetes
drwxr-xr-x 3 dmitry dmitry 4.0K Apr 29 16:01 dist
drwxr-xr-x 946 dmitry dmitry 36K Apr 29 16:00 node_modules
drwxr-xr-x 4 dmitry dmitry 4.0K Apr 28 21:08 projects
drwxr-xr-x 2 dmitry dmitry 4.0K Apr 28 21:08 utils
-rw-r--r-- 1 dmitry dmitry 274 Apr 28 21:08 .editorconfig
-rw-r--r-- 1 dmitry dmitry 99 Apr 28 21:08 .env.example
-rw-r--r-- 1 dmitry dmitry 631 Apr 28 21:08 .gitignore
-rw-r--r-- 1 dmitry dmitry 9 Apr 29 16:36 .nvmrc
-rw-r--r-- 1 dmitry dmitry 308 Apr 28 21:08 .prettierrc
-rw-r--r-- 1 dmitry dmitry 1.7K Apr 29 16:58 Makefile
-rw-r--r-- 1 dmitry dmitry 88 Apr 29 16:35 Procfile
-rw-r--r-- 1 dmitry dmitry 2.4K Apr 29 16:49 README.md
-rw-r--r-- 1 dmitry dmitry 5.7K Apr 28 21:08 angular.json
-rw-r--r-- 1 dmitry dmitry 5.4K Apr 28 21:08 nginx.conf
-rw-r--r-- 1 dmitry dmitry 560K Apr 29 15:59 package-lock.json
-rw-r--r-- 1 dmitry dmitry 2.4K Apr 29 16:36 package.json
-rw-r--r-- 1 dmitry dmitry 141 Apr 29 16:55 project.toml
-rw-r--r-- 1 dmitry dmitry 980 Apr 28 21:08 tsconfig.json
-rw-r--r-- 1 dmitry dmitry 207 Apr 28 21:08 tslint.json
project.toml
[[build.env]]
name = "GOOGLE_RUNTIME_VERSION"
value = "14.15.5"
[[build.env]]
name = "GOOGLE_ENTRYPOINT"
value = "/cnb/lifecycle/launcher"
There is no python code in the repository at all, yet a PYTHON buildbpack is detected
the following is set inside the container:
CNB_PLATFORM_API=0.4
CNB_STACK_ID=google
CNB_USER_ID=1000
CNB_GROUP_ID=1000
/cnb/lifecycle/creator \
-app=app \
-project-metadata=/workspace/app/project.toml \
-cache-dir=/cache \
-layers=/layers \
-platform=/platform \
-cache-image="" \
-uid=1000 \
-gid=1000 \
-process-type=web \
-skip-restore=false \
-previous-image="" \
-run-image=public.ecr.aws/saritasa/buildpacks/google/runner:v1 \
xxx.dkr.ecr.us-west-2.amazonaws.com/project/frontend:dmitry-test1
If I try to run detector manually I get this
cnb@cpca-frontend-build-pipeline-run-s2lmm-buildpack-z5wps-po-qjbzt:/workspace$ /cnb/buildpacks/google.nodejs.runtime/0.9.2/bin/detect /workspace/app /workspace/app
Opting out: neither package.json nor any .js files found
cnb@cpca-frontend-build-pipeline-run-s2lmm-buildpack-z5wps-po-qjbzt:/workspace$ ls -la /workspace/app
total 672
drwxr-xr-x 8 cnb cnb 4096 Apr 30 02:08 .
drwxrwxrwx 5 root root 45 Apr 30 02:07 ..
-rw-r--r-- 1 cnb cnb 274 Apr 30 02:07 .editorconfig
-rw-r--r-- 1 cnb cnb 99 Apr 30 02:07 .env.example
drwxr-xr-x 8 cnb cnb 177 Apr 30 02:07 .git
-rw-r--r-- 1 cnb cnb 631 Apr 30 02:07 .gitignore
drwxr-xr-x 3 cnb cnb 23 Apr 30 02:07 .kubernetes
-rw-r--r-- 1 cnb cnb 9 Apr 30 02:07 .nvmrc
-rw-r--r-- 1 cnb cnb 308 Apr 30 02:07 .prettierrc
-rw-r--r-- 1 cnb cnb 1747 Apr 30 02:07 Makefile
-rw-r--r-- 1 cnb cnb 88 Apr 30 02:07 Procfile
-rw-r--r-- 1 cnb cnb 2492 Apr 30 02:07 README.md
-rw-r--r-- 1 cnb cnb 5761 Apr 30 02:07 angular.json
drwxr-xr-x 3 root root 17 Apr 30 02:08 dist
-rw-r--r-- 1 cnb cnb 5475 Apr 30 02:07 nginx.conf
drwxr-xr-x 946 cnb cnb 28672 Apr 30 02:08 node_modules
-rw-r--r-- 1 cnb cnb 573199 Apr 30 02:07 package-lock.json
-rw-r--r-- 1 cnb cnb 2388 Apr 30 02:07 package.json
-rw-r--r-- 1 cnb cnb 198 Apr 30 02:07 project.toml
drwxr-xr-x 4 cnb cnb 31 Apr 30 02:07 projects
-rw-r--r-- 1 cnb cnb 980 Apr 30 02:07 tsconfig.json
-rw-r--r-- 1 cnb cnb 207 Apr 30 02:07 tslint.json
drwxr-xr-x 2 cnb cnb 70 Apr 30 02:07 utils
cnb@project-frontend-build-pipeline-run-s2lmm-buildpack-z5wps-po-qjbzt:/workspace$
Does it make a difference if you remove the project.toml
file?
As a workaround, you can add GOOGLE_RUNTIME=nodejs
to project.toml
.
Would you mind running pack build
with the -v
flag to see why buildpacks are opting out?
As to running detect
directly, the binary must run from the app directory (i.e. /workspace/app in your case) according to the spec. The buildpack looks for package.json
using a relative path [1], which is why you see the opt-out message.
Edit: Given that your app is in /workspace/app, it looks like you might be running pack build
from a parent directory of the one that has the source code. Is that the case?
- https://github.com/GoogleCloudPlatform/buildpacks/blob/main/cmd/nodejs/runtime/main.go#L48-L50
So what I did is
- Removed project.toml - no effect, still it detects python files
- Put GOOGLE_RUNTIME=nodejs into project.toml - no effect
- Set CNB_LOG_LEVEL=debug and saw various output
- I had to run
npm run build
inside tekton pipeline, and then run
cd app
npm run build
ls -la app/dist/web | wc
20 173 1406
cp app/package*.json app/dist/web
cp app/project.toml app/dist/web
/cnb/lifecycle/creator \
-app=app/dist/web \
-project-metadata=/workspace/app/dist/web/project.toml \
-cache-dir=/cache \
-layers=/layers \
-platform=/platform \
-cache-image="" \
-uid=1000 \
-gid=1000 \
-process-type=web \
-skip-restore=false \
-previous-image="" \
-run-image=public.ecr.aws/saritasa/buildpacks/google/runner:v1 \
xxx.dkr.ecr.us-west-2.amazonaws.com/project/frontend:dmitry-test1
That has immediately identified nodejs runtime buildpack.
Then I did this
/cnb/lifecycle/creator \
-app=app \
-project-metadata=/workspace/app/project.toml \
-cache-dir=/cache \
-layers=/layers \
-platform=/platform \
-cache-image="" \
-uid=1000 \
-gid=1000 \
-process-type=web \
-skip-restore=false \
-previous-image="" \
-run-image=public.ecr.aws/saritasa/buildpacks/google/runner:v1 \
xxx.dkr.ecr.us-west-2.amazonaws.com/project/frontend:dmitry-test1
and it again compiled with nodejs runtime buildpack.
But before that "intermediary" step (moving stuff into dist/web) - no matter what I did it always resulted in python buildpack kicking in. Maybe some sort of a "cache"
issue somewhere?
I have cleaned up /layers, /cache and it didn't help.
I run the /cnb/lifecycle/creator buildpack inside tekton pipeline. I have even removed entirely PVCs associated with this pods running it - it had no impact either.
thanks, Dmitry
Can you run the pack build
again but with a -v
flag so we can see the detection results?
➜ VERSION=0.4 make build
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
Login Succeeded
pack build -v --path . \
--builder=public.ecr.aws/sa32re/buildpacks/google/builder:v1 \
--run-image public.ecr.aws/sa32re/buildpacks/google/runner:v1 \
project-frontend:0.4
Using project descriptor located at project.toml
Builder public.ecr.aws/sa32re/buildpacks/google/builder:v1 is untrusted
As a result, the phases of the lifecycle which require root access will be run in separate trusted ephemeral containers.
For more information, see https://medium.com/buildpacks/faster-more-secure-builds-with-pack-0-11-0-4d0c633ca619
Pulling image public.ecr.aws/sa32re/buildpacks/google/builder:v1
v1: Pulling from sa32re/buildpacks/google/builder
Digest: sha256:ae308798b70158667a1abe28238f9d8e39b3447cc1c6c60e1a46b9f75168a646
Status: Image is up to date for public.ecr.aws/sa32re/buildpacks/google/builder:v1
Using provided run-image public.ecr.aws/sa32re/buildpacks/google/runner:v1
Pulling image public.ecr.aws/sa32re/buildpacks/google/runner:v1
v1: Pulling from sa32re/buildpacks/google/runner
Digest: sha256:1bfe81cb16f566485842dbc3d5cf592a824b701e8aa48889b7dd285165c3e07c
Status: Image is up to date for public.ecr.aws/sa32re/buildpacks/google/runner:v1
Creating builder with the following buildpacks:
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
-> [email protected]
Provided Environment Variables
GOOGLE_ENTRYPOINT=/cnb/lifecycle/launcher
GOOGLE_RUNTIME_VERSION=14.15.5
Pulling image buildpacksio/lifecycle:0.11.1
0.11.1: Pulling from buildpacksio/lifecycle
Digest: sha256:2ca9870d9472400792bdc2d43ded8df2642ffcf937e8cd01685836678c28780b
Status: Image is up to date for buildpacksio/lifecycle:0.11.1
Using build cache volume pack-cache-library_project-frontend_0.4-f5c2f7c6e6ba.build
===> DETECTING
Running the detector on OS linux with:
Container Settings:
Args: /cnb/lifecycle/detector -log-level debug
System Envs: CNB_PLATFORM_API=0.4
Image: pack.local/builder/6b76676a626373677573:latest
User:
Labels: map[author:pack]
Host Settings:
Binds: pack-layers-eebotqtqrw:/layers pack-app-oogqdllvjh:/workspace
Network Mode:
[detector] ======== Output: [email protected] ========
[detector] Opting out: GOOGLE_FUNCTION_TARGET not set
[detector] ======== Output: [email protected] ========
[detector] Opting out: no project files or .dll files found
[detector] ======== Output: [email protected] ========
[detector] Opting out: no project files found and GOOGLE_BUILDABLE not set
[detector] ======== Output: [email protected] ========
[detector] Opting in: GOOGLE_ENTRYPOINT set to "/cnb/lifecycle/launcher"
[detector] ======== Output: [email protected] ========
[detector] Opting in: always enabled
[detector] ======== Results ========
[detector] skip: [email protected]
[detector] fail: [email protected]
[detector] fail: [email protected]
[detector] pass: [email protected]
[detector] pass: [email protected]
[detector] ======== Output: [email protected] ========
[detector] Opting out: no project files or .dll files found
[detector] ======== Output: [email protected] ========
[detector] Opting in: GOOGLE_ENTRYPOINT set to "/cnb/lifecycle/launcher"
[detector] ======== Output: [email protected] ========
[detector] Opting in: always enabled
[detector] ======== Results ========
[detector] fail: [email protected]
[detector] pass: [email protected]
[detector] pass: [email protected]
[detector] ======== Output: [email protected] ========
[detector] Opting out: no .go files found
[detector] ======== Output: [email protected] ========
[detector] Opting out: GOOGLE_FUNCTION_TARGET not set
[detector] ======== Output: [email protected] ========
[detector] Opting out: no .go files found
[detector] ======== Output: [email protected] ========
[detector] Opting in: GOOGLE_ENTRYPOINT set to "/cnb/lifecycle/launcher"
[detector] ======== Output: [email protected] ========
[detector] Opting out: GOOGLE_CLEAR_SOURCE not set
[detector] ======== Output: [email protected] ========
[detector] Opting in: always enabled
[detector] ======== Results ========
[detector] fail: [email protected]
[detector] fail: [email protected]
[detector] fail: [email protected]
[detector] pass: [email protected]
[detector] skip: [email protected]
[detector] pass: [email protected]
[detector] ======== Output: [email protected] ========
[detector] Opting out: no .go files found
[detector] ======== Output: [email protected] ========
[detector] Opting in: go.mod file not found, assuming GOPATH build
[detector] ======== Output: [email protected] ========
[detector] Opting out: no .go files found
[detector] ======== Output: [email protected] ========
[detector] Opting in: GOOGLE_ENTRYPOINT set to "/cnb/lifecycle/launcher"
[detector] ======== Output: [email protected] ========
[detector] Opting out: GOOGLE_CLEAR_SOURCE not set
[detector] ======== Output: [email protected] ========
[detector] Opting in: always enabled
[detector] ======== Results ========
[detector] fail: [email protected]
[detector] pass: [email protected]
[detector] fail: [email protected]
[detector] pass: [email protected]
[detector] skip: [email protected]
[detector] pass: [email protected]
[detector] ======== Output: [email protected] ========
[detector] Opting out: none of the following found: pom.xml, .mvn/extensions.xml, build.gradle, build.gradle.kts, META-INF/MANIFEST.MF, *.java, *.jar
[detector] ======== Output: [email protected] ========
[detector] Opting out: none of the following found: pom.xml or .mvn/extensions.xml.
[detector] ======== Output: [email protected] ========
[detector] Opting out: GOOGLE_FUNCTION_TARGET not set
[detector] ======== Output: [email protected] ========
[detector] Opting out: GOOGLE_CLEAR_SOURCE not set
[detector] ======== Output: [email protected] ========
[detector] Opting in: always enabled
[detector] ======== Results ========
[detector] fail: [email protected]
[detector] fail: [email protected]
[detector] fail: [email protected]
[detector] skip: [email protected]
[detector] pass: [email protected]
[detector] ======== Output: [email protected] ========
[detector] Opting out: none of the following found: pom.xml, .mvn/extensions.xml, build.gradle, build.gradle.kts, META-INF/MANIFEST.MF, *.java, *.jar
[detector] ======== Output: [email protected] ========
[detector] Opting out: neither build.gradle nor build.gradle.kts found
[detector] ======== Output: [email protected] ========
[detector] Opting out: GOOGLE_FUNCTION_TARGET not set
[detector] ======== Output: [email protected] ========
[detector] Opting out: GOOGLE_CLEAR_SOURCE not set
[detector] ======== Output: [email protected] ========
[detector] Opting in: always enabled
[detector] ======== Results ========
[detector] fail: [email protected]
[detector] skip: [email protected]
[detector] fail: [email protected]
[detector] skip: [email protected]
[detector] pass: [email protected]
[detector] ======== Output: [email protected] ========
[detector] Opting out: none of the following found: pom.xml, .mvn/extensions.xml, build.gradle, build.gradle.kts, META-INF/MANIFEST.MF, *.java, *.jar
[detector] ======== Output: [email protected] ========
[detector] Opting out: META-INF/MANIFEST.MF not found
[detector] ======== Output: [email protected] ========
[detector] Opting in: always enabled
[detector] ======== Results ========
[detector] fail: [email protected]
[detector] fail: [email protected]
[detector] pass: [email protected]
[detector] ======== Output: [email protected] ========
[detector] Opting out: none of the following found: pom.xml, .mvn/extensions.xml, build.gradle, build.gradle.kts, META-INF/MANIFEST.MF, *.java, *.jar
[detector] ======== Output: [email protected] ========
[detector] Opting out: none of the following found: pom.xml or .mvn/extensions.xml.
[detector] ======== Output: [email protected] ========
[detector] Opting in: GOOGLE_ENTRYPOINT set to "/cnb/lifecycle/launcher"
[detector] ======== Output: [email protected] ========
[detector] Opting out: GOOGLE_CLEAR_SOURCE not set
[detector] ======== Output: [email protected] ========
[detector] Opting in: always enabled
[detector] ======== Results ========
[detector] fail: [email protected]
[detector] fail: [email protected]
[detector] pass: [email protected]
[detector] skip: [email protected]
[detector] pass: [email protected]
[detector] ======== Output: [email protected] ========
[detector] Opting out: none of the following found: pom.xml, .mvn/extensions.xml, build.gradle, build.gradle.kts, META-INF/MANIFEST.MF, *.java, *.jar
[detector] ======== Output: [email protected] ========
[detector] Opting out: none of the following found: pom.xml or .mvn/extensions.xml.
[detector] ======== Output: [email protected] ========
[detector] Opting in: always enabled
[detector] ======== Output: [email protected] ========
[detector] Opting out: GOOGLE_CLEAR_SOURCE not set
[detector] ======== Output: [email protected] ========
[detector] Opting in: always enabled
[detector] ======== Results ========
[detector] fail: [email protected]
[detector] fail: [email protected]
[detector] pass: [email protected]
[detector] skip: [email protected]
[detector] pass: [email protected]
[detector] ======== Output: [email protected] ========
[detector] Opting out: none of the following found: pom.xml, .mvn/extensions.xml, build.gradle, build.gradle.kts, META-INF/MANIFEST.MF, *.java, *.jar
[detector] ======== Output: [email protected] ========
[detector] Opting out: neither build.gradle nor build.gradle.kts found
[detector] ======== Output: [email protected] ========
[detector] Opting in: GOOGLE_ENTRYPOINT set to "/cnb/lifecycle/launcher"
[detector] ======== Output: [email protected] ========
[detector] Opting out: GOOGLE_CLEAR_SOURCE not set
[detector] ======== Output: [email protected] ========
[detector] Opting in: always enabled
[detector] ======== Results ========
[detector] fail: [email protected]
[detector] skip: [email protected]
[detector] pass: [email protected]
[detector] skip: [email protected]
[detector] pass: [email protected]
[detector] ======== Output: [email protected] ========
[detector] Opting out: none of the following found: pom.xml, .mvn/extensions.xml, build.gradle, build.gradle.kts, META-INF/MANIFEST.MF, *.java, *.jar
[detector] ======== Output: [email protected] ========
[detector] Opting out: neither build.gradle nor build.gradle.kts found
[detector] ======== Output: [email protected] ========
[detector] Opting in: always enabled
[detector] ======== Output: [email protected] ========
[detector] Opting out: GOOGLE_CLEAR_SOURCE not set
[detector] ======== Output: [email protected] ========
[detector] Opting in: always enabled
[detector] ======== Results ========
[detector] fail: [email protected]
[detector] skip: [email protected]
[detector] pass: [email protected]
[detector] skip: [email protected]
[detector] pass: [email protected]
[detector] ======== Output: [email protected] ========
[detector] Opting in: found .py files
[detector] ======== Output: [email protected] ========
[detector] Opting out: GOOGLE_FUNCTION_TARGET not set
[detector] ======== Output: [email protected] ========
[detector] Opting in: always enabled
[detector] ======== Output: [email protected] ========
[detector] Opting in: GOOGLE_ENTRYPOINT set to "/cnb/lifecycle/launcher"
[detector] ======== Output: [email protected] ========
[detector] Opting in: always enabled
[detector] ======== Results ========
[detector] pass: [email protected]
[detector] fail: [email protected]
[detector] pass: [email protected]
[detector] pass: [email protected]
[detector] pass: [email protected]
[detector] ======== Output: [email protected] ========
[detector] Opting in: found .py files
[detector] ======== Output: [email protected] ========
[detector] Opting in: always enabled
[detector] ======== Output: [email protected] ========
[detector] Opting in: GOOGLE_ENTRYPOINT set to "/cnb/lifecycle/launcher"
[detector] ======== Output: [email protected] ========
[detector] Opting in: always enabled
[detector] ======== Results ========
[detector] pass: [email protected]
[detector] pass: [email protected]
[detector] pass: [email protected]
[detector] pass: [email protected]
[detector] Resolving plan... (try #1)
[detector] skip: [email protected] requires requirements.txt
[detector] 3 of 4 buildpacks participating
[detector] google.python.runtime 0.9.1
[detector] google.config.entrypoint 0.9.0
[detector] google.utils.label 0.0.1
===> ANALYZING
Running the analyzer on OS linux with:
Container Settings:
Args: /cnb/lifecycle/analyzer -log-level debug -daemon -cache-dir /cache project-frontend:0.4
System Envs: CNB_USER_ID=1000 CNB_GROUP_ID=1000 CNB_PLATFORM_API=0.4
Image: buildpacksio/lifecycle:0.11.1
User: root
Labels: map[author:pack]
Host Settings:
Binds: /var/run/docker.sock:/var/run/docker.sock pack-cache-library_project-frontend_0.4-f5c2f7c6e6ba.build:/cache pack-layers-eebotqtqrw:/layers pack-app-oogqdllvjh:/workspace
Network Mode:
[analyzer] Analyzing image "a932d12ddb57495971f78cba93284f4acce5dd48ae0ba8a518690169bd4af2fa"
===> RESTORING
Running the restorer on OS linux with:
Container Settings:
Args: /cnb/lifecycle/restorer -log-level debug -cache-dir /cache
System Envs: CNB_USER_ID=1000 CNB_GROUP_ID=1000 CNB_PLATFORM_API=0.4
Image: buildpacksio/lifecycle:0.11.1
User: root
Labels: map[author:pack]
Host Settings:
Binds: pack-cache-library_project-frontend_0.4-f5c2f7c6e6ba.build:/cache pack-layers-eebotqtqrw:/layers pack-app-oogqdllvjh:/workspace
Network Mode:
===> BUILDING
Running the builder on OS linux with:
Container Settings:
Args: /cnb/lifecycle/builder -log-level debug
System Envs: CNB_PLATFORM_API=0.4
Image: pack.local/builder/6b76676a626373677573:latest
User:
Labels: map[author:pack]
Host Settings:
Binds: pack-layers-eebotqtqrw:/layers pack-app-oogqdllvjh:/workspace
Network Mode:
[builder] === Python - Runtime ([email protected]) ===
[builder] Using runtime version from GOOGLE_RUNTIME_VERSION: 14.15.5
[builder] Failure: (ID: 3bb836d3) Runtime version 14.15.5 does not exist at https://storage.googleapis.com/gcp-buildpacks/python/python-14.15.5.tar.gz (status 403). You can specify the version with GOOGLE_RUNTIME_VERSION.
[builder] --------------------------------------------------------------------------------
[builder] Sorry your project couldn't be built.
[builder] Our documentation explains ways to configure Buildpacks to better recognise your project:
[builder] -> https://github.com/GoogleCloudPlatform/buildpacks/blob/main/README.md
[builder] If you think you've found an issue, please report it:
[builder] -> https://github.com/GoogleCloudPlatform/buildpacks/issues/new
[builder] --------------------------------------------------------------------------------
[builder] ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle. This may be the result of using an untrusted builder: failed with status code: 145
make: *** [Makefile:39: build] Error 1
So https://github.com/GoogleCloudPlatform/buildpacks/blob/10f6e4f050380c3a16bfdebcd601876b97373fde/cmd/python/runtime/main.go#L50
Is matching but this seems like maybe a bug since just having a .py
file somewhere in the source tree shouldn't trigger it being a python project. Does it make a difference if you delete the dist
and node_modules
dirs? (since those likely shouldn't be there before the buildpack runs anyhow)
so there is a single python file inside node_modules
, and if I do this
➜ find . -iname '*.py'
./node_modules/blocking-proxy/examples/e2e_test.py
but if I add this:
[[build.env]]
name = "GOOGLE_RUNTIME_VERSION"
value = "14.15.5"
[[build.env]]
name = "GOOGLE_RUNTIME"
value = "nodejs"
[[build.env]]
name = "GOOGLE_ENTRYPOINT"
value = "/cnb/lifecycle/launcher"
[build]
exclude = [
"node_modules"
]
then the detection happens properly, but still I find it very confusing that a single .py buried file deeply inside node_modules causes all this.
Not sure if it's a bug or not a bug.
I'd say bug. But I'd also say that you shouldn't run buildpacks on a node project that already has a node_modules
dir since the buildpack is supposed to do the npm install
.
yes clear, it's just that I did install with npm install
prior to running the pack build. So I have a question
[build]
exclude = [
"node_modules"
]
this removes the node_modules
from the resulting image entirely? Or does it skip the searching for files in the folder?
Docs say exclude from build but I'm not sure if that also means detect: https://buildpacks.io/docs/reference/config/project-descriptor/#build-table-optional
ok, should I keep this issue as open or close it?
Let's keep it open. To summarize, a .py file anywhere in the source tree shouldn't make the python buildpack pass detection.
When should a .py file cause the python buildpack to pass?
@briandealwis
I would say we should skip detection for python buildpack if .py file is found inside node_modules
directory.
One option is to apply the .gitignore
as default build excludes. This would also help with congruence between local run & CI run. Not sure if this should just be in pack
though.
We received a report of a user's python project being detected as a dotnet project. I'm trying to confirm details, but they said that they added a venv. I'm guessing that we're finding a .dll
.
https://github.com/GoogleCloudPlatform/buildpacks/blob/e962ff0ffb981a1fc439ed326f24e4bef80ec65c/cmd/dotnet/runtime/main.go#L56
So it feels like we have a few top-level directories that should be filtered out, some conditionally:
-
node_modules
if there is apackages.json
-
lib/python*
if there is apyvenv.cfg
-
build/
if there is abuild.gradle
orbuild.gradle.kts
-
target/
if there is apom.xml
or.mvn
directory -
vendor
if there is ago.mod
(?)
Heard back about the python project being mistaken for dotnet. They were developing a python project using venv
. Their requirements.txt
included ptvsd
(required for debugging with VSCode). So this causes the following .dlls to be installed (regardless of platform):
$ find . -name '*.dll'
./lib/python3.9/site-packages/ptvsd/_vendored/pydevd/pydevd_attach_to_process/attach_amd64.dll
./lib/python3.9/site-packages/ptvsd/_vendored/pydevd/pydevd_attach_to_process/attach_x86.dll
Edit: opened #144