Skip to content

Commit be665bb

Browse files
authored
fix: path in .OwlBot.yaml path for new directory structure, and feat: add default_version to .repo-metadata.json (#3236)
* fix: path in .OwlBot.yaml path for new directory structure * feat: add default_version to .repo-metadata.json * chore: remove unused GH token
1 parent 7b23c49 commit be665bb

10 files changed

Lines changed: 18 additions & 16 deletions

File tree

containers/node-bootstrap-container/create-gh-issue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
const {Octokit} = require('@octokit/rest');
16-
const octokit = new Octokit({auth: process.env.GITHUB_TOKEN});
16+
const octokit = new Octokit();
1717

1818
async function createGHIssue (octokit) {
1919
await octokit.rest.issues.create({

containers/node-bootstrap-container/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ FOLDER_NAME=$(node /create-folder-name.js $API_ID) || node /create-gh-issue.js
2626
mkdir -p "${WORKSPACE_DIR}/${MONO_REPO_NAME}/packages/${FOLDER_NAME}" || node /create-gh-issue.js
2727
node /add-to-well-known-path.js "${WORKSPACE_DIR}" "${FOLDER_NAME}"
2828
cd "${WORKSPACE_DIR}/${MONO_REPO_NAME}"
29-
/usr/local/bin/gapic-node-templating bootstrap-library --api-id "${API_ID}" --destination-folder "${WORKSPACE_DIR}/${MONO_REPO_NAME}/packages/${FOLDER_NAME}" --mono-repo-name "${MONO_REPO_NAME}" --github-token "${GITHUB_TOKEN}" || node create-gh-issue.js
29+
/usr/local/bin/gapic-node-templating bootstrap-library --api-id "${API_ID}" --destination-folder "${WORKSPACE_DIR}/${MONO_REPO_NAME}/packages/${FOLDER_NAME}" --mono-repo-name "${MONO_REPO_NAME}" || node create-gh-issue.js

packages/gapic-node-templating/__snapshots__/templating.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ exports['tests for templates it should create the templates in the directory 1']
1414
# limitations under the License.
1515
1616
deep-copy-regex:
17-
- source: /google/cloud/kms/.*-nodejs/(.*)
18-
dest: /owl-bot-staging/kms/$1/$2
17+
- source: /google/cloud/kms/(.*)/.*-nodejs
18+
dest: /owl-bot-staging/google-cloud-kms/$1
1919
`
2020

2121
exports['tests for templates it should create the templates in the directory 2'] = `
@@ -30,6 +30,7 @@ exports['tests for templates it should create the templates in the directory 2']
3030
"repo": "googleapis/googleapis/google-cloud-node",
3131
"distribution_name": "@google-cloud/kms",
3232
"api_id": "google.cloud.kms.v1",
33+
"default_version": "v1",
3334
"requires_billing": true,
3435
"library_type": "GAPIC_AUTO"
3536
}

packages/gapic-node-templating/src/commands/bootstrap-library.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export interface CliArgs {
3333
'api-id': string;
3434
'mono-repo-name': string;
3535
'destination-folder': string;
36-
'github-token': string;
3736
}
3837

3938
export const bootstrapLibrary: yargs.CommandModule<{}, CliArgs> = {
@@ -56,15 +55,16 @@ export const bootstrapLibrary: yargs.CommandModule<{}, CliArgs> = {
5655
type: 'string',
5756
demand: true,
5857
})
59-
.option('github-token', {
60-
describe: 'temporary github token',
58+
.option('folder-name', {
59+
describe:
60+
'name of the folder for the post-processor to copy into (goes in .OwlBot.yaml)',
6161
type: 'string',
6262
demand: true,
6363
});
6464
},
6565
async handler(argv: CliArgs) {
6666
const distributionName = await getDistributionName(
67-
new Octokit({auth: argv['github-token']}),
67+
new Octokit(),
6868
argv['api-id'],
6969
cp.execSync
7070
);

packages/gapic-node-templating/src/get-bootstrap-template-vars.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ export interface TemplateVars {
4747
apiPath: string;
4848
// API Path with dashes
4949
apiPathDashes: string;
50+
// version in API ID, will be used as default_version
51+
version: string;
5052
}
5153

5254
export interface DriftApi {
@@ -151,6 +153,7 @@ export async function compileVars(
151153
apiId: argv['api-id'],
152154
apiPath: getApiPath(argv['api-id']),
153155
apiPathDashes: getApiPathWithDashes(argv['api-id']),
156+
version: getVersion(argv['api-id']),
154157
};
155158
}
156159

packages/gapic-node-templating/templates/bootstrap-templates/.github/.OwlBot.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
# limitations under the License.
1414

1515
deep-copy-regex:
16-
- source: /{{apiPath}}/.*-{{language}}/(.*)
17-
dest: /owl-bot-staging/{{name}}/$1/$2
16+
- source: /{{apiPath}}/(.*)/.*-{{language}}
17+
dest: /owl-bot-staging/{{apiPathDashes}}/$1

packages/gapic-node-templating/templates/bootstrap-templates/.repo-metadata.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"repo": "googleapis/{{monoRepoName}}",
1010
"distribution_name": "{{distributionName}}",
1111
"api_id": "{{apiId}}",
12+
"default_version": "{{version}}",
1213
"requires_billing": true,
1314
"library_type": "GAPIC_AUTO"
1415
}

packages/gapic-node-templating/test/bootstrap-library.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const API_ID = 'google.cloud.kms.v1';
2525
export const DESTINATION_FOLDER = './temp';
2626
export const MONO_REPO_NAME = 'google-cloud-node';
2727
export const GITHUB_TOKEN = 'ghs_1234';
28+
export const FOLDER_NAME = 'google-cloud-kms';
2829

2930
describe('tests running build trigger', () => {
3031
let getDriftMetadataStub: sinon.SinonStub;
@@ -53,8 +54,6 @@ describe('tests running build trigger', () => {
5354
destinationFolder: DESTINATION_FOLDER,
5455
'mono-repo-name': MONO_REPO_NAME,
5556
monoRepoName: MONO_REPO_NAME,
56-
'github-token': GITHUB_TOKEN,
57-
githubToken: GITHUB_TOKEN,
5857
_: [],
5958
$0: 'foo',
6059
});

packages/gapic-node-templating/test/get-bootstrap-template-vars.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {
2727
import {
2828
API_ID,
2929
DESTINATION_FOLDER,
30-
GITHUB_TOKEN,
3130
MONO_REPO_NAME,
3231
} from './bootstrap-library.test';
3332
import {Storage} from '@google-cloud/storage';
@@ -71,7 +70,6 @@ describe('get bootstrap template vars', () => {
7170
'api-id': API_ID,
7271
'destination-folder': DESTINATION_FOLDER,
7372
'mono-repo-name': MONO_REPO_NAME,
74-
'github-token': GITHUB_TOKEN,
7573
},
7674
{
7775
apiShortName: 'kms',
@@ -91,6 +89,7 @@ describe('get bootstrap template vars', () => {
9189
apiId: 'google.cloud.kms.v1',
9290
apiPath: 'google/cloud/kms',
9391
apiPathDashes: 'google-cloud-kms',
92+
version: 'v1',
9493
}
9594
);
9695
});
@@ -115,7 +114,6 @@ describe('get bootstrap template vars', () => {
115114
'api-id': API_ID,
116115
'destination-folder': DESTINATION_FOLDER,
117116
'mono-repo-name': MONO_REPO_NAME,
118-
'github-token': GITHUB_TOKEN,
119117
},
120118
storage
121119
),
@@ -146,7 +144,6 @@ describe('get bootstrap template vars', () => {
146144
'api-id': API_ID,
147145
'destination-folder': DESTINATION_FOLDER,
148146
'mono-repo-name': MONO_REPO_NAME,
149-
'github-token': GITHUB_TOKEN,
150147
},
151148
storage
152149
),

packages/gapic-node-templating/test/templating.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ describe('tests for templates', () => {
5555
apiId: 'google.cloud.kms.v1',
5656
apiPath: 'google/cloud/kms',
5757
apiPathDashes: 'google-cloud-kms',
58+
version: 'v1',
5859
});
5960

6061
snapshot(

0 commit comments

Comments
 (0)