Repository navigation
Scaffold a new service's package, and treat resourcemanager as global - #7
Merged
Merged
Conversation
A regeneration that brought a new service failed CI until someone added its package by hand. scripts/generate.sh --write now scaffolds it (generator/src/scaffold.ts): packages/<service> with package.json, tsconfig.json, README.md, LICENSE and a test of its client, as packages/location has them, its place in the workspaces, the references, README.md's table and package-lock.json. Its description says what the API's definitions do: the first sentence of the package's comment, or else of its one service's comment, or else the resources it serves but those within another of them, spelled as its comments spell them. The services without a regional host were iam, admin and location, in the generator and in core. The API's global services are iam, resourcemanager and location: a resourcemanager client with a region would have called a regional host that doesn't exist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now, a regeneration that brings a new service fails CI by design: someone has to add
packages/<service>by hand first. Two changes here:What changed
generator/src/scaffold.ts, whichscripts/generate.sh --writeruns. For each service that has no package yet, it writes:packages/<service>withpackage.json,tsconfig.json,README.md,LICENSEandtest/client.test.ts, laid out likepackages/location;package.jsonworkspaces, thetsconfig.jsonandtsconfig.test.jsonreferences, and README.md's table.generate.shthen runsnpm installto link the packages and add them topackage-lock.json. It runs it twice, because npm leaves a new workspace'snameout of the lock file until the next install.fetch, and checks the URL and the answer.--write, the check still fails on a service that has no package.Global services. The generator and
@origincloud/coretreatediam,adminandlocationas global. The API design namesiam,resourcemanagerandlocation, so a resource manager client with a region would have called a regional host that doesn't exist. The list now matches the API design, and core's endpoint test covers all three.npm testalso runs the generator's tests (generator/dist). CONTRIBUTING.md and the regeneration PR's body describe the scaffolding.A new service's regeneration still waits for review, because its package's first version is published by hand (RELEASING.md).
The published packages don't change, and neither does their version.
Tested against the four new APIs
I generated from a local copy of the API with
origincloud.compute.v1beta1,origincloud.network.v1beta1,origincloud.iam.v1beta1andorigincloud.resourcemanager.v1beta1added.scripts/generate.sh --writescaffolded four packages:@origincloud/compute@origincloud/iam@origincloud/network@origincloud/resourcemanagerAfter a fresh
npm ci, every CI step passes on that tree:scripts/generate.shnpm run buildnpm test: 59 tests, the four new client tests among themThe generated clients pass
regional: falseforiam,resourcemanagerandlocation.