Skip to content

Commit

Permalink
Testing Kaniko
Browse files Browse the repository at this point in the history
  • Loading branch information
gino-m committed May 20, 2020
1 parent 7d24919 commit e3086d0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 41 deletions.
26 changes: 21 additions & 5 deletions cloud-build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,28 @@

FROM node:latest

# Download nad install Chrome. We don't actually use Chrome directly, but
# this is the easiest way to ensure all of its latest dependencies are
# installed.
# Download and install Chrome. We don't actually use Chrome directly, but
# Puppeteers needs several libraries that Chrome depends on, and this is the
# easiest way to ensure all of its latest dependencies are installed.
WORKDIR tmp
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
&& apt-get update \
&& apt -y install ./google-chrome-stable_current_amd64.deb \
&& rm google-chrome-stable_current_amd64.deb \
&& rm -rf /var/lib/apt/lists/* \
&& npm install node-pre-gyp -g
&& rm -rf /var/lib/apt/lists/*
WORKDIR ..

## Install deps in workspace where source will be copied.
WORKDIR workspace

# Pre-install deps required to build and test Ground Firestore Cloud Functions.
WORKDIR functions
COPY functions/package*.json ./
RUN npm install
WORKDIR ..

# Pre-install deps required to build and test the Ground web console.
WORKDIR web-ng
COPY web-ng/package*.json ./
RUN npm install
WORKDIR ..
50 changes: 14 additions & 36 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,54 +12,32 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Initialize gcloud via CLI
# $ gcloud init
#
# Steps (1, 2, 3, and 4 run simultaneously):
# ==========================================
# 1. Install npm packages for functions
# 2. Install npm packages for web-ng
# |
# |
# 3. Run lint checks
# 4. Run unit tests
# This build is run automatically on pushes and pull requests.

steps:
# The first time the Docker image is created, the total build time can exceed
# the 10m default. Increase the max. build time to prevent timeouts.
timeout: 15m

# Install node packages for functions
- name: 'gcr.io/ground-android-gcb/node-chrome'
id: 'Install npm packages for functions'
waitFor: ['-']
entrypoint: 'bash'
args:
- '-c'
- |
cd functions && npm install
# Install node packages for web-ng
- name: 'gcr.io/ground-android-gcb/node-chrome'
id: &install_web_ng 'Install npm packages for web-ng'
waitFor: ['-']
entrypoint: 'bash'
# Build Docker image and run checks and tests. See name property of each step
# for description.
steps:
- name: 'gcr.io/kaniko-project/executor:latest'
id: 'Rebuild Docker image with deps as needed'
args:
- '-c'
- |
cd web-ng && npm install
- --destination=gcr.io/$PROJECT_ID/ground-platform-deps
- --dockerfile=cloud-build/Dockerfile
- --cache=true

# Run eslint for web-ng
- name: 'gcr.io/ground-android-gcb/node-chrome'
- name: 'gcr.io/$PROJECT_ID/ground-platform-deps'
id: 'Run lint checks for web-ng'
waitFor: [*install_web_ng]
entrypoint: 'bash'
args:
- '-c'
- |
cd web-ng && npm run check
# Run tests for web-ng
- name: 'gcr.io/ground-android-gcb/node-chrome'
- name: 'gcr.io/$PROJECT_ID/ground-platform-deps'
id: 'Run tests for web-ng'
waitFor: [*install_web_ng]
entrypoint: 'bash'
args:
- '-c'
Expand Down

0 comments on commit e3086d0

Please sign in to comment.