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

feat: Add experimental & nightly release channels for vsce #6997

Merged
merged 2 commits into from
Feb 17, 2025
Merged

Conversation

abeatrix
Copy link
Contributor

@abeatrix abeatrix commented Feb 7, 2025

CLOSE: https://linear.app/sourcegraph/issue/CODY-4777

This adds support for publishing nightly builds of the VS Code extension under a different package name and display name to avoid conflicts with the main extension.

  • Added 'nightly' as a new ReleaseType enum value
  • Added updatePackageForNightly() function to modify package.json for nightly builds
  • Changed package name to 'cody-ai-nightly' for nightly releases
  • Updated display name to 'Cody: AI Code Assistant - Nightly'
  • Refactored insiders build checks to include nightly builds
  • Updated publishing logic to handle nightly builds same as insiders
  • Release nightly build under pre-release channel under the new name

NOTE: The nightly build is not intended to work with the main extension and is expected to cause conflicts if both are installed.

Test plan

  1. Run release script with CODY_RELEASE_TYPE=nightly pnpm -C vscode run release:dry-run to generate a package for the nightly
  2. Install the nightly builld using the package you can find in vscode/dist/cody.vsix
  • Verify extension is installed with the updated name and display name. You might need to disable the stable release to avoid conflicts.
image

Expected behavior per release type

Stable (sourcegraph.cody-ai):

  • Builds as production release
  • Removes all experimental settings
  • Uses version directly from package.json
  • Published to VS Code Marketplace main channel
  • Triggered by git tag push

Insiders / Pre-release (sourcegraph.cody-ai):

  • Builds as pre-release version
  • Keeps experimental settings
  • Uses incremented version with timestamp
  • Published to VS Code Marketplace pre-release channel
  • Creates an insiders tag

Experimental (sourcegraph.cody-testing):

  • Changes package name to cody-testing
  • Changes display name to "Testing Extension"
  • Keeps experimental settings
  • Uses incremented version with timestamp
  • Published to VS Code Marketplace main channel under cody-testing
  • Creates an experimental tag

Nightly (sourcegraph.cody-testing):

  • Changes package name to cody-testing
  • Changes display name to "Testing Extension"
  • Keeps experimental settings
  • Uses incremented version with timestamp
  • Published to VS Code Marketplace pre-release channel under cody-testing
  • Creates a nightly tag
  • Runs automatically every night

This adds support for publishing nightly builds of the VS Code extension
under a different package name and display name to avoid conflicts with
the main extension.

- Added 'nightly' as a new ReleaseType enum value
- Added updatePackageForNightly() function to modify package.json for nightly builds
- Changed package name to 'cody-ai-nightly' for nightly releases
- Updated display name to 'Cody: AI Code Assistant - Nightly'
- Refactored insiders build checks to include nightly builds
- Updated publishing logic to handle nightly builds same as insiders

## Test plan

1. Run release script with `CODY_RELEASE_TYPE=nightly pnpm -C vscode run release:dry-run` to generate a package for the nightly
2. Install the nightly builld using the package you can find in `vscode/dist/cody.vsix`
- Verify extension is installed with the updated name and display name. You might need to disable the stable release to avoid conflicts.
@abeatrix abeatrix requested review from dominiccooney and a team February 7, 2025 06:31
@abeatrix abeatrix changed the title feat: Add nightly release type for extension release feat: Add experimental & nightly release channels for vsce Feb 7, 2025
Copy link
Contributor

@dominiccooney dominiccooney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback inline, I think we should make nightlies use the prerelease channel of the testing extension.

Related question... people seem to really want to see things "straight away" on this channel. Can we simply make this build continuously? Like every commit that passes the tests, we pop out a version?

service_account: "[email protected]"
create_credentials_file: true
export_environment_variables: true
- run: CODY_RELEASE_TYPE=experimental pnpm -C vscode run release
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like I mentioned in chat, I think should use the prerelease channel of the testing extension for nightlies so that if we cut an experimental build it is not immediately hidden by nightlies. Think it through... if we wanted to distribute an experimental build (say, to a customer or to teammates for testing something like the merged network requests I'm working on) and we use the release channel of the testing extension for nightlies, then:

  • We will make the experimental build on the prerelease channel
  • That night, the nightly build will run and do a build on the release channel
  • Then the experimental build is hidden on the prerelease channel by the nightly, confusion reigns.

You know the thing we see where we have to cut the prerelease build after the stable release? Same thing is happening here. Does that make sense?

Slack message for context:

https://sourcegraph.slack.com/archives/C05AGQYD528/p1738920451420479?thread_ts=1738897284.665109&cid=C05AGQYD528

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think should use the prerelease channel of the testing extension for nightlies
@dominiccooney See https://github.com/sourcegraph/cody/pull/6997/files#r1953839488

function updatePackageForTestingExtension(): void {
if (releaseType === ReleaseType.Nightly || releaseType === ReleaseType.Experimental) {
packageJSON.name = 'cody-testing'
packageJSON.displayName = 'Testing Extension'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -124,7 +140,7 @@ if (!insidersVersion) {
}

const githubOutputPath = process.env.GITHUB_OUTPUT
if (releaseType === ReleaseType.Insiders && githubOutputPath) {
if (isInsiderBuild && githubOutputPath) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh this is interesting, "insider" means something different from "prerelease" now... Prerelease and Nightly are "insiders."


// Package (build and bundle) the extension.
console.error(`Packaging ${releaseType} release at version ${version}...`)
execFileSync(
'vsce',
[
'package',
...(releaseType === ReleaseType.Insiders
...(isInsiderBuild
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dominiccooney nightly is actually using the pre-release channel. You can see const isInsiderBuild = releaseType === ReleaseType.Insiders || releaseType === ReleaseType.Nightly, so we would add the --pre-release` flag here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! To summarize:

We want to have four "channels":

  • Stable
  • Prerelease
  • Nightly
  • Experimental

We have to map them to two extensions, I'll just call them Cody and Test for now. And they each have two channels:

  • Release
  • Prerelease

You see those labels on the IDE extensions page:
Screenshot 2025-02-17 at 12 02 39

Most important fact here is that 🌵 Release "overwrites" Prerelease until there is another prerelease. This is why we wait to do the stable build before we make the next milestone's prerelease. If we did it the other way, then both channels would show the stable version and nobody would dogfood the prerelease. This is a quirk of VSCode Marketplace.

We're going to split the channels between the extensions this way:
Cody: Stable and Prerelease ⬅️ most people here
Test: Nightly and Experimental ⬅️ some teammates and customers trying bleeding-edge things here

Within each extension, there's a "fast" one that gets produced more and a "slow" one that gets produced less often. Because of 🌵 , we need the "fast" one to be on the pre-release channel.

So we need this:
Cody - Release - Stable
Cody - Prerelease - Prerelease
Test - Release - Experimental
Test - Prerelease - Nightly

Could we add something like the above to Notion, on the branching and releasing page?

service_account: "[email protected]"
create_credentials_file: true
export_environment_variables: true
- run: CODY_RELEASE_TYPE=nightly pnpm -C vscode run release
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dominiccooney here we are adding nightly so we would add --pre-release later

Copy link
Contributor

@dominiccooney dominiccooney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, got it... it is the environment variable set to nightly that puts these on the test extension prerelease channel. Perfect!


// Package (build and bundle) the extension.
console.error(`Packaging ${releaseType} release at version ${version}...`)
execFileSync(
'vsce',
[
'package',
...(releaseType === ReleaseType.Insiders
...(isInsiderBuild
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! To summarize:

We want to have four "channels":

  • Stable
  • Prerelease
  • Nightly
  • Experimental

We have to map them to two extensions, I'll just call them Cody and Test for now. And they each have two channels:

  • Release
  • Prerelease

You see those labels on the IDE extensions page:
Screenshot 2025-02-17 at 12 02 39

Most important fact here is that 🌵 Release "overwrites" Prerelease until there is another prerelease. This is why we wait to do the stable build before we make the next milestone's prerelease. If we did it the other way, then both channels would show the stable version and nobody would dogfood the prerelease. This is a quirk of VSCode Marketplace.

We're going to split the channels between the extensions this way:
Cody: Stable and Prerelease ⬅️ most people here
Test: Nightly and Experimental ⬅️ some teammates and customers trying bleeding-edge things here

Within each extension, there's a "fast" one that gets produced more and a "slow" one that gets produced less often. Because of 🌵 , we need the "fast" one to be on the pre-release channel.

So we need this:
Cody - Release - Stable
Cody - Prerelease - Prerelease
Test - Release - Experimental
Test - Prerelease - Nightly

Could we add something like the above to Notion, on the branching and releasing page?

@abeatrix
Copy link
Contributor Author

@dominiccooney Thanks for the review! I've created a issue to add that to Notion release handbook: https://linear.app/sourcegraph/issue/CODY-5050/update-release-handbook-to-include-cody-test-release

@abeatrix abeatrix merged commit 3027810 into main Feb 17, 2025
25 checks passed
@abeatrix abeatrix deleted the bee/nightly branch February 17, 2025 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants