使用 google stackdriver 构建 bootimage 失败

Springboot build bootimage with google stackdriver fails

提问人:Per Newgro 提问时间:3/5/2023 更新时间:3/5/2023 访问量:121

问:

我创建了一个基于 2.7.9 的简单 Springboot 项目。

plugins {
    id 'java'
    id 'org.springframework.boot' version '2.7.9'
    id 'io.spring.dependency-management' version '1.1.0'
}

group = 'com.example.profiler'
version = '1.0.0-SNAPSHOT'
sourceCompatibility = '17'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter'
    compileOnly 'org.projectlombok:lombok'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.named('test') {
    useJUnitPlatform()
}

ext {
    imageBaseName = "registry.gitlab.com/example/foo-service"
    registryUsername = "user"
    registryPassword = "token"
    registryUrl = "registry.gitlab.com"
    registryEmail = "[email protected]"
}

bootBuildImage {
    imageName = "${imageBaseName}/${project.name}:${project.version}"
    docker {
        publishRegistry {
            username = registryUsername
            password = registryPassword
            url = registryUrl
            email = registryEmail
        }
    }
    verboseLogging
    environment = [
            "BPE_OVERRIDE_BPL_GOOGLE_STACKDRIVER_MODULE" : "foo-service,-cprof_enable_heap_sampling=true"
    ]
    bindings = [ "${project.projectDir}/platform/bindings/google-stackdriver:/platform/bindings/google-stackdriver" ]
}

我添加了 和 定义以在创建的 google-stackdriver 中 图像。该文件夹存在,并包含内容为 .extbootBuildImageplatform/bindings/google-stackdrivertypeStackdriverProfiler

一切都在工作,直到2023年3月3日。在那里,我们所有的构建都失败了。

npm notice 

    [creator]     npm notice New minor version of npm available! 9.3.1 -> 9.6.0

    [creator]     npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.6.0

    [creator]     npm notice Run npm install -g [email protected] to update!

    [creator]     npm notice 

    [creator]     npm ERR! code 1

    [creator]     npm ERR! path /layers/paketo-buildpacks_google-stackdriver/google-stackdriver-profiler-nodejs/node_modules/pprof

    [creator]     npm ERR! command failed

    [creator]     npm ERR! command sh -c node-pre-gyp install --fallback-to-build

    [creator]     npm ERR! Failed to execute '/layers/paketo-buildpacks_node-engine/node/bin/node /layers/paketo-buildpacks_node-engine/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/layers/paketo-buildpacks_google-stackdriver/google-stackdriver-profiler-nodejs/node_modules/pprof/build/node-v108-linux-x64-glibc/pprof.node --module_name=pprof --module_path=/layers/paketo-buildpacks_google-stackdriver/google-stackdriver-profiler-nodejs/node_modules/pprof/build/node-v108-linux-x64-glibc --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)

    [creator]     npm ERR! node-pre-gyp info it worked if it ends with ok

    [creator]     npm ERR! node-pre-gyp info using [email protected]

    [creator]     npm ERR! node-pre-gyp info using [email protected] | linux | x64

    [creator]     npm ERR! node-pre-gyp info check checked for "/layers/paketo-buildpacks_google-stackdriver/google-stackdriver-profiler-nodejs/node_modules/pprof/build/node-v108-linux-x64-glibc/pprof.node" (not found)

    [creator]     npm ERR! node-pre-gyp http GET https://storage.googleapis.com/cloud-profiler/pprof-nodejs/release/v3.2.0/node-v108-linux-x64-glibc.tar.gz

    [creator]     npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://storage.googleapis.com/cloud-profiler/pprof-nodejs/release/v3.2.0/node-v108-linux-x64-glibc.tar.gz 

    [creator]     npm ERR! node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v108 ABI, glibc) (falling back to source compile with node-gyp) 

    [creator]     npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://storage.googleapis.com/cloud-profiler/pprof-nodejs/release/v3.2.0/node-v108-linux-x64-glibc.tar.gz 

    [creator]     npm ERR! gyp info it worked if it ends with ok

    [creator]     npm ERR! gyp info using [email protected]

    [creator]     npm ERR! gyp info using [email protected] | linux | x64

    [creator]     npm ERR! gyp info ok 

    [creator]     npm ERR! gyp info it worked if it ends with ok

    [creator]     npm ERR! gyp info using [email protected]

    [creator]     npm ERR! gyp info using [email protected] | linux | x64

    [creator]     npm ERR! gyp ERR! find Python 

    [creator]     npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration

    [creator]     npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON

    [creator]     npm ERR! gyp ERR! find Python checking if "python3" can be used

    [creator]     npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error

    [creator]     npm ERR! gyp ERR! find Python checking if "python" can be used

    [creator]     npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error

    [creator]     npm ERR! gyp ERR! find Python 

    [creator]     npm ERR! gyp ERR! find Python **********************************************************

    [creator]     npm ERR! gyp ERR! find Python You need to install the latest version of Python.

    [creator]     npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,

    [creator]     npm ERR! gyp ERR! find Python you can try one of the following options:

    [creator]     npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"

    [creator]     npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)

    [creator]     npm ERR! gyp ERR! find Python - Set the environment variable PYTHON

    [creator]     npm ERR! gyp ERR! find Python - Set the npm configuration variable python:

    [creator]     npm ERR! gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"

    [creator]     npm ERR! gyp ERR! find Python For more information consult the documentation at:

    [creator]     npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation

    [creator]     npm ERR! gyp ERR! find Python **********************************************************

    [creator]     npm ERR! gyp ERR! find Python 

    [creator]     npm ERR! gyp ERR! configure error 

    [creator]     npm ERR! gyp ERR! stack Error: Could not find any Python installation to use

    [creator]     npm ERR! gyp ERR! stack     at PythonFinder.fail (/layers/paketo-buildpacks_node-engine/node/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)

    [creator]     npm ERR! gyp ERR! stack     at PythonFinder.runChecks (/layers/paketo-buildpacks_node-engine/node/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)

    [creator]     npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (/layers/paketo-buildpacks_node-engine/node/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:202:16)

    [creator]     npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (/layers/paketo-buildpacks_node-engine/node/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:294:16)

    [creator]     npm ERR! gyp ERR! stack     at exithandler (node:child_process:427:5)

    [creator]     npm ERR! gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:439:5)

    [creator]     npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)

    [creator]     npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:289:12)

    [creator]     npm ERR! gyp ERR! stack     at onErrorNT (node:internal/child_process:476:16)

    [creator]     npm ERR! gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

    [creator]     npm ERR! gyp ERR! System Linux 5.15.90.1-microsoft-standard-WSL2

    [creator]     npm ERR! gyp ERR! command "/layers/paketo-buildpacks_node-engine/node/bin/node" "/layers/paketo-buildpacks_node-engine/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/layers/paketo-buildpacks_google-stackdriver/google-stackdriver-profiler-nodejs/node_modules/pprof/build/node-v108-linux-x64-glibc/pprof.node" "--module_name=pprof" "--module_path=/layers/paketo-buildpacks_google-stackdriver/google-stackdriver-profiler-nodejs/node_modules/pprof/build/node-v108-linux-x64-glibc" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v108"

    [creator]     npm ERR! gyp ERR! cwd /layers/paketo-buildpacks_google-stackdriver/google-stackdriver-profiler-nodejs/node_modules/pprof

    [creator]     npm ERR! gyp ERR! node -v v18.14.1

    [creator]     npm ERR! gyp ERR! node-gyp -v v9.3.0

    [creator]     npm ERR! gyp ERR! not ok 

    [creator]     npm ERR! node-pre-gyp ERR! build error 

    [creator]     npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/layers/paketo-buildpacks_node-engine/node/bin/node /layers/paketo-buildpacks_node-engine/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/layers/paketo-buildpacks_google-stackdriver/google-stackdriver-profiler-nodejs/node_modules/pprof/build/node-v108-linux-x64-glibc/pprof.node --module_name=pprof --module_path=/layers/paketo-buildpacks_google-stackdriver/google-stackdriver-profiler-nodejs/node_modules/pprof/build/node-v108-linux-x64-glibc --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)

    [creator]     npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/layers/paketo-buildpacks_google-stackdriver/google-stackdriver-profiler-nodejs/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)

    [creator]     npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:513:28)

    [creator]     npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)

    [creator]     npm ERR! node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)

    [creator]     npm ERR! node-pre-gyp ERR! System Linux 5.15.90.1-microsoft-standard-WSL2

    [creator]     npm ERR! node-pre-gyp ERR! command "/layers/paketo-buildpacks_node-engine/node/bin/node" "/layers/paketo-buildpacks_google-stackdriver/google-stackdriver-profiler-nodejs/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"

    [creator]     npm ERR! node-pre-gyp ERR! cwd /layers/paketo-buildpacks_google-stackdriver/google-stackdriver-profiler-nodejs/node_modules/pprof

    [creator]     npm ERR! node-pre-gyp ERR! node -v v18.14.1

    [creator]     npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.10

    [creator]     npm ERR! node-pre-gyp ERR! not ok

    [creator]     

    [creator]     npm ERR! A complete log of this run can be found in:

    [creator]     npm ERR!     /home/cnb/.npm/_logs/2023-03-04T16_38_20_440Z-debug-0.log

    [creator]     unable to invoke layer creator
    [creator]     unable to install node module
    [creator]     unable to run npm install
    [creator]     exit status 1
    [creator]     ERROR: failed to build: exit status 1

> Task :bootBuildImage FAILED

我能看到的是,现在我们得到了一个不同的 paketo 设置

> Running creator
    [creator]     ===> ANALYZING
    [creator]     Previous image with name "registry.gitlab.com/example/foo-service/stackdriver:1.0.0-SNAPSHOT" not found
    [creator]     ===> DETECTING
    [creator]     9 of 26 buildpacks participating
    [creator]     paketo-buildpacks/ca-certificates       3.6.0
    [creator]     paketo-buildpacks/bellsoft-liberica     9.11.0
    [creator]     paketo-buildpacks/node-engine           1.2.1
    [creator]     paketo-buildpacks/syft                  1.25.0
    [creator]     paketo-buildpacks/executable-jar        6.6.1
    [creator]     paketo-buildpacks/dist-zip              5.5.1
    [creator]     paketo-buildpacks/spring-boot           5.23.0
    [creator]     paketo-buildpacks/google-stackdriver    7.3.0
    [creator]     paketo-buildpacks/environment-variables 4.5.0
    [creator]     ===> RESTORING
    [creator]     ===> BUILDING

这失败了。

    [creator]     ===> ANALYZING
    [creator]     Previous image with name "registry.gitlab.com/example/foo-service/stackdriver:1.0.0-SNAPSHOT" not found
    [creator]     ===> DETECTING
    [creator]     8 of 24 buildpacks participating
    [creator]     paketo-buildpacks/ca-certificates       3.5.1
    [creator]     paketo-buildpacks/bellsoft-liberica     9.10.3
    [creator]     paketo-buildpacks/syft                  1.24.2
    [creator]     paketo-buildpacks/executable-jar        6.6.0
    [creator]     paketo-buildpacks/dist-zip              5.5.0
    [creator]     paketo-buildpacks/spring-boot           5.22.1
    [creator]     paketo-buildpacks/google-stackdriver    7.2.0
    [creator]     paketo-buildpacks/environment-variables 4.4.0

这行得通。

似乎我们有了新的“paketo-buildpacks/node-engine 1.2.1”依赖项。 也许有人有类似的问题或知道如何解决这个问题?

spring-boot 堆栈驱动程序 构建包

评论

2赞 Scott Frederick 3/5/2023
您可能会在最近发布的 Paketo Java builpacks: github.com/paketo-buildpacks/datadog/issues/162 中遇到此问题。在 Paketo 团队发布修复程序之前,有关该问题的评论中有一些解决方法。
0赞 Per Newgro 3/6/2023
非常感谢您的指点。将 'buildpacks = [“gcr.io/paketo-buildpacks/java:8.9.0”]' 添加到我的 bootBuildImage 任务后,我们再次使用“旧”版本。

答: 暂无答案