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

sg: ignore config overwrite when generating reference for docs#39367

Merged
mrnugget merged 1 commit into
mainfrom
mrn/sg-generate-overwrite
Jul 25, 2022
Merged

sg: ignore config overwrite when generating reference for docs#39367
mrnugget merged 1 commit into
mainfrom
mrn/sg-generate-overwrite

Conversation

@mrnugget

Copy link
Copy Markdown
Contributor

Finally fixing this after it made me say "ah! oh no" one too many times
in the past few weeks.

Here's what previously happened on THORSTEN & SG GENERATE:

  1. Thorsten has a custom commandset named horsegraph in sg.config.overwrite.yaml, along with some other custom commands.
  2. Thorsten creates a database migration/GraphQL schema addition/...
  3. Thorsten runs sg generate
  4. Thorsten commits and pushes commit
  5. Thorsten sees that he pushed commit in which sg's reference in the
    documentation now contains "horsegraph" as an official commandset
    to be used with sg start
  6. Thorsten says "ah! oh no" and undoes changes

... multiple times.

So what this does here is introduce a disable-overwrite flag that
causes only the standard config to be read.

It's then used in the go:generate directive that runs sg help.

Test plan

  • See steps above. I tested this manually. This PR contains an updated reference (to include -disable-overwrite) but no custom commands.

Finally fixing this after it made me say "ah! oh no" one too many times
in the past few weeks.

Here's what previously happened on THORSTEN & SG GENERATE:

1. Thorsten has a custom commandset named `horsegraph` in `sg.config.overwrite.yaml`, along with some other custom commands.
2. Thorsten creates a database migration/GraphQL schema addition/...
3. Thorsten runs `sg generate`
4. Thorsten commits and pushes commit
5. Thorsten sees that he pushed commit in which `sg`'s reference in the
   documentation now contains `"horsegraph"` as an official commandset
   to be used with `sg start`
6. Thorsten says "ah! oh no" and undoes changes

... multiple times.

So what this does here is introduce a `disable-overwrite` flag that
causes only the standard config to be read.

It's then used in the `go:generate` directive that runs `sg help`.
@cla-bot cla-bot Bot added the cla-signed label Jul 25, 2022
@mrnugget mrnugget requested a review from a team July 25, 2022 13:45
@sourcegraph-bot

Copy link
Copy Markdown
Contributor

Codenotify: Notifying subscribers in OWNERS files for diff e3ec56a...27f4072.

Notify File(s)
@sourcegraph/dev-experience dev/sg/checks.go
dev/sg/dependencies/dependencies.go
dev/sg/dependencies/helpers.go
dev/sg/internal/sgconf/global.go
dev/sg/main.go
dev/sg/sg_db.go
dev/sg/sg_insights.go
dev/sg/sg_migration.go
dev/sg/sg_run.go
dev/sg/sg_setup.go
dev/sg/sg_start.go
dev/sg/sg_tests.go

@burmudar burmudar linked an issue Jul 25, 2022 that may be closed by this pull request

@jhchabran jhchabran 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.

Thank you! I was about to ask where would we need the overwrite when generating stuff, but actually we do for the ./internal/database/gen.sh script for example.

@burmudar burmudar 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.

LGTM! ❤️

@mrnugget

Copy link
Copy Markdown
Contributor Author

Thank you! I was about to ask where would we need the overwrite when generating stuff

It's in that one go:generate line that I changed in here.

@mrnugget mrnugget merged commit 3bab39a into main Jul 25, 2022
@mrnugget mrnugget deleted the mrn/sg-generate-overwrite branch July 25, 2022 16:40
coury-clark pushed a commit that referenced this pull request Jul 25, 2022
Finally fixing this after it made me say "ah! oh no" one too many times
in the past few weeks.

Here's what previously happened on THORSTEN & SG GENERATE:

1. Thorsten has a custom commandset named `horsegraph` in `sg.config.overwrite.yaml`, along with some other custom commands.
2. Thorsten creates a database migration/GraphQL schema addition/...
3. Thorsten runs `sg generate`
4. Thorsten commits and pushes commit
5. Thorsten sees that he pushed commit in which `sg`'s reference in the
   documentation now contains `"horsegraph"` as an official commandset
   to be used with `sg start`
6. Thorsten says "ah! oh no" and undoes changes

... multiple times.

So what this does here is introduce a `disable-overwrite` flag that
causes only the standard config to be read.

It's then used in the `go:generate` directive that runs `sg help`.
efritz pushed a commit that referenced this pull request Jul 26, 2022
Finally fixing this after it made me say "ah! oh no" one too many times
in the past few weeks.

Here's what previously happened on THORSTEN & SG GENERATE:

1. Thorsten has a custom commandset named `horsegraph` in `sg.config.overwrite.yaml`, along with some other custom commands.
2. Thorsten creates a database migration/GraphQL schema addition/...
3. Thorsten runs `sg generate`
4. Thorsten commits and pushes commit
5. Thorsten sees that he pushed commit in which `sg`'s reference in the
   documentation now contains `"horsegraph"` as an official commandset
   to be used with `sg start`
6. Thorsten says "ah! oh no" and undoes changes

... multiple times.

So what this does here is introduce a `disable-overwrite` flag that
causes only the standard config to be read.

It's then used in the `go:generate` directive that runs `sg help`.
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.

sg feedback - sg generate writing config overwrite dev/sg: gogenerate should ignore sg.config.overwrite.yaml commandsets

4 participants