Skip to content

Commit 520c18d

Browse files
authored
test: add owlbot nodejs container tests (#1693)
1 parent 35f4cba commit 520c18d

6 files changed

Lines changed: 84 additions & 0 deletions

File tree

docker/owlbot/nodejs/cloudbuild.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ steps:
1515
sed -i "s/\!:/:/g" post-processor-changes.txt
1616
# Build the docker image.
1717
- name: 'gcr.io/cloud-builders/docker'
18+
id: 'build'
1819
args: [ 'build',
1920
'-t', 'gcr.io/repo-automation-bots/owlbot-nodejs:$SHORT_SHA',
2021
'-t', 'gcr.io/repo-automation-bots/owlbot-nodejs:latest',
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
steps:
2+
# Write the latest commit message to a file in the workspace.
3+
- name: 'gcr.io/cloud-builders/git'
4+
entrypoint: '/bin/sh'
5+
args:
6+
- '-c'
7+
# Get the last commit in synthtool and write it to post-processor-changes.txt.
8+
# If the commit message ends with parenthesis, remove them.
9+
# If the commit message starts with feat or fix, replace it with chore.
10+
# If the commit message includes ! followed by a colon to signal a breaking change, remove the !.
11+
- >
12+
git log -1 --format="%B%n%nSource-Link: https://github.com/googleapis/synthtool/commit/%H" > post-processor-changes.txt &&
13+
sed -i "s/([^()]*)$//g" post-processor-changes.txt &&
14+
sed -i "s/^\(feat\|fix\)/chore/g" post-processor-changes.txt &&
15+
sed -i "s/\!:/:/g" post-processor-changes.txt
16+
# Build the docker image.
17+
- name: 'gcr.io/cloud-builders/docker'
18+
id: 'build'
19+
args: [ 'build',
20+
'-t', 'gcr.io/repo-automation-bots/owlbot-nodejs:$SHORT_SHA',
21+
'-t', 'gcr.io/repo-automation-bots/owlbot-nodejs:latest',
22+
'-t', 'gcr.io/cloud-devrel-public-resources/owlbot-nodejs:$SHORT_SHA',
23+
'-t', 'gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest',
24+
'-f', 'docker/owlbot/nodejs/Dockerfile', '.' ]
25+
# Run container tests
26+
- name: gcr.io/gcp-runtimes/container-structure-test
27+
args:
28+
- 'test'
29+
- '--image'
30+
- 'gcr.io/repo-automation-bots/owlbot-nodejs:$SHORT_SHA'
31+
- '--config'
32+
- 'docker/owlbot/nodejs/container_test.yaml'
33+
waitFor: ['build']
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
schemaVersion: 1.0.0
2+
commandTests:
3+
- name: "node"
4+
command: ["node", "--version"]
5+
expectedOutput: ["v15.14.0"]
6+
- name: "python"
7+
command: ["python", "--version"]
8+
expectedOutput: ["Python 3.10.6"]

docker/owlbot/nodejs_mono_repo/cloudbuild.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ steps:
1515
sed -i "s/\!:/:/g" post-processor-changes.txt
1616
# Build the docker image.
1717
- name: 'gcr.io/cloud-builders/docker'
18+
id: 'build'
1819
args: [ 'build',
1920
'-t', 'gcr.io/repo-automation-bots/owlbot-nodejs-mono-repo:$SHORT_SHA',
2021
'-t', 'gcr.io/repo-automation-bots/owlbot-nodejs-mono-repo:latest',
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
steps:
2+
# Write the latest commit message to a file in the workspace.
3+
- name: 'gcr.io/cloud-builders/git'
4+
entrypoint: '/bin/sh'
5+
args:
6+
- '-c'
7+
# Get the last commit in synthtool and write it to post-processor-changes.txt.
8+
# If the commit message ends with parenthesis, remove them.
9+
# If the commit message starts with feat or fix, replace it with chore.
10+
# If the commit message includes ! followed by a colon to signal a breaking change, remove the !.
11+
- >
12+
git log -1 --format="%B%n%nSource-Link: https://github.com/googleapis/synthtool/commit/%H" > post-processor-changes.txt &&
13+
sed -i "s/([^()]*)$//g" post-processor-changes.txt &&
14+
sed -i "s/^\(feat\|fix\)/chore/g" post-processor-changes.txt &&
15+
sed -i "s/\!:/:/g" post-processor-changes.txt
16+
# Build the docker image.
17+
- name: 'gcr.io/cloud-builders/docker'
18+
id: 'build'
19+
args: [ 'build',
20+
'-t', 'gcr.io/repo-automation-bots/owlbot-nodejs-mono-repo:$SHORT_SHA',
21+
'-t', 'gcr.io/repo-automation-bots/owlbot-nodejs-mono-repo:latest',
22+
'-t', 'gcr.io/cloud-devrel-public-resources/owlbot-nodejs-mono-repo:$SHORT_SHA',
23+
'-t', 'gcr.io/cloud-devrel-public-resources/owlbot-nodejs-mono-repo:latest',
24+
'-f', 'docker/owlbot/nodejs_mono_repo/Dockerfile', '.' ]
25+
# Run container tests
26+
- name: gcr.io/gcp-runtimes/container-structure-test
27+
args:
28+
- 'test'
29+
- '--image'
30+
- 'gcr.io/repo-automation-bots/owlbot-nodejs-mono-repo:$SHORT_SHA'
31+
- '--config'
32+
- 'docker/owlbot/nodejs_mono_repo/container_test.yaml'
33+
waitFor: ['build']
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
schemaVersion: 1.0.0
2+
commandTests:
3+
- name: "node"
4+
command: ["node", "--version"]
5+
expectedOutput: ["v15.14.0"]
6+
- name: "python"
7+
command: ["python", "--version"]
8+
expectedOutput: ["Python 3.10.6"]

0 commit comments

Comments
 (0)