Open instw opened 1 month ago
Hey, thanks for the bug report. I can reproduce the bug locally. Something went stale, but I am not sure what.
I am not an expert here. I also do not have a lot of time to spend on this, but maybe I can help unblock you.
This will use a custom builder (the one we use to run our CI) to build the example.
I saved this as update-api.patch
:
diff --git a/ci/pack/buildpack/bin/build b/ci/pack/buildpack/bin/build
index dce67dd..2b78319 100755
--- a/ci/pack/buildpack/bin/build
+++ b/ci/pack/buildpack/bin/build
@@ -42,6 +42,7 @@ set(VCPKG_TARGET_ARCHITECTURE x64)
_EOF_
cp -r /usr/local/bin/vcpkg "${VCPKG_ROOT}"
cat >"${layers}/vcpkg.toml" <<_EOF_
+[types]
build = true
cache = true
launch = false
@@ -52,6 +53,7 @@ if [[ ! -d "${layers}/vcpkg-cache" ]]; then
echo "-----> Restore cache from build image"
cp -r /var/cache/vcpkg-cache "${layers}/vcpkg-cache"
cat >"${layers}/vcpkg-cache.toml" <<_EOF_
+[types]
build = true
cache = true
launch = false
@@ -60,6 +62,7 @@ fi
echo "-----> Setup build directory"
cat >"${layers}/source.toml" <<_EOF_
+[types]
build = true
cache = false
launch = false
@@ -261,6 +264,7 @@ generate_main \
echo "-----> Configure Function"
cat >"${layers}/binary.toml" <<_EOF_
+[types]
build = true
cache = true
launch = false
@@ -275,6 +279,7 @@ _EOF_
/usr/local/bin/cmake --build "${layers}/binary" --target install
cat >"${layers}/local.toml" <<_EOF_
+[types]
launch = true
cache = false
build = false
@@ -283,5 +288,5 @@ _EOF_
cat >"${layers}/launch.toml" <<_EOF_
[[processes]]
type = "web"
-command = "${layers}/local/bin/function"
+command = ["${layers}/local/bin/function"]
_EOF_
diff --git a/ci/pack/buildpack/buildpack.toml b/ci/pack/buildpack/buildpack.toml
index 8dee294..5a74931 100644
--- a/ci/pack/buildpack/buildpack.toml
+++ b/ci/pack/buildpack/buildpack.toml
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-api = "0.2"
+api = "0.10"
[buildpack]
id = "com.google.buildpack.cpp"
then ran the following from the root of the repo, on the main
branch:
git apply update-api.patch
docker build -t ci-build-image --target gcf-cpp-ci -f build_scripts/Dockerfile .
docker build -t ci-run-image --target gcf-cpp-runtime -f build_scripts/Dockerfile build_scripts
pack builder create gcf-cpp-builder:bionic --config ci/pack/builder.toml
pack config trusted-builders add gcf-cpp-builder:bionic
GOOGLE_CLOUD_PROJECT=... # put the right value here
pack build \
--builder gcf-cpp-builder:bionic \
--env GOOGLE_FUNCTION_TARGET=hello_world_http \
--path examples/site/hello_world_http \
"gcr.io/${GOOGLE_CLOUD_PROJECT}/gcf-cpp-hello-world-http"
If you were looking for a real fix, let me know, and I can try to prioritize the work.
When following the instructions on https://github.com/GoogleCloudPlatform/functions-framework-cpp/blob/main/examples/site/howto_deploy_to_cloud_run/README.md , I consistently get errors-
The errors prevent vcpkg from download the dependencies correctly, causing the build to fail.