Commit Graph

60 Commits

Author SHA1 Message Date
Paul Gschwendtner 047994b048 feat(dev-infra): introduce release action for directly branching-off into RC (#42973)
Introduces a new release action for cutting a release-action by directly
moving the next release-train into the `release-candidate` phase.

This allows the Angular team to release minor versions without
needing to branch-off first into the feature-freeze phase. For
minors this phase can be skipped. Switching into the feature-freeze
phase beforehand as a workaround would have allowed for branching-off
but has the downside that `target: minor` would no longer point to the
branched-off release train (only `target: rc` would work then).

PR Close #42973
2021-07-28 10:50:22 -07:00
Joey Perrott e462743969 refactor(dev-infra): move semver utils into the utils directory (#42917)
Move semver into the utils directory rather than as a set of utils specifically
for release tooling.  While the utils are only currently used in the release
tooling, they are not providing a release specific utility and can be used by
any subtool of ng-dev.

PR Close #42917
2021-07-22 18:01:17 +00:00
Joey Perrott d2b1c3ec15 fix(dev-infra): fix creating experimental semver versions to include prerelease chunk (#42917)
SemVers created for experimental versions should also include the prerelease chunk (i.e. -next.3).

PR Close #42917
2021-07-22 18:01:17 +00:00
Joey Perrott 69d4ebffa9 Revert "fix(dev-infra): perform actual npm login verification for wombot proxy (#42871)" (#42917)
This reverts commit fd92a3e87f.

It turns out that wombot proxy will return who is logged in, but does so regardless of
if the users token is currently active.  Since we cannot rely on `npm whoami` to
determine the login state, we revert to our previous state of assuming new login is
needed.

PR Close #42917
2021-07-22 18:01:17 +00:00
Joey Perrott d3b0d1e3fb refactor(dev-infra): add spawnSync to child process utils, normalize naming of child-process utils (#42911)
Create a `spawnSync` command for common usage, additionally update naming to use `spawn` instead of
`spawnWithDebugOutput`

PR Close #42911
2021-07-21 22:33:37 +00:00
Joey Perrott 282e86ad71 fix(dev-infra): use the version from package.json rather than tags (#42872)
Use the version value from the primary package.json file rather than
checking the branch for the latest semver tag.  This allows for us
to explictly create changelogs from the previous version to the new
version.

PR Close #42872
2021-07-20 11:30:33 -07:00
Joey Perrott 445fee4174 feat(dev-infra): update package version verification to allow for experimental version (#42898)
The angular-cli repo publishes experimental versioned packages in addition to standard
versioned packages.  Both experimental and standard verions, based on the expected new
version provided are treated as valid and correct.

PR Close #42898
2021-07-20 11:30:00 -07:00
Joey Perrott 96d31d8c9f fix(dev-infra): prevent verbose messaging of git checkout and commit for release (#42871)
Prevent logging verbose messages to the output for commit and checkout during
the release process.

PR Close #42871
2021-07-19 17:15:53 -07:00
Joey Perrott fd92a3e87f fix(dev-infra): perform actual npm login verification for wombot proxy (#42871)
Previously the wombot proxy was not able to be queried for login state, now
that it is able to be checked via `npm whoami` a specific alternate flow
is no longer needed.

PR Close #42871
2021-07-19 17:15:53 -07:00
Joey Perrott 89509dffd2 refactor(dev-infra): provide entire pull request object to waitForPullRequestToBeMerged (#42871)
`waitForPullRequestToBeMerged` should get the entire `PullRequest` object rather than
just the id to allow it to have more information/context for logging and messaging.

PR Close #42871
2021-07-19 17:15:53 -07:00
Andrew Kushnir c1c1cda866 Revert "refactor(dev-infra): add spawnSync to child process utils, normalize naming of child-process utils (#42394)" (#42829)
This reverts commit 08444c6679.

PR Close #42829
2021-07-12 15:24:55 -07:00
Joey Perrott 08444c6679 refactor(dev-infra): add spawnSync to child process utils, normalize naming of child-process utils (#42394)
Create a `spawnSync` command for common usage, additionally update naming to use `spawn` instead of
`spawnWithDebugOutput`

PR Close #42394
2021-07-12 14:39:07 -07:00
Paul Gschwendtner b5ab7aff43 refactor: add override keyword to members implementing abstract declarations (#42512)
In combination with the TS `noImplicitOverride` compatibility changes,
we also want to follow the best-practice of adding `override` to
members which are implemented as part of abstract classes. This
commit fixes all instances which will be flagged as part of the
custom `no-implicit-override-abstract` TSLint rule.

PR Close #42512
2021-07-12 13:11:17 -07:00
Paul Gschwendtner 907363348a refactor(dev-infra): ensure compatibility with noImplicitOverride (#42512)
Adds the `override` keyword to the `dev-infra` sources to ensure
compatibility with `noImplicitOverride`.

PR Close #42512
2021-07-12 13:11:14 -07:00
Paul Gschwendtner 762e057e85 build: update to rules_nodejs v4.0.0-beta.0 (#42760)
Updates the Bazel NodeJS rules to v4.0.0-beta.0. This is necessary
so that the Angular components repo can update, and it's generally
good to stay as up-to-date as possible with the Bazel rules as it's
easy to fall behind, and updating early allows us to discover issues
affecting our tooling earlier (where they are easier to address due to
e.g. potential breaking change policy).

PR Close #42760
2021-07-09 14:50:15 -07:00
Paul Gschwendtner 279e63f65f refactor(dev-infra): update octokit to latest version v18 (#42666)
We previously held off with updating Octokit to v18 due to
their more noticable issues with typings. This commit updates
us to the latest version in order to take advantage of the new
pagination API (which is also strongly-typed), and to not fall
behind too much over time (Octokit seems to change quite often..)

We work around the problem with the types for `getContent` by just
using a type cast with a TODO (and link to the issue). Similarly we
work around a problem where the Octokit types have an incorrect type
for the name of the labels array in an API response.

PR Close #42666
2021-06-29 10:33:54 -07:00
Paul Gschwendtner 1684b70b88 test(dev-infra): always use same virtual git client instance in publish tests (#42468)
With the recent refactorings to `GitClient`, where singletons
are created and can be retrieved through a static method, the
test has been updated to also install spies for the static methods
of `GitClient`. This commit updates the spy installation so that
the same mock git client is used that is also passed manually to
the release actions. Having two separate instances of the mock
git client could result in false-positive test results.

PR Close #42468
2021-06-03 14:34:33 -07:00
Paul Gschwendtner 67f65a9d25 refactor(dev-infra): improve type-safety of git client utility (#42468)
Currently the `GitClient` accepts a generic parameter for determining
whether the `githubToken` should be set or not. This worked fine so far
in terms of distinguishing between an authenticated and
non-authenticated git client instance, but if we intend to conditionally
show methods only for authenticated instances, the generic parameter
is not suitable.

This commit splits up the `GitClient` into two classes. One for
the base logic without any authorization, and a second class that
extends the base logic with authentication logic. i.e. the
`AuthenticatedGitClient`. This allows us to have specific methods only
for the authenticated instance. e.g.

  * `hasOauthScopes` has been moved to only exist for authenticated
    instances.
  * the GraphQL functionality within `gitClient.github` is not
    accessible for non-authenticated instances. GraphQL API requires
    authentication as per Github.

The initial motiviation for this was that we want to throw if
`hasOAuthScopes` is called without the Octokit instance having
a token configured. This should help avoiding issues as within
3b434ed94d
that prevented the caretaker process momentarily.

Additionally, the Git client has moved from `index.ts` to
`git-client.ts` for better discoverability in the codebase.

PR Close #42468
2021-06-03 14:34:33 -07:00
Joey Perrott aeb407296b refactor(dev-infra): update to later version of @octokit/rest and remove class extenstion of Octokit (#42395)
Update @octokit/rest and remove the usage of a class extension of Octokit as the
class does not have a class define constructor.

PR Close #42395
2021-06-01 10:14:48 -07:00
Joey Perrott 594e63315e feat(dev-infra): add release notes generation to ng-dev (#42225)
Adds tooling to create ad-hoc release note entries via `ng-dev release notes`.

PR Close #42225
2021-05-25 18:00:04 +00:00
Joey Perrott a9584c929b refactor(dev-infra): move the release notes into its own directory under release (#42225)
Move the release notes tooling under its own directory under release rather than
within publish, in preparation to have a release note generation command for ad-hoc
release note generation.

PR Close #42225
2021-05-25 18:00:04 +00:00
Joey Perrott 4ac55ca676 fix(dev-infra): use template strings for release note templates (#42224)
Use template strings for release note templates rather than loading `ejs` files at runtime.

PR Close #42224
2021-05-24 14:48:02 +00:00
Paul Gschwendtner 9d75687f62 feat(dev-infra): publish major versions to "next" NPM dist tag (#42133)
Previously, the dev-infra release tool would publish major versions
directly to the NPM `@latest` dist tag. This is correct in theory, but
rather unpractical given that we want to publish packages first as
`@next` so that other dependent Angular packages can update too,
allowing us to publish all main Angular packages (from FW, COMP
and TOOL) at the same time to `@latest` on NPM.

This involves creating a new release action for re-tagging the
previously released major as `@latest` on NPM.

PR Close #42133
2021-05-18 14:04:14 -07:00
Paul Gschwendtner 48f49bacb4 refactor(dev-infra): improve type safety of NPM dist tags in release tool (#42133)
Instead of passing `string` in the release tool for NPM dist tags, we
should use a union string type that limits the tags to `latest`, `next`
and anything matching `v{number}-lts`. This avoids mistakes at
compilation-level if an invalid/unknown tag would be set by a release
action.

PR Close #42133
2021-05-18 14:04:14 -07:00
Joey Perrott 6d87895ffd test(dev-infra): add testing for integration of ReleaseNotes in publishing tooling (#41967)
Add testing of the ReleaseNotes integration with the release publishing tooling.

PR Close #41967
2021-05-14 21:07:27 +00:00
Paul Gschwendtner 7fb8527e1e refactor(dev-infra): remove invoke bazel clean command from release tool (#42101)
Currently the ng-dev release tool always run `bazel clean` before
calling the configured build release function. The clean is necessary
to ensure the release output is actually built; and not restored
from previous builds which could have different bazel workspace
status variables (which provide the NPM package version).

Instead of doing this as part of the release tool, the
actual script running to build the release output should
run the `bazel clean`. The release tool does not intend to
know about details on how the release output is built. This
is necessary because the build setup could vary between version
branches (especially for older ones; such as LTS version branches).

PR Close #42101
2021-05-14 21:06:09 +00:00
Joey Perrott 4d7294d9f7 feat(dev-infra): include release notes in Github release entries when publishing (#41964)
Include the release notes entry for the release in the release created on Github.

PR Close #41964
2021-05-06 15:45:48 -04:00
Joey Perrott 393ce94718 feat(dev-infra): Set up new common release notes generation tooling (#41905)
Enables the new common release notes generation within the ng-dev release publishing
tooling.

PR Close #41905
2021-05-06 09:40:29 -04:00
Paul Gschwendtner 530e45f093 fix(dev-infra): publish script python check not working on windows (#41943)
We recently added a sanity check that ensures that `python` is
available for Bazel. The check relies on `/usr/bin/python` to check
if python is available w/ the correct version. The problem is
that on Windows there is no guarantee that the `/usr/bin` folder
exists, so the `ng-dev release publish` command always fails.

We fix this by just accessing the `env` binary that is also consulted
by scripts executed within Bazel actions. The `env` binary can be
assumed exist in the shell's `$PATH` and can point us to Python
as if it would be executed within Bazel.

PR Close #41943
2021-05-05 13:46:03 -07:00
Paul Gschwendtner 21c2a06811 fix(dev-infra): spawned child processes messing with tty output (#41948)
Currently we have a common utility method for running commands
in a child process. This method pipes all stdout and stderr, but sets
the `stdin` to `inherited`. This seemed to work as expected in terms of
allowing interactive commands being executed, but it messes with the
TTY in Windows (and potentially other platforms) so that colors and
prompts no longer work properly. See attached screenshot.

We fix this by not inheriting the stdin by default; but exposing
a dedicated method for interactive commands. This results in more
readable and obvious code too, so it's worth making this change
regardless of the TTY issues.

PR Close #41948
2021-05-05 13:45:28 -07:00
Paul Gschwendtner 5947239f89 fix(dev-infra): do not set lts dist tag on packages from release-candidate train (#41946)
Currently if a major release-train in the `release-candidate`/`feature-freeze`
phase becomes `latest`, we intend to set the NPM LTS dist tag for all packages
of the previous major (as the old release train in `latest` moves into LTS phase).

The logic for this exists but the release tool sets the NPM dist tag for
all packages of the new major. This means that the script might error if
a new package is part of the new major; or it could cause a deleted
package to not receive the LTS tag properly.

PR Close #41946
2021-05-04 21:07:57 -07:00
George Kalpakas fff2ca540f fix(dev-infra): correctly detect prettier config (#41860)
This commit uses the correct property name (`prettier` vs `pretter`) to
check whether prettier is enabled via the config.

(It also fixes some typos in `dev-infra`.)

PR Close #41860
2021-04-28 09:21:09 -07:00
Paul Gschwendtner 1b00533f8b test(dev-infra): publish test should not rely on external http request (#41767)
A test for the dev-infra publish tool currently relies on an external
http request by accident. This will break if we disallow internet
access within RBE containers.

PR Close #41767
2021-04-23 11:01:40 -07:00
Joey Perrott a4a55f0687 fix(dev-infra): verify python3 is available before release (#41753)
Verify that the /usr/bin/python points to the python3 interpreter binary.

PR Close #41753
2021-04-21 17:31:22 -07:00
George Kalpakas 7c353d452e refactor(dev-infra): remove unused argument from `publish` script (#41688)
Since recently, the `githubToken` parameter passed to the `ReleaseTool`
constructor is no longer used. This commit removes the unused parameter
and also the corresponding argument from the `publish` script.

PR Close #41688
2021-04-19 08:28:34 -07:00
Joey Perrott dd4c3dba3f refactor(dev-infra): move `getRepoBaseDir()` to `GitClient` (#41527)
As `getRepoBaseDir()` relies on git, it should be a method on `GitClient` for retrieval
rather than its own utility outside of the common GitClient used for all git ineractions.

PR Close #41527
2021-04-15 11:28:12 -07:00
Alan Agius ed7d288364 build: update several dependencies (#41434)
With this change we update several dependencies to avoid Renovate creating a lot of PRs during onboarding. We also remove yarn workspaces as after further analysis these are not needed.

Certain dependencies such as `@octokit/rest`, `remark` and `@babel/*` have not been updated as they require a decent amount of work to update, and it's best to leave them for a seperate PR.

PR Close #41434
2021-04-12 16:46:29 -07:00
Joey Perrott 9bf8e5164d refactor(dev-infra): use a singleton for GitClient (#41515)
Creates a singleton class for GitClient rather than relying on creating an instance to
require being passed around throughout its usages.

PR Close #41515
2021-04-12 16:43:54 -07:00
Joey Perrott 5e0d5a9ec2 feat(dev-infra): create ReleaseNotes class for generating release notes during publishing (#41476)
Generate release notes to be used for entries in both CHANGELOG.md files as well as
Github releases.

PR Close #41476
2021-04-09 07:49:48 -07:00
Joey Perrott a43f36babd fix(dev-infra): require npm login for all publishes via wombat proxy (#41422)
Due to an issue with wombat proxy returning the login state of the generated tokens,
we will need to require a login for all `ng-dev release publish` runs to ensure npm
login has occured.

PR Close #41422
2021-04-02 10:30:18 -07:00
Joey Perrott 153e3a8960 test(dev-infra): fix test order failure in tests for the release command (#41023)
Depending on test order, the `_npmPackageInfoCache` contains information
which causes the prompt results to be slightly different text.

PR Close #41023
2021-03-08 10:33:07 -08:00
Joey Perrott 29043d9858 fix(dev-infra): properly tag github releases as prerelease as appropriate (#40999)
Previously all github releases created by the release tooling tagged
releases as `latest`. Instead releases which are created for the `next`
tag on NPM should be tagged as `prerelease` for github.

PR Close #40999
2021-02-26 15:16:55 -08:00
Joey Perrott f05715bcac fix(dev-infra): clear cached bazel outputs before building artifacts for publishing (#41000)
Clearing the cached bazel outputs before building the artifacts for
publishing prevents an intermittent error found when the version is
cached between publishes.

PR Close #41000
2021-02-26 15:16:01 -08:00
Joey Perrott cbdb5e208e fix(dev-infra): update type castings for JSON.parse usage (#40710)
Update usages of JSON.parse to be cast as specific types.

PR Close #40710
2021-02-09 10:48:43 -08:00
Joey Perrott dceede4f80 fix(dev-infra): wait for changelog to cherry pick to next branch (#40605)
Wait for the cherry-picked changelog to be merged into the next
branch before completing the task.

PR Close #40605
2021-01-28 09:02:57 -08:00
Joey Perrott 27a818a0e7 fix(dev-infra): check and validate npm login state for release publishing (#40485)
Check and require logging into NPM before beginning the release process.

PR Close #40485
2021-01-27 10:34:21 -08:00
Joey Perrott 158269cb94 feat(dev-infra): automatically add labels to release PRs (#40016)
Automatically add provided labels to PRs created for release.

PR Close #40016
2021-01-25 10:49:56 -08:00
Joey Perrott 64628a4d7d fix(dev-infra): write to unique log file for `FATAL_ERROR`s in release tooling (#40524)
Write to the unique log file, to prevent being overwritten, for `FATAL_ERROR`
failures in the release tooling.  This will help to assist in determining where
something goes wrong in the process as well as being able to resume the action.

PR Close #40524
2021-01-25 10:47:41 -08:00
Joey Perrott 7a819caef6 fix(dev-infra): delay checking if a closed pr has been merged by 30 seconds (#40181)
Delaying the check if a closed PR was closed by a merge or just closed by 30 seconds
allows for Github to have time to update the PR to be associated to the commit which
closed the PR.  Without this delay, a race condition can exist in which we check for
how a PR was closed before this association is made.

PR Close #40181
2021-01-08 09:38:19 -08:00
Joey Perrott 5a49465ce0 fix(dev-infra): verify the version of generated build artifacts (#39789)
Verify the version of the generated build artifacts to ensure that
the version published to NPM is the version we expect.

PR Close #39789
2020-11-23 12:08:21 -08:00