diff --git a/containers/node-bootstrap-container/.eslintignore b/containers/node-bootstrap-container/.eslintignore deleted file mode 100644 index 9340ad9b86d3..000000000000 --- a/containers/node-bootstrap-container/.eslintignore +++ /dev/null @@ -1,6 +0,0 @@ -**/node_modules -**/coverage -test/fixtures -build/ -docs/ -protos/ diff --git a/containers/node-bootstrap-container/.eslintrc.json b/containers/node-bootstrap-container/.eslintrc.json deleted file mode 100644 index 782153495464..000000000000 --- a/containers/node-bootstrap-container/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/containers/node-bootstrap-container/Dockerfile b/containers/node-bootstrap-container/Dockerfile deleted file mode 100644 index eba978e6c6dc..000000000000 --- a/containers/node-bootstrap-container/Dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Use a multi-stage docker build to limit production dependencies. - -# Use the official lightweight Node.js 18 image. -# https://hub.docker.com/_/node -FROM golang:1.22-alpine as gobuild - -RUN go install github.com/bazelbuild/buildtools/buildozer@latest - -FROM node:18-slim as nodebuild - -COPY package*.json / - -RUN npm install - -# Now copy all the code so we can compile -COPY . / - -COPY --from=gobuild /go/bin/buildozer /go/bin/buildozer - - -RUN chmod 755 /entrypoint.sh \ - /add-to-well-known-path.js \ - /create-folder-name.js \ - /create-gh-issue.js -# Run the web service on container startup. -ENTRYPOINT ["/entrypoint.sh" ] \ No newline at end of file diff --git a/containers/node-bootstrap-container/__snapshots__/helper-test.js b/containers/node-bootstrap-container/__snapshots__/helper-test.js deleted file mode 100644 index 3f1a1b52a95f..000000000000 --- a/containers/node-bootstrap-container/__snapshots__/helper-test.js +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -exports['helper functions should open an issue on a given repo 1'] = { - "title": "The Node bootstrapper container failed creating google.cloud.kms.v1", - "body": "Check build number 1234 in owlbot-bootstrap-prod for more details" -} diff --git a/containers/node-bootstrap-container/add-to-well-known-path.js b/containers/node-bootstrap-container/add-to-well-known-path.js deleted file mode 100644 index eb9fbd85e9c2..000000000000 --- a/containers/node-bootstrap-container/add-to-well-known-path.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const fs = require('fs'); -function getApiPathWithDashes(args) { - const [interContainerVarsPath, folderName] = args - const contents = JSON.parse(fs.readFileSync(interContainerVarsPath).toString()) - contents.owlbotYamlPath = `packages/${folderName}/.OwlBot.yaml`; - fs.writeFileSync(interContainerVarsPath, - JSON.stringify(contents, null, 4) - ); -} - -getApiPathWithDashes(process.argv.slice(2)); \ No newline at end of file diff --git a/containers/node-bootstrap-container/cloudbuild.yaml b/containers/node-bootstrap-container/cloudbuild.yaml deleted file mode 100644 index 41ba7555db46..000000000000 --- a/containers/node-bootstrap-container/cloudbuild.yaml +++ /dev/null @@ -1,24 +0,0 @@ -steps: - # Build the docker image. - - name: 'gcr.io/cloud-builders/docker' - dir: 'containers/node-bootstrap-container' - args: [ 'build', - '-t', 'gcr.io/owlbot-bootstrap-prod/node-bootstrapper:$SHORT_SHA', - '-t', 'us-docker.pkg.dev/owlbot-bootstrap-prod/owlbot-bootstrapper-images/node-bootstrapper:$SHORT_SHA', - '-t', 'gcr.io/owlbot-bootstrap-prod/node-bootstrapper:latest', - '-t', 'us-docker.pkg.dev/owlbot-bootstrap-prod/owlbot-bootstrapper-images/node-bootstrapper:latest', - '-t', 'gcr.io/owlbot-bootstrap-staging/node-bootstrapper:$SHORT_SHA', - '-t', 'us-docker.pkg.dev/owlbot-bootstrap-staging/owlbot-bootstrapper-images/node-bootstrapper:$SHORT_SHA', - '-t', 'gcr.io/owlbot-bootstrap-staging/node-bootstrapper:latest', - '-t', 'us-docker.pkg.dev/owlbot-bootstrap-staging/owlbot-bootstrapper-images/node-bootstrapper:latest', - '.' ] - # Push the docker image. -images: - - gcr.io/owlbot-bootstrap-prod/node-bootstrapper:$SHORT_SHA - - us-docker.pkg.dev/owlbot-bootstrap-prod/owlbot-bootstrapper-images/node-bootstrapper:$SHORT_SHA - - gcr.io/owlbot-bootstrap-prod/node-bootstrapper:latest - - us-docker.pkg.dev/owlbot-bootstrap-prod/owlbot-bootstrapper-images/node-bootstrapper:latest - - gcr.io/owlbot-bootstrap-staging/node-bootstrapper:$SHORT_SHA - - us-docker.pkg.dev/owlbot-bootstrap-staging/owlbot-bootstrapper-images/node-bootstrapper:$SHORT_SHA - - gcr.io/owlbot-bootstrap-staging/node-bootstrapper:latest - - us-docker.pkg.dev/owlbot-bootstrap-staging/owlbot-bootstrapper-images/node-bootstrapper:latest diff --git a/containers/node-bootstrap-container/create-folder-name.js b/containers/node-bootstrap-container/create-folder-name.js deleted file mode 100755 index 47d679b83a71..000000000000 --- a/containers/node-bootstrap-container/create-folder-name.js +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -function getApiPathWithDashes(apiId) { - console.log(apiId.toString().replace(/\.v[0-9].*/, '').replace(/\./g, '-')); -} - -getApiPathWithDashes(process.argv.slice(2)); diff --git a/containers/node-bootstrap-container/create-gh-issue.js b/containers/node-bootstrap-container/create-gh-issue.js deleted file mode 100644 index fd7418f550e1..000000000000 --- a/containers/node-bootstrap-container/create-gh-issue.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const {Octokit} = require('@octokit/rest'); -const octokit = new Octokit(); - -async function createGHIssue(octokit) { - await octokit.rest.issues.create({ - owner: 'googleapis', - repo: process.env.MONO_REPO_NAME, - title: `The Node bootstrapper container failed creating ${process.env.API_ID}`, - body: `Check build number ${process.env.BUILD_ID} in ${process.env.PROJECT_ID} for more details`, - }); -} - -createGHIssue(octokit); -exports.createGHIssue = createGHIssue; \ No newline at end of file diff --git a/containers/node-bootstrap-container/entrypoint.sh b/containers/node-bootstrap-container/entrypoint.sh deleted file mode 100755 index 62dfd3077b1b..000000000000 --- a/containers/node-bootstrap-container/entrypoint.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -set -e - -MONO_REPO_NAME="google-cloud-node" -cd "${MONO_REPO_PATH}/packages/gapic-node-processing" -npm i -npm run compile -npm link . - -cd "${MONO_REPO_PATH}/containers/node-bootstrap-container" -FOLDER_NAME=$(node /create-folder-name.js "${API_ID}") || node /create-gh-issue.js -echo "${FOLDER_NAME}" -echo "${API_ID}" -mkdir -p "${MONO_REPO_PATH}/packages/${FOLDER_NAME}" || node /create-gh-issue.js -node /add-to-well-known-path.js "${INTER_CONTAINER_VARS_PATH}" "${FOLDER_NAME}" -cd "${MONO_REPO_PATH}" - -/usr/local/bin/gapic-node-processing bootstrap-library --api-id "${API_ID}" --destination-folder "${MONO_REPO_PATH}/packages/${FOLDER_NAME}" --mono-repo-name "${MONO_REPO_NAME}" --folder-name "${FOLDER_NAME}" --service-config-path "${SERVICE_CONFIG_PATH}" || node /create-gh-issue.js diff --git a/containers/node-bootstrap-container/package.json b/containers/node-bootstrap-container/package.json deleted file mode 100644 index 30acde7e95a3..000000000000 --- a/containers/node-bootstrap-container/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "bootstrap-container", - "version": "1.0.0", - "description": "container to bootstrap initial files in a Node library", - "main": "index.js", - "scripts": { - "test": "mocha tests/", - "lint": "echo 'FIXME: no lint tests'", - "samples-test": "echo 'no sample tests'", - "system-test": "echo 'no system tests'" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/googleapis/google-cloud-node.git" - }, - "author": "Google LLC", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/googleapis/google-cloud-node/issues" - }, - "homepage": "https://github.com/googleapis/google-cloud-node#readme", - "dependencies": { - "@octokit/rest": "19.0.0" - }, - "devDependencies": { - "mocha": "^9.0.0", - "sinon": "21.0.3", - "snap-shot-it": "^7.9.6" - } -} diff --git a/containers/node-bootstrap-container/tests/helper-test.js b/containers/node-bootstrap-container/tests/helper-test.js deleted file mode 100644 index 2f77abb081b0..000000000000 --- a/containers/node-bootstrap-container/tests/helper-test.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// eslint-disable-next-line node/no-unpublished-import -const path = require('path'); -const createGhIssue = require('../../node-bootstrap-container/create-gh-issue'); -const createFolderNamePath = path.resolve(__dirname, '../../node-bootstrap-container/create-folder-name'); -const snapshot = require('snap-shot-it'); -const {describe, it} = require('mocha'); -const assert = require('assert'); -const cp = require('child_process'); -const { Octokit } = require('@octokit/rest'); -const fs = require('fs'); -const sinon = require('sinon'); - - -describe('helper functions', () => { - beforeEach(() => { - fs.writeFileSync(path.resolve(__dirname, 'interContainerVars.json'), JSON.stringify({branchName: 'branchName'}, null, 4)) - }) - - afterEach(() => { - cp.execSync(`rm -rf ${path.resolve(__dirname, 'interContainerVars.json')}`) - }) - - it('should return the API path without the version, with dashes', async () => { - assert.deepStrictEqual(cp.execSync( - `node ${createFolderNamePath} google.cloud.kms.v1`).toString('utf-8'), - 'google-cloud-kms\n' - ); - }); - - it('should add the .OwlBot.yaml name to the interContainerVars.json', async () => { - cp.execSync( - `node ./add-to-well-known-path.js ${__dirname}/interContainerVars.json google-cloud-kms`); - - assert.deepStrictEqual(JSON.parse(fs.readFileSync(path.resolve(__dirname, 'interContainerVars.json')).toString('utf8')), {branchName: 'branchName', owlbotYamlPath: 'packages/google-cloud-kms/.OwlBot.yaml'}) - }); - - - - it('should open an issue on a given repo', async () => { - process.env.MONO_REPO_NAME = 'google-cloud-node'; - process.env.API_ID = 'google.cloud.kms.v1'; - process.env.PROJECT_ID = 'owlbot-bootstrap-prod'; - process.env.BUILD_ID = '1234'; - process.env.GITHUB_TOKEN = '22334'; - const octokit = new Octokit({auth: process.env.GITHUB_TOKEN}); - const issueStub = sinon.stub(octokit.rest.issues, 'create'); - - await createGhIssue.createGHIssue(octokit); - assert.ok(issueStub.calledOnce); - - delete process.env.MONO_REPO_NAME; - delete process.env.API_ID; - delete process.env.PROJECT_ID; - delete process.env.BUILD_ID; - delete process.env.GITHUB_TOKEN; - }); -}); diff --git a/containers/node-bootstrap-container/tsconfig.json b/containers/node-bootstrap-container/tsconfig.json deleted file mode 100644 index 5a89bd2b5430..000000000000 --- a/containers/node-bootstrap-container/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "esModuleInterop": true, - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -}