Google cloud platform 为什么整个CI-CD过程需要很长时间才能完成?
我正在跟踪我的节点应用程序的CI-CD进程。我能够成功地部署它,但问题是整个过程需要很长时间。如何使此CI-CD进程更快 下面是我的cloudbuild.yaml文件:Google cloud platform 为什么整个CI-CD过程需要很长时间才能完成?,google-cloud-platform,yaml,devops,google-cloud-build,Google Cloud Platform,Yaml,Devops,Google Cloud Build,我正在跟踪我的节点应用程序的CI-CD进程。我能够成功地部署它,但问题是整个过程需要很长时间。如何使此CI-CD进程更快 下面是我的cloudbuild.yaml文件: steps: # Install npm - name: 'node:10.10.0' args: ['npm', 'install'] dir: './UI' # Make the app prettier - name: 'node:10.13.0' en
steps:
# Install npm
- name: 'node:10.10.0'
args: ['npm', 'install']
dir: './UI'
# Make the app prettier
- name: 'node:10.13.0'
entrypoint: bash
args: ['-c', 'npx prettier --check "**/*"']
dir: './UI'
# Execute the lint command
- name: 'node:10.10.0'
args: ['npm', 'run', 'lint']
dir: './UI'
# Install Phantom JS -g karma-cli
- name: 'node:10.10.0'
args: ['npm', 'install', '--save-dev karma-phantomjs-launcher']
dir: './UI'
# NPM test
- name: 'node:10.10.0'
args: ['npm', 'run', 'test']
dir: './UI'
# Build dev file
- name: 'node:10.10.0'
args: ['npm', 'run', 'build_dev']
dir: './UI'
timeout: 1800s
# List the files in the UI directory
- name: 'node:10.10.0'
entrypoint: bash
args: ['-c', 'ls -la']
dir: './UI'
# Deploy UI build to CS-D Portal
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy', './']
dir: './UI'
timeout: 1801s
这个过程花费了我超过15分钟的时间,我觉得这太多了。如何使更漂亮,linting和单元测试同时运行,而不是按顺序运行
编辑_1:
steps:
- name: 'gcr.io/kaniko-project/executor:latest'
args:
- --destination=gcr.io/xoxoxoxoxo/node:10.13.0
- --cache=true
- --cache-ttl=48h
# Install npm
- name: 'node:10.13.0'
args: ['npm', 'install']
dir: './UI'
# Make the app prettier
- name: 'node:10.13.0'
entrypoint: bash
args: ['-c', 'npx prettier --check "**/*"']
dir: './UI'
# Execute the lint command
- name: 'node:10.13.0'
args: ['npm', 'run', 'lint']
dir: './UI'
# Install Phantom JS -g karma-cli
- name: 'node:10.13.0'
args: ['npm', 'install', '--save-dev karma-phantomjs-launcher']
dir: './UI'
# NPM test
- name: 'node:10.13.0'
args: ['npm', 'run', 'test']
dir: './UI'
# Build dev file
- name: 'node:10.13.0'
args: ['npm', 'run', 'build_dev']
dir: './UI'
timeout: 1800s
# List the files in the UI directory
- name: 'node:10.13.0'
entrypoint: bash
args: ['-c', 'ls -la']
dir: './UI'
# Deploy UI build to CS-D Portal
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy', './']
dir: './UI'
timeout: 1801s
我不确定在同一个步骤中连续运行3个东西是否会帮助您节省时间,几秒钟,而不是更多
这里有一些加快流程的技巧
- 在所有步骤中使用相同的映像,以防止Cloud Build下载不同的映像。示例:您的
更漂亮的步骤,与其他步骤不同
- 使用Kaniko缓存来缓存图像,这会阻止在第一步下载图像,它会立即在缓存中
- 增加CPU的数量。您将提高处理性能和工作所允许的互联网带宽。您的图像提取和依赖项下载将更快
谷歌提供提示感谢您的快速响应。请检查我的Edit_1
部分,并告诉我这是否是正确的编写方法。是的,它是正确的,但通过查看构建步骤,它将毫无用处。当您构建容器时,Kaniko缓存是有效的,而在这里您没有构建容器:(那么,您建议我怎么做?您已经修复了多映像提取,现在您只有一个。Kaniko是无用的,您可以。