Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build-tools: Add several APIs to build-cli #11705

Merged
merged 18 commits into from Aug 31, 2022

Conversation

tylerbutler
Copy link
Member

Follow up to #11692.

Adds APIs for:

  • Generating branch names.
  • Creating release and dep bump branches.
  • Checking npm for package updates.
  • Checking if a particular version has been released.
  • Getting all versions and their dates based on the git tag.
  • Sorting versions based on date and semver version.

These APIs will be used heavily in the release and release report commands (future PRs).

@tylerbutler tylerbutler marked this pull request as ready for review August 26, 2022 23:44
@tylerbutler tylerbutler requested review from msfluid-bot and a team as code owners August 26, 2022 23:44
@github-actions github-actions bot added public api change Changes to a public API base: main PRs targeted against main branch labels Aug 26, 2022

if (releaseGroupOrPackage instanceof MonoRepo) {
workingDir = releaseGroupOrPackage.repoPath;
cmd = `npx lerna version ${translatedVersion.version} --no-push --no-git-tag-version -y && npm run build:genver`;

Check warning

Code scanning / CodeQL

Unsafe shell command constructed from library input

[String concatenation](1) based on [library input](2) is later used in [shell command](3).
cmd = `npx lerna version ${translatedVersion.version} --no-push --no-git-tag-version -y && npm run build:genver`;
} else {
workingDir = releaseGroupOrPackage.directory;
cmd = `npm version ${translatedVersion.version}`;

Check warning

Code scanning / CodeQL

Unsafe shell command constructed from library input

[String concatenation](1) based on [library input](2) is later used in [shell command](3).
build-tools/packages/build-cli/src/base.ts Outdated Show resolved Hide resolved
build-tools/packages/build-cli/src/base.ts Outdated Show resolved Hide resolved
build-tools/packages/build-cli/src/base.ts Outdated Show resolved Hide resolved
build-tools/packages/build-cli/src/commands/bump/deps.ts Outdated Show resolved Hide resolved
build-tools/packages/build-cli/src/lib/branches.ts Outdated Show resolved Hide resolved
build-tools/packages/build-cli/src/lib/package.ts Outdated Show resolved Hide resolved
build-tools/packages/build-cli/src/lib/sets.ts Outdated Show resolved Hide resolved
build-tools/packages/build-cli/src/lib/bump.ts Outdated Show resolved Hide resolved
build-tools/packages/build-cli/src/lib/package.ts Outdated Show resolved Hide resolved
build-tools/packages/build-cli/src/lib/package.ts Outdated Show resolved Hide resolved
build-tools/packages/build-cli/src/lib/package.ts Outdated Show resolved Hide resolved
build-tools/packages/build-cli/src/lib/package.ts Outdated Show resolved Hide resolved
build-tools/packages/build-cli/src/lib/package.ts Outdated Show resolved Hide resolved
build-tools/packages/build-cli/src/lib/index.ts Outdated Show resolved Hide resolved
build-tools/packages/build-cli/src/lib/package.ts Outdated Show resolved Hide resolved
@tylerbutler tylerbutler merged commit f464448 into microsoft:main Aug 31, 2022
@tylerbutler tylerbutler deleted the cli/part-3 branch August 31, 2022 17:32
@github-actions
Copy link
Contributor

This commit is queued for merging with the next branch! Please ignore this PR for now. Contact @microsoft/fluid-cr-infra for help.

tylerbutler added a commit that referenced this pull request Sep 6, 2022
…state machine to govern logic (#11706)

Follow up to #11705.

- Adds an abstract base command class for commands that use state machines. This base command contains the scaffolding for commands that have internal state machines, including some logging for each state transition and handling the Init and Failed states.
- Adds various interfaces and types for working with the state machine.
- Adds the Fluid Unified Release Process finite state machine, which is used by the `release` command.

This PR also implements the `release` command, which is used to ensure that a release branch is in good condition, then walks the user through the release.

## The release process and state machine

The release process itself is described by a state machine. The basic flow of the command is:

- The command starts and oclif (our CLI infrastructure) parses flags and arguments, validates them, etc.
- The command's _run_ method is called, which calls an internal _stateLoop_ function.
- That function loops through the machine states, passing each state to the command's state handler function.
- The state handler handles the states it knows about, and if it doesn't handle the state, it passes it to its parent's state handler. Thus, the parent classes are relevant to the overall implementation of the state handling. In previous iterations there was a deeper class hierarchy, but now there's just one base abstract state machine command and the release command that inherits from it.

Co-authored-by: Joshua Smithrud <54606601+Josmithr@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
base: main PRs targeted against main branch public api change Changes to a public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants