I am following a CI-CD process for my node application. I am able to deploy it successfully, but the problem is it is taking a very long time for the whole process. How can I make this CI-CD process faster ?
Below is my cloudbuild.yaml file:
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
This process is taking me more than 15 minutes
which is too much I think. How can I make it to run prettier, linting and unit tests
to run all at once and not sequentially ?
Edit_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