我在Gradle上有一个Sping Boot 项目,想通过tilt将它带到我的本地kubernetes集群。
不幸的是,tilt在编译过程中抛出以下错误:
似乎无法解析此环境变量。
STEP 1/3 — Building Custom Build: [supplier-service]
Custom Build: Injecting Environment Variables
EXPECTED_REF=supplier-service:tilt-build-1679856709
EXPECTED_IMAGE=library/supplier-service
EXPECTED_TAG=tilt-build-1679856709
Running cmd: gradlew bootBuildImage --imageName $EXPECTED_REF
> Task :compileJava UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :resolveMainClassName UP-TO-DATE
> Task :processAot UP-TO-DATE
> Task :compileAotJava UP-TO-DATE
> Task :processAotResources UP-TO-DATE
> Task :aotClasses UP-TO-DATE
> Task :collectReachabilityMetadata UP-TO-DATE
> Task :bootJar UP-TO-DATE
> Task :bootBuildImage FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bootBuildImage'.
> Unable to parse image reference "$EXPECTED_REF". Image reference must be in the form '[domainHost:port/][path/]name[:tag][@digest]', with 'path' and 'name' containing only [a-z0-9][.][_][-]
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 7s
9 actionable tasks: 1 executed, 8 up-to-date
gradlew bootBuildImage --imageName $EXPECTED_REF exited with exit code 1
Build Failed: Custom build "gradlew bootBuildImage --imageName $EXPECTED_REF" failed: exit status 1
我的倾斜文件
# Build
custom_build(
# Name of the container image
ref = 'supplier-service',
# Command to build the container image
command = 'gradlew bootBuildImage --imageName $EXPECTED_REF',
# Files to watch that trigger a new build
deps = ['build.gradle', 'src'],
live_update = [
sync('src', '/workspace/BOOT-INF/classes')
]
)
# Deploy
k8s_yaml(kustomize('k8s'))
# Manage
k8s_resource('supplier-service', port_forwards=['9001'])
我的项目是这样的https://github.com/ThomasVitale/cloud-native-spring-in-action/blob/d416afd2dae63c35fd098a245a32d1c97813854b/Chapter16/16-end/config-service/Tiltfile
尝试一切:(
这是倾斜文档https://docs.tilt.dev/api.html
1条答案
按热度按时间zu0ti5jz1#
生成失败,因为您使用的是Windows而不是Linux或Mac。请使用双百分号(%VARIABLE_NAME%)而不是美元符号($VARIABLE_NAME)。请尝试以下操作: