我在这上调查了StackOverflow的问题,但不幸的是,对我来说没有任何帮助。
我有cloudbuild.yaml文件
steps:
- name: 'node:14.16.0'
entrypoint: 'yarn'
id: yarn-install
args: ['install']
waitFor: ["-"]
- name: gcr.io/cloud-builders/yarn
id: proxy-install
entrypoint: sh
args:
- "-c"
- "wget https://storage.googleapis.com/cloudsql-proxy/v1.23.0/cloud_sql_proxy.linux.amd64 -O /workspace/cloud_sql_proxy && chmod +x /workspace/cloud_sql_proxy"
waitFor: ["-"]
- id: migrate
name: gcr.io/cloud-builders/yarn
env:
- NODE_ENV=$_NODE_ENV
- DB_NAME=$_DB_NAME
- DB_USER=$_DB_USER
- DB_PASSWORD=MY_FAKE_PASSWORD
- CLOUD_SQL_CONNECTION_NAME=$_CLOUD_SQL_CONNECTION_NAME
entrypoint: sh
args:
- "-c"
- "(./workspace/cloud_sql_proxy -dir=/workspace -instances=$_CLOUD_SQL_CONNECTION_NAME & sleep 2) && yarn run knex migrate:latest"
timeout: "1200s"
waitFor: ["yarn-install", "proxy-install"]我想连接到我的Cloud数据库,以便使用yarn run knex migrate:latest应用模式迁移。
但它在迁移步骤中失败。
来自云构建的日志
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1145:16)
Error: connect ENOENT /cloudsql/project:us-east1:project-posgresql1/.s.PGSQL.5432
Using environment: production
Working directory changed to /workspace/src/infrastructure/knex
Requiring external module ts-node/register
$ ./node_modules/knex/bin/cli.js --knexfile=./src/infrastructure/knex/knex.config.ts migrate:latest --env production migrate:latest
yarn run v1.22.5
sh: 1: ./workspace/cloud_sql_proxy: not found
Already have image (with digest): gcr.io/cloud-builders/yarn我不知道如何正确地调试它..。你能帮我找出问题的根源吗?
附注:
...@cloudbuild.gserviceaccount.com具有以下角色
P.S.S 肯奈是用于类SQL数据库的JavaScript查询生成器。
发布于 2021-06-10 18:45:22
通过设计,您需要在与代理安装步骤相同的步骤中运行。然而,我从未用waitFor进行测试“-”,这可能是一个解决办法。但是这个解决方案应该对你有用。
- name: gcr.io/cloud-builders/yarn
id: proxy-install
entrypoint: sh
env:
- NODE_ENV=$_NODE_ENV
- DB_NAME=$_DB_NAME
- DB_USER=$_DB_USER
- DB_PASSWORD=MY_FAKE_PASSWORD
- CLOUD_SQL_CONNECTION_NAME=$_CLOUD_SQL_CONNECTION_NAME
args:
- "-c"
- |
wget https://storage.googleapis.com/cloudsql-proxy/v1.23.0/cloud_sql_proxy.linux.amd64 -O /workspace/cloud_sql_proxy && chmod +x /workspace/cloud_sql_proxy
(./workspace/cloud_sql_proxy -dir=/workspace -instances=$_CLOUD_SQL_CONNECTION_NAME & sleep 2) && yarn run knex migrate:latest
timeout: "1200s"试一试让我知道
https://stackoverflow.com/questions/67922716
复制相似问题