Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

fix(sg): cloud ephemeral - do no trigger builds on main-dry-run#64190

Merged
burmudar merged 1 commit into
mainfrom
wb/cloud-eph-deny-main-dry
Jul 31, 2024
Merged

fix(sg): cloud ephemeral - do no trigger builds on main-dry-run#64190
burmudar merged 1 commit into
mainfrom
wb/cloud-eph-deny-main-dry

Conversation

@burmudar

@burmudar burmudar commented Jul 31, 2024

Copy link
Copy Markdown
Contributor

Triggering cloud ephemeral builds on main-dry-run leads to unexpected results which is due to how the eventual pipeline is generated.

Closes DINF-165

Generated pipeline?

The pipeline gets generated based on what matches first. We detect cloud ephemeral builds if there is an environment variable CLOUD_EPHEMERAL=true. We detect main-dry-runs if the branch prefix is main-dry-run...

Now due to the main-dry-run match happening before the cloud ephemeral match a Cloud Ephemeral build on a main dry run gets detected as just a main-dry-run build.

Alternatives

Sure we can just move the Cloud Ephemeral match earlier, but it's difficult to say what else might break. We could also just add the we force the runtype to always be CloudEphemeral if we're on the Cloud Ephemeral pipeline, but I don't want to make the pipline a special snowflake and detect the current pipeline just for Cloud Ephemeral.

Why deny it the deployment?

Ultimately, main-dry-run builds are meant for ... main not cloud ephemeral. People can just switch to their original branch and run sg cloud eph deploy and the branch will be deployed with no issue

Test plan

Executed locally

./sg-test cloud eph build
⚠️ Running sg with a dev build, following flags have different default value unless explictly set: skip-auto-update, disable-analytics
⚠️ Triggering Cloud Ephemeral builds from "main-dry-run" branches are not supported. Try renaming the branch to not have the "main-dry-run" prefix as it complicates the eventual pipeline that gets generated

  To rename a branch and launch a cloud ephemeral deployment do:

  1.  git branch -m "main-dry-run/lol" <my-new-name>
  2.  git push --set-upstream origin <my-new-name>
  3. trigger the build by running  sg cloud ephemeral build
  FAQ https://www.notion.so/sourcegraph/How-to-deploy-my-branch-on-an-ephemeral-Cloud-instance-dac45846ca2a4e018c802aba37cf6465?pvs=4#20cb92ae27464891a9d03650b4d67cee


❌ failed to trigger epehemeral build for branch: main-dry-run branch is not supported

Changelog

  • sg: deny deployment of main-dry-run branches on Cloud Ephemeral.

@burmudar burmudar requested review from a team and filiphaftek July 31, 2024 14:10
@burmudar burmudar self-assigned this Jul 31, 2024
@cla-bot cla-bot Bot added the cla-signed label Jul 31, 2024

@filiphaftek filiphaftek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thx!

@burmudar burmudar merged commit 8a3e4c3 into main Jul 31, 2024
@burmudar burmudar deleted the wb/cloud-eph-deny-main-dry branch July 31, 2024 14:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants