GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Cache feature flags on disk by aeisenberg · Pull Request #1384 · github/codeql-action

Conversation

@aeisenberg

@aeisenberg aeisenberg commented Nov 21, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This will allow feature flags to be shared across steps in the same job, avoiding an error we saw earlier where the init action had the flag enabled, but the analyze step had it disabled.

This uses the runner's temp folder to cache the flags file, which will stick around until the job completes.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@aeisenberg
Cache feature flags on disk
c29fca4
This will allow feature flags to be shared across steps in the same job,
avoiding an error we saw earlier where the init action had the flag
enabled, but the analyze step had it disabled.

This uses the runner's temp folder to cache the flags file, which will
stick around until the job completes.
@aeisenberg
aeisenberg requested a review from a team as a code owner November 21, 2022 19:17
@aeisenberg
Update changelog
da75623
github-advanced-security[bot]
github-advanced-security AI found potential problems Nov 21, 2022
View reviewed changes
Comment thread src/feature-flags.test.ts
Comment on lines +325 to +328
fs.writeFileSync(
cachedFeatureFlags,
JSON.stringify(actualFeatureEnablement)
);

Check failure

Code scanning / CodeQL

Potential file system race condition

The file may have changed since it [was checked](1). The file may have changed since it [was checked](2).

@angelapwen angelapwen Nov 21, 2022

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Huh.. should we be checking files we write to?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@aeisenberg aeisenberg Nov 21, 2022

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This does feel like an FP. I will contact the team.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

angelapwen reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
angelapwen
angelapwen previously approved these changes Nov 21, 2022
View reviewed changes

@angelapwen angelapwen left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks!! Makes sense, just a couple of naming thoughts

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/feature-flags.test.ts
Comment on lines +325 to +328
fs.writeFileSync(
cachedFeatureFlags,
JSON.stringify(actualFeatureEnablement)
);

@angelapwen angelapwen Nov 21, 2022

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Huh.. should we be checking files we write to?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/feature-flags.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/feature-flags.ts Outdated
*/
type GitHubFeatureFlagsApiResponse = Partial<Record<Feature, boolean>>;

export const FEATURE_FLAGS_FILE_NAME = "feature-flags.json";

@angelapwen angelapwen Nov 21, 2022

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Wondering if this could be renamed to include local or cache somehow so it's easier to remember the difference between this file and the remote server-side flags 🤔

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

aeisenberg reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@aeisenberg
Rename
cfce1c4
@aeisenberg
aeisenberg dismissed angelapwen’s stale review via cfce1c4 November 21, 2022 21:42
@aeisenberg
Add extra test ensuring env var overrides cached feature flag
4ee97e5
angelapwen
angelapwen approved these changes Nov 21, 2022
View reviewed changes

@angelapwen angelapwen left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks! Extra test looks 👍

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@aeisenberg
aeisenberg merged commit 26df9a9 into main Nov 21, 2022
@aeisenberg
aeisenberg deleted the aeisenberg/feature-flags-disk branch November 21, 2022 23:25
This was referenced Nov 25, 2022
Merge main into releases/v2 #1395
Merged
Merge releases/v2 into releases/v1 #1397
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@angelapwen angelapwen angelapwen approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@aeisenberg @angelapwen @github-advanced-security
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.