Skip to content

Commit

Permalink
test: add owlbot nodejs container tests (#1693)
Browse files Browse the repository at this point in the history
  • Loading branch information
chingor13 authored Nov 3, 2022
1 parent 35f4cba commit 520c18d
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 0 deletions.
1 change: 1 addition & 0 deletions docker/owlbot/nodejs/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ steps:
sed -i "s/\!:/:/g" post-processor-changes.txt
# Build the docker image.
- name: 'gcr.io/cloud-builders/docker'
id: 'build'
args: [ 'build',
'-t', 'gcr.io/repo-automation-bots/owlbot-nodejs:$SHORT_SHA',
'-t', 'gcr.io/repo-automation-bots/owlbot-nodejs:latest',
Expand Down
33 changes: 33 additions & 0 deletions docker/owlbot/nodejs/cloudbuild_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
steps:
# Write the latest commit message to a file in the workspace.
- name: 'gcr.io/cloud-builders/git'
entrypoint: '/bin/sh'
args:
- '-c'
# Get the last commit in synthtool and write it to post-processor-changes.txt.
# If the commit message ends with parenthesis, remove them.
# If the commit message starts with feat or fix, replace it with chore.
# If the commit message includes ! followed by a colon to signal a breaking change, remove the !.
- >
git log -1 --format="%B%n%nSource-Link: https://github.com/googleapis/synthtool/commit/%H" > post-processor-changes.txt &&
sed -i "s/([^()]*)$//g" post-processor-changes.txt &&
sed -i "s/^\(feat\|fix\)/chore/g" post-processor-changes.txt &&
sed -i "s/\!:/:/g" post-processor-changes.txt
# Build the docker image.
- name: 'gcr.io/cloud-builders/docker'
id: 'build'
args: [ 'build',
'-t', 'gcr.io/repo-automation-bots/owlbot-nodejs:$SHORT_SHA',
'-t', 'gcr.io/repo-automation-bots/owlbot-nodejs:latest',
'-t', 'gcr.io/cloud-devrel-public-resources/owlbot-nodejs:$SHORT_SHA',
'-t', 'gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest',
'-f', 'docker/owlbot/nodejs/Dockerfile', '.' ]
# Run container tests
- name: gcr.io/gcp-runtimes/container-structure-test
args:
- 'test'
- '--image'
- 'gcr.io/repo-automation-bots/owlbot-nodejs:$SHORT_SHA'
- '--config'
- 'docker/owlbot/nodejs/container_test.yaml'
waitFor: ['build']
8 changes: 8 additions & 0 deletions docker/owlbot/nodejs/container_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
schemaVersion: 1.0.0
commandTests:
- name: "node"
command: ["node", "--version"]
expectedOutput: ["v15.14.0"]
- name: "python"
command: ["python", "--version"]
expectedOutput: ["Python 3.10.6"]
1 change: 1 addition & 0 deletions docker/owlbot/nodejs_mono_repo/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ steps:
sed -i "s/\!:/:/g" post-processor-changes.txt
# Build the docker image.
- name: 'gcr.io/cloud-builders/docker'
id: 'build'
args: [ 'build',
'-t', 'gcr.io/repo-automation-bots/owlbot-nodejs-mono-repo:$SHORT_SHA',
'-t', 'gcr.io/repo-automation-bots/owlbot-nodejs-mono-repo:latest',
Expand Down
33 changes: 33 additions & 0 deletions docker/owlbot/nodejs_mono_repo/cloudbuild_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
steps:
# Write the latest commit message to a file in the workspace.
- name: 'gcr.io/cloud-builders/git'
entrypoint: '/bin/sh'
args:
- '-c'
# Get the last commit in synthtool and write it to post-processor-changes.txt.
# If the commit message ends with parenthesis, remove them.
# If the commit message starts with feat or fix, replace it with chore.
# If the commit message includes ! followed by a colon to signal a breaking change, remove the !.
- >
git log -1 --format="%B%n%nSource-Link: https://github.com/googleapis/synthtool/commit/%H" > post-processor-changes.txt &&
sed -i "s/([^()]*)$//g" post-processor-changes.txt &&
sed -i "s/^\(feat\|fix\)/chore/g" post-processor-changes.txt &&
sed -i "s/\!:/:/g" post-processor-changes.txt
# Build the docker image.
- name: 'gcr.io/cloud-builders/docker'
id: 'build'
args: [ 'build',
'-t', 'gcr.io/repo-automation-bots/owlbot-nodejs-mono-repo:$SHORT_SHA',
'-t', 'gcr.io/repo-automation-bots/owlbot-nodejs-mono-repo:latest',
'-t', 'gcr.io/cloud-devrel-public-resources/owlbot-nodejs-mono-repo:$SHORT_SHA',
'-t', 'gcr.io/cloud-devrel-public-resources/owlbot-nodejs-mono-repo:latest',
'-f', 'docker/owlbot/nodejs_mono_repo/Dockerfile', '.' ]
# Run container tests
- name: gcr.io/gcp-runtimes/container-structure-test
args:
- 'test'
- '--image'
- 'gcr.io/repo-automation-bots/owlbot-nodejs-mono-repo:$SHORT_SHA'
- '--config'
- 'docker/owlbot/nodejs_mono_repo/container_test.yaml'
waitFor: ['build']
8 changes: 8 additions & 0 deletions docker/owlbot/nodejs_mono_repo/container_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
schemaVersion: 1.0.0
commandTests:
- name: "node"
command: ["node", "--version"]
expectedOutput: ["v15.14.0"]
- name: "python"
command: ["python", "--version"]
expectedOutput: ["Python 3.10.6"]

0 comments on commit 520c18d

Please sign in to comment.