chore: use SKIP_RELEASE_CHANGELOG_VALIDATION env var to skip release-… (#27670)

This commit is contained in:
Chris Breiding
2023-08-25 16:44:13 -04:00
committed by GitHub
parent dc5ebd1738
commit c763d85f54
4 changed files with 50 additions and 4 deletions
+5 -3
View File
@@ -48,7 +48,7 @@ The `@cypress/`-namespaced NPM packages that live inside the [`/npm`](../npm) di
- [`cypress-documentation`](https://github.com/cypress-io/cypress-documentation)
- [`cypress-docker-images`](https://github.com/cypress-io/cypress-docker-images)
- [cypress-io/release-automations][release-automations]
If you don't have access to 1Password, ask a team member who has done a deploy.
@@ -88,7 +88,7 @@ _Note: It is advisable to notify the team that the `develop` branch is locked do
2. Ensure all changes to the links manifest to [`on.cypress.io`](https://github.com/cypress-io/cypress-services/tree/develop/packages/on) have been merged to `develop` and deployed.
3. Create a Release PR -
3. Create a Release PR -
Bump, submit, get approvals on, and merge a new PR. This PR should:
- Bump the Cypress `version` in [`package.json`](package.json)
- Bump the [`packages/example`](../packages/example) dependency if there is a new [`cypress-example-kitchensink`](https://github.com/cypress-io/cypress-example-kitchensink/releases) version
@@ -185,7 +185,9 @@ _Note: It is advisable to notify the team that the `develop` branch is locked do
23. Notify the team that `develop` is reopen, and post a message to the Releases Slack channel with a link to the changelog.
24. Check all `cypress-test-*` and `cypress-example-*` repositories, and if there is a branch named `x.y.z` for testing the features or fixes from the newly published version `x.y.z`, update that branch to refer to the newly published NPM version in `package.json`. Then, get the changes approved and merged into that project's main branch. For projects without a `x.y.z` branch, you can go to the Renovate dependency issue and check the box next to `Update dependency cypress to X.Y.Z`. It will automatically create a PR. Once it passes, you can merge it. Try updating at least the following projects:
24. If utilizing the `SKIP_RELEASE_CHANGELOG_VALIDATION_FOR_BRANCHES` to override and skip changelog validation for this release, change its value as needed or delete it from CircleCI so that subsequent releases and PRs will go through changelog validation.
25. Check all `cypress-test-*` and `cypress-example-*` repositories, and if there is a branch named `x.y.z` for testing the features or fixes from the newly published version `x.y.z`, update that branch to refer to the newly published NPM version in `package.json`. Then, get the changes approved and merged into that project's main branch. For projects without a `x.y.z` branch, you can go to the Renovate dependency issue and check the box next to `Update dependency cypress to X.Y.Z`. It will automatically create a PR. Once it passes, you can merge it. Try updating at least the following projects:
- [cypress-example-todomvc](https://github.com/cypress-io/cypress-example-todomvc/issues/99)
- [cypress-realworld-app](https://github.com/cypress-io/cypress-realworld-app/issues/41)
- [cypress-example-recipes](https://github.com/cypress-io/cypress-example-recipes/issues/225)
@@ -12,7 +12,7 @@ const changelog = async () => {
if (process.env.CIRCLECI) {
console.log({ checkedInBinaryVersion })
if (process.env.CIRCLE_BRANCH !== 'develop' && process.env.CIRCLE_BRANCH !== 'fix-changelog-script' && !/^release\/\d+\.\d+\.\d+$/.test(process.env.CIRCLE_BRANCH) && !hasVersionBump) {
if (process.env.CIRCLE_BRANCH !== 'develop' && process.env.CIRCLE_BRANCH !== 'add-skip-changelog-validation' && !/^release\/\d+\.\d+\.\d+$/.test(process.env.CIRCLE_BRANCH) && !hasVersionBump) {
console.log('Only verify the entire changelog for develop, a release branch or any branch that bumped to the Cypress version in the package.json.')
return
@@ -124,8 +124,22 @@ const _handleErrors = (errors) => {
/**
* Determines if the Cypress changelog has the correct next version and changelog entires given the provided
* list of commits.
*
* Can be skipped by setting the SKIP_RELEASE_CHANGELOG_VALIDATION_FOR_BRANCHES
* environment variable in CircleCI to a branch or comma-separated list of
* branches
*/
async function validateChangelog ({ changedFiles, nextVersion, pendingRelease, commits }) {
if (process.env.SKIP_RELEASE_CHANGELOG_VALIDATION_FOR_BRANCHES) {
const branches = process.env.SKIP_RELEASE_CHANGELOG_VALIDATION_FOR_BRANCHES.split(',')
if (branches.includes(process.env.CIRCLE_BRANCH)) {
console.log(`Skipping changelog validation because branch (${process.env.CIRCLE_BRANCH}) is included in SKIP_RELEASE_CHANGELOG_VALIDATION_FOR_BRANCHES`)
return []
}
}
const hasUserFacingCommits = commits.some(({ semanticType }) => hasUserFacingChange(semanticType))
if (!hasUserFacingCommits) {
@@ -114,14 +114,24 @@ describe('semantic-pull-request/validate-changelog', () => {
})
context('validateChangelog', () => {
let circleBranch
beforeEach(function () {
sinon.spy(console, 'log')
sinon.stub(fs, 'readFileSync')
circleBranch = process.env.CIRCLE_BRANCH
// delete this in case it's set in actual Circle env vars
delete process.env.SKIP_RELEASE_CHANGELOG_VALIDATION_FOR_BRANCHES
})
afterEach(function () {
console.log.restore()
fs.readFileSync.restore()
process.env.CIRCLE_BRANCH = circleBranch
// clean up after the test that sets and tests it
delete process.env.SKIP_RELEASE_CHANGELOG_VALIDATION_FOR_BRANCHES
})
it('verifies changelog entry has been included', async () => {
@@ -215,6 +225,26 @@ _Released 01/17/2033 (PENDING)_
expect(console.log).to.be.calledWith('Does not contain changes that impacts the next Cypress release.')
})
it('when current branch is in SKIP_RELEASE_CHANGELOG_VALIDATION_FOR_BRANCHES env var', async () => {
process.env.CIRCLE_BRANCH = 'this-branch'
process.env.SKIP_RELEASE_CHANGELOG_VALIDATION_FOR_BRANCHES = 'this-branch,that-branch'
const changedFiles = [
'npm/grep/lib/index.js',
]
await validateChangelog({
changedFiles,
commits: [{
prNumber: 77,
semanticType: 'feat',
associatedIssues: ['75'],
}],
})
expect(console.log).to.be.calledWith('Skipping changelog validation because branch (this-branch) is included in SKIP_RELEASE_CHANGELOG_VALIDATION_FOR_BRANCHES')
})
})
describe('throws an error when', () => {