From 95a56471968472b5af42a742a11d9fd9fe440704 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Tue, 27 Apr 2021 18:05:27 +0200 Subject: [PATCH] chore: rename default branch to main MONGOSH-245 --- .github/workflows/cron-tasks.yml | 4 ++-- packages/build/README.md | 10 ++++----- packages/build/branches-and-tags.svg | 2 +- .../config/should-do-public-release.spec.ts | 12 +++++----- .../src/config/should-do-public-release.ts | 4 ++-- .../build/src/git/repository-status.spec.ts | 22 +++++++++---------- .../src/local/trigger-release-draft.spec.ts | 6 ++--- packages/cli-repl/README.md | 4 +--- packages/types/package.json | 2 +- scripts/docker/README.md | 4 ++-- scripts/docker/build.sh | 2 +- 11 files changed, 35 insertions(+), 37 deletions(-) diff --git a/.github/workflows/cron-tasks.yml b/.github/workflows/cron-tasks.yml index 59b9ebfe2e..2b30c908dc 100644 --- a/.github/workflows/cron-tasks.yml +++ b/.github/workflows/cron-tasks.yml @@ -1,10 +1,10 @@ on: - # Once a week or on pushes to master + # Once a week or on pushes to main schedule: - cron: "0 3 * * 0" push: branches: - - master + - main jobs: update_third_party_notices_and_authors: diff --git a/packages/build/README.md b/packages/build/README.md index b79314690b..35ca70920e 100644 --- a/packages/build/README.md +++ b/packages/build/README.md @@ -37,10 +37,10 @@ Execute the following steps to publish a new release: Follow the instructions and verify the inferred release version is correct. 6. Wait for Evergreen to finish the publication stage. 7. Close the Jira ticket for the release, post an update in the `#mongosh` Slack channel and ping the docs team. - + ### Branches and Tags -Typically, a release is always created from the main branch (currently `master`). The only exception are _patch releases_, i.e. when we need to fix an issue for an already published, already superseeded release. Patch releases are created from _release branches_ that match the following pattern: +Typically, a release is always created from the main branch (currently `main`). The only exception are _patch releases_, i.e. when we need to fix an issue for an already published, already superseeded release. Patch releases are created from _release branches_ that match the following pattern: ``` release/v[0-9]+\.[a-zA-Z0-9]+\.[a-zA-Z0-9]+ ``` @@ -56,7 +56,7 @@ See the following image for a general overview on how we handle these branches a We use two different types of tags for the automated release process: draft and release tags. A release tag has the form `v..`, e.g. `v0.8.0`. A draft tag is `v..-draft.`, e.g. `v0.8.0-draft.0`. Draft tags are used to trigger the automated release process. Every draft tag in the end leads to the generation of _potentially_ distributable packages with compiled binaries. - + Release tags are used to trigger the publication of a release and its corresponding distributable packages. A release tag must referenced the commit with the most recent draft tag for that release version (example: `v0.8.0` must reference the commit with the highest `v0.8.0-draft.x` tag). The automated release process for publication of a release will re-use the compiled binaries and packages that were created in the most recent draft tag. Thus, every release tag requires a prior draft tag to be present. The release automation process is handled by [Evergreen](#evergreen-ci). @@ -69,7 +69,7 @@ For full details on the project's configuration see the Evergreen configuration ### Evergreen Triggers Evergreen builds and _patches_ are triggered in multiple ways. The Mongo Shell project is setup to be triggered by: -* New commits on the main branch (currently `master`, i.e. _waterfall builds_ +* New commits on the main branch (currently `main`, i.e. _waterfall builds_ * New Pull Requests against the main branch on GitHub (i.e. _patches_) * A new tag matching `v0.0.0-draft.0` is pushed on the main or a release branch (i.e. a draft build is triggered) * A new tag matching `v0.0.0` is pushed on the main or a release branch (i.e. a release is to be published) @@ -116,7 +116,7 @@ The _Publish_ stage is independent from all other stages. As mentioned at the be ## Package Structure The package has two major purposes: -* Custom build commands to handle the stages outlined above +* Custom build commands to handle the stages outlined above * Provide easy helpers to trigger the release process See [index.ts](./src/index.ts) for the main entry point on the different commands. diff --git a/packages/build/branches-and-tags.svg b/packages/build/branches-and-tags.svg index feb6ebf658..f9c6991faf 100644 --- a/packages/build/branches-and-tags.svg +++ b/packages/build/branches-and-tags.svg @@ -1,3 +1,3 @@ -
Overview: Branches and Tags
Overview: Branches and Tags
v0.8.0-draft.0
v0.8.0-draft.0
v0.8.0-draft.1
v0.8.0-draft.1
v0.8.0
v0.8.0
v0.9.0-draft.0
v0.9.0-draft.0
v0.9.0-draft.1
v0.9.0-draft.1
master
master
release/0.8.1
release/0.8.1
v0.8.1-draft.0
v0.8.1-draft.0
v0.8.1-draft.1
v0.8.1-draft.1
v0.8.1
v0.8.1
Commit
Commit
v0.8.0
v0.8.0
Release Tag
Release Tag
v0.8.0-draft.0
v0.8.0-draft.0
Draft Tag
Draft Tag
release/0.8.1
release/0.8.1
Branch
Branch
Viewer does not support full SVG 1.1
\ No newline at end of file +
Overview: Branches and Tags
Overview: Branches and Tags
v0.8.0-draft.0
v0.8.0-draft.0
v0.8.0-draft.1
v0.8.0-draft.1
v0.8.0
v0.8.0
v0.9.0-draft.0
v0.9.0-draft.0
v0.9.0-draft.1
v0.9.0-draft.1
main
main
release/0.8.1
release/0.8.1
v0.8.1-draft.0
v0.8.1-draft.0
v0.8.1-draft.1
v0.8.1-draft.1
v0.8.1
v0.8.1
Commit
Commit
v0.8.0
v0.8.0
Release Tag
Release Tag
v0.8.0-draft.0
v0.8.0-draft.0
Draft Tag
Draft Tag
release/0.8.1
release/0.8.1
Branch
Branch
Viewer does not support full SVG 1.1
diff --git a/packages/build/src/config/should-do-public-release.spec.ts b/packages/build/src/config/should-do-public-release.spec.ts index 66930134b6..741ba92cb6 100644 --- a/packages/build/src/config/should-do-public-release.spec.ts +++ b/packages/build/src/config/should-do-public-release.spec.ts @@ -9,28 +9,28 @@ describe('shouldDoPublicRelease', () => { }); - it('returns false when branch is not master', async() => { + it('returns false when branch is not main', async() => { const config: Partial = { branch: 'feature' }; expect(shouldDoPublicRelease(config as any)).to.be.false; }); - it('returns false when branch is master but not tagged', async() => { - const config: Partial = { branch: 'master' }; + it('returns false when branch is main but not tagged', async() => { + const config: Partial = { branch: 'main' }; expect(shouldDoPublicRelease(config as any)).to.be.false; }); it('returns false when current version does not match draft commit tag', async() => { - const config: Partial = { branch: 'master', triggeringGitTag: 'v0.0.4-draft.0', version: '0.0.4' }; + const config: Partial = { branch: 'main', triggeringGitTag: 'v0.0.4-draft.0', version: '0.0.4' }; expect(shouldDoPublicRelease(config as any)).to.be.false; }); it('returns false when current version does not match release commit tag', async() => { - const config: Partial = { branch: 'master', triggeringGitTag: 'v0.0.5', version: '0.0.4' }; + const config: Partial = { branch: 'main', triggeringGitTag: 'v0.0.5', version: '0.0.4' }; expect(shouldDoPublicRelease(config as any)).to.be.false; }); it('returns true when version matches commit tag', async() => { - const config: Partial = { branch: 'master', triggeringGitTag: 'v0.0.3', version: '0.0.3' }; + const config: Partial = { branch: 'main', triggeringGitTag: 'v0.0.3', version: '0.0.3' }; expect(shouldDoPublicRelease(config as any)).to.be.true; }); }); diff --git a/packages/build/src/config/should-do-public-release.ts b/packages/build/src/config/should-do-public-release.ts index 27e896ebd3..ee1a322e82 100644 --- a/packages/build/src/config/should-do-public-release.ts +++ b/packages/build/src/config/should-do-public-release.ts @@ -17,8 +17,8 @@ export function shouldDoPublicRelease(config: Config): boolean { return false; } - if (config.branch !== 'master') { - console.info('mongosh: skip public release: is not master'); + if (config.branch !== 'main') { + console.info('mongosh: skip public release: is not main'); return false; } diff --git a/packages/build/src/git/repository-status.spec.ts b/packages/build/src/git/repository-status.spec.ts index 0374076766..8f377d9c5b 100644 --- a/packages/build/src/git/repository-status.spec.ts +++ b/packages/build/src/git/repository-status.spec.ts @@ -184,7 +184,7 @@ describe('git repository-status', () => { it('detectes pending file changes', () => { spawnSync.onFirstCall().returns({ stdout: [ - '## master...origin/master', + '## main...origin/main', 'A packages/build/src/helpers/index.ts', 'A packages/build/src/helpers/spawn-sync.spec.ts', '?? packages/build/src/helpers/test', @@ -197,8 +197,8 @@ describe('git repository-status', () => { const status = getRepositoryStatus('somePath', spawnSync); expect(status).to.deep.equal({ branch: { - local: 'master', - tracking: 'origin/master', + local: 'main', + tracking: 'origin/main', diverged: false }, clean: false, @@ -209,7 +209,7 @@ describe('git repository-status', () => { it('detectes diverging branches', () => { spawnSync.returns({ stdout: [ - '## master...origin/something [ahead 5, behind 3]', + '## main...origin/something [ahead 5, behind 3]', 'A packages/build/src/helpers/index.ts', 'A packages/build/src/helpers/spawn-sync.spec.ts', '?? packages/build/src/helpers/test', @@ -222,7 +222,7 @@ describe('git repository-status', () => { const status = getRepositoryStatus('somePath', spawnSync); expect(status).to.deep.equal({ branch: { - local: 'master', + local: 'main', tracking: 'origin/something', diverged: true }, @@ -234,7 +234,7 @@ describe('git repository-status', () => { it('detectes missing origin', () => { spawnSync.returns({ stdout: [ - '## master' + '## main' ].join('\n') }); spawnSync.onSecondCall().returns({ @@ -244,7 +244,7 @@ describe('git repository-status', () => { const status = getRepositoryStatus('somePath', spawnSync); expect(status).to.deep.equal({ branch: { - local: 'master', + local: 'main', tracking: undefined, diverged: false }, @@ -256,7 +256,7 @@ describe('git repository-status', () => { it('detects unpushed tags', () => { spawnSync.onFirstCall().returns({ stdout: [ - '## master...origin/master' + '## main...origin/main' ].join('\n') }); spawnSync.onSecondCall().returns({ @@ -269,8 +269,8 @@ describe('git repository-status', () => { const status = getRepositoryStatus('somePath', spawnSync); expect(status).to.deep.equal({ branch: { - local: 'master', - tracking: 'origin/master', + local: 'main', + tracking: 'origin/main', diverged: false }, clean: true, @@ -299,7 +299,7 @@ describe('git repository-status', () => { }); it('returns undefined for non-release branches', () => { - const version = getReleaseVersionFromBranch('master'); + const version = getReleaseVersionFromBranch('main'); expect(version).to.be.undefined; }); }); diff --git a/packages/build/src/local/trigger-release-draft.spec.ts b/packages/build/src/local/trigger-release-draft.spec.ts index 8e2db2bc96..3f48d8b263 100644 --- a/packages/build/src/local/trigger-release-draft.spec.ts +++ b/packages/build/src/local/trigger-release-draft.spec.ts @@ -13,8 +13,8 @@ describe('local trigger-release-draft', () => { const cleanRepoStatus: RepositoryStatus = { branch: { - local: 'master', - tracking: 'origin/master', + local: 'main', + tracking: 'origin/main', diverged: false }, clean: true, @@ -59,7 +59,7 @@ describe('local trigger-release-draft', () => { expect(spawnSync.getCall(1)).calledWith('git', ['push', 'origin', 'v0.8.0-draft.8'], sinon.match.any); }); - it('asks for the bump type and pushes a new draft if previous tag was a release on master', async() => { + it('asks for the bump type and pushes a new draft if previous tag was a release on main', async() => { const latestTag: TaggedCommit = { commit: 'hash', tag: { diff --git a/packages/cli-repl/README.md b/packages/cli-repl/README.md index 237a7abae0..5ad27999c8 100644 --- a/packages/cli-repl/README.md +++ b/packages/cli-repl/README.md @@ -1,4 +1,4 @@ -# @mongosh/cli-repl [![Build Status][azure-build-url]][azure-build] +# @mongosh/cli-repl [Evergreen Build][evergreen-url] @@ -252,8 +252,6 @@ npm install --save @mongosh/cli-repl ``` [mongosh]: https://github.com/mongodb-js/mongosh -[azure-build-url]: https://dev.azure.com/team-compass/mongosh/_apis/build/status/mongodb-js.mongosh?branchName=master -[azure-build]: https://dev.azure.com/team-compass/mongosh/_build/latest?definitionId=5&branchName=master [evergreen-url]: https://evergreen.mongodb.com/waterfall/mongosh [pino-js]: https://github.com/pinojs/pino [object-id]: https://docs.mongodb.com/manual/reference/method/ObjectId/ diff --git a/packages/types/package.json b/packages/types/package.json index 3a5e4075fb..545b323f68 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -3,7 +3,7 @@ "version": "0.0.0-dev.0", "description": "Types for mongosh internals", "author": "Anna Henningsen ", - "homepage": "https://github.com/mongodb-js/mongosh/tree/master/packages/types#readme", + "homepage": "https://github.com/mongodb-js/mongosh/tree/main/packages/types#readme", "license": "Apache-2.0", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/scripts/docker/README.md b/scripts/docker/README.md index ab87fd638a..b7b72bf7f7 100644 --- a/scripts/docker/README.md +++ b/scripts/docker/README.md @@ -1,6 +1,6 @@ # Docker test images -This folder contains scripts and Dockerfiles to test the master build of mongosh on different linux distributions. +This folder contains scripts and Dockerfiles to test the main branch build of mongosh on different linux distributions. ## Usage @@ -10,4 +10,4 @@ bash scripts/docker/build.sh centos8-rpm ``` bash scripts/docker/run.sh centos8-rpm arg1 arg2 ... -``` \ No newline at end of file +``` diff --git a/scripts/docker/build.sh b/scripts/docker/build.sh index fc8fe07ad3..2905d2830a 100755 --- a/scripts/docker/build.sh +++ b/scripts/docker/build.sh @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")" if [ x"$ARTIFACT_URL" = x"" ]; then - SHA=`git rev-parse origin/master` + SHA=`git rev-parse origin/main` VERSION=`git show ${SHA}:lerna.json | grep version | cut -d ":" -f 2 | cut -d '"' -f 2` if echo "$1" | grep -q -- deb.Dockerfile; then ARTIFACT_URL="https://s3.amazonaws.com/mciuploads/mongosh/${SHA}/mongosh_${VESRION}_amd64.deb"