【发布时间】:2020-06-29 14:45:19
【问题描述】:
我正在为我的节点应用程序遵循 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'
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 minutes 花费的更多,我认为这太多了。我怎样才能让它运行 prettier, linting and unit tests 一次运行而不是顺序运行?
编辑_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
【问题讨论】:
标签: google-cloud-platform yaml devops google-cloud-build