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 — Support splitting of DB creation and query execution by edoardopirovano · Pull Request #602 · github/codeql-action

Conversation

@edoardopirovano

@edoardopirovano edoardopirovano commented Jun 28, 2021

Copy link
Copy Markdown
Contributor

This PR makes a couple of changes that make it possible to write workflows that either don't create a CodeQL database, or don't run any CodeQL queries. In particular:

  • The analyze step now supports a skip-queries parameter that tells it to not run any queries.
  • The analyze step will now no longer error if a finalized database already exists. Instead, it will log an informational message, skip the finalize step, and proceed with query execution.

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
@edoardopirovano
edoardopirovano requested review from aeisenberg and esbena June 28, 2021 10:42
@edoardopirovano
edoardopirovano requested a review from a team as a code owner June 28, 2021 10:42
robertbrignull
robertbrignull reviewed Jun 28, 2021
View reviewed changes
Comment thread src/analyze-action.ts
if (runStats && uploadStats) {
await sendStatusReport(startedAt, { ...runStats, ...uploadStats });
} else if (runStats) {
await sendStatusReport(startedAt, { ...runStats });

@robertbrignull robertbrignull Jun 28, 2021

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.

Ideally still send a successful status report here, even if we don't have runStats. You'll probably have to amend to types to in order to do that.

Sorry, something went wrong.

Uh oh!

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

edoardopirovano reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
aeisenberg
aeisenberg reviewed Jun 28, 2021
View reviewed changes

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

Nice.

I think it's great that we're running more unit-like integration tests on different options for the action. The pr-checks workflow is getting long. I wonder if we should be splitting these into a separate workflow.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread .github/workflows/pr-checks.yml Resolved

Uh oh!

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

Comment thread .github/workflows/pr-checks.yml Resolved

Uh oh!

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

Comment thread src/analyze-action.ts
logger
);
await runFinalize(outputDir, threads, config, logger);
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {

@aeisenberg aeisenberg Jun 28, 2021

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.

Two comments:

  1. getRequiredInput will fail if the input isn't there. I don't think that's what we want, since this input is optional.
  2. Just a nit: Not sure how we are doing it for other boolean inputs, but do we want to support variants like True, TRUE, yes, 1, etc? Hmmm...and I see that you are using the same pattern we are using elsewhere. We should consider changing this, but in a separate PR.

Sorry, something went wrong.

Uh oh!

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

All reactions

@robertbrignull robertbrignull Jun 28, 2021

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.

I think using getRequiredInput is fine here because the input is defined as

  skip-queries:
    description: If this option is set, the CodeQL database will be built but no queries will be run on it. Thus, no results will be produced.
    required: false
    default: "false"

so if not given by the user then the actions runtime inserts the default value, so our code will always see a value present.

I did run into a problem during tests because then the value really will be missing and getRequiredInput will crash.

Sorry, something went wrong.

Uh oh!

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

All reactions

@aeisenberg aeisenberg Jun 28, 2021

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.

Ah...got it. So, ignore my first comment. :)

Sorry, something went wrong.

Uh oh!

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

edoardopirovano reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@edoardopirovano edoardopirovano Jun 28, 2021

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.

In response to 2: I definitely agree we should support more variants of true. Let's leave it for a separate PR.

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
Comment thread src/analyze.ts Resolved

Uh oh!

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

Comment thread src/analyze.ts Resolved

Uh oh!

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

Comment thread src/runner.ts
await runAnalyze(
const threads = getThreadsFlag(cmd.threads, logger);
await runFinalize(outputDir, threads, config, logger);
await runQueries(

@aeisenberg aeisenberg Jun 28, 2021

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.

So, we are not adding this functionality to the runner? This should be called out in the changelog.

Sorry, something went wrong.

Uh oh!

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

All reactions

@edoardopirovano edoardopirovano Jun 28, 2021

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.

Yep, I don't think we need this in the runner (or at least, nobody has asked for it). I will address this in the changelog.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread CHANGELOG.md Outdated
## [UNRELEASED]

- Fix `RUNNER_TEMP environment variable must be set` when using runner.
- The `analyze` step now supports a `skip-queries` option to merely build the CodeQL database without analyzing.

@aeisenberg aeisenberg Jun 28, 2021

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.

Can you add a link to this PR in the changelog entry for consistency?

Also, I think you should add something about handling already finalized databases.

Sorry, something went wrong.

Uh oh!

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

All reactions

@edoardopirovano edoardopirovano Jun 28, 2021

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.

Done, though it is a rather long changelog entry now.

Sorry, something went wrong.

Uh oh!

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

All reactions
@edoardopirovano
Support splitting of DB creation and query execution
ef852c0
@edoardopirovano
edoardopirovano force-pushed the split-create-analysis branch from a7e9641 to ef852c0 Compare June 28, 2021 16:15
aeisenberg
aeisenberg approved these changes Jun 28, 2021
View reviewed changes

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

LGTM.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread CHANGELOG.md
## [UNRELEASED]

No user facing changes.
- The `analyze` step of the Action now supports a `skip-queries` option to merely build the CodeQL database without analyzing. This functionality is not present in the runner. Additionally, the step will no longer fail if it encounters a finalized database, and will instead continue with query execution. [#602](https://github.com/github/codeql-action/pull/602)

@aeisenberg aeisenberg Jun 28, 2021

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.

Nit: If you wanted to, you could turn this into 2 entries. This would make each entry shorter.

Sorry, something went wrong.

Uh oh!

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

All reactions

@edoardopirovano edoardopirovano Jun 28, 2021

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.

Let's keep as is, it seems weird to have two entries referring to the same PR.

Sorry, something went wrong.

Uh oh!

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

All reactions
@edoardopirovano
Merge branch 'main' into split-create-analysis
93214ec
@edoardopirovano
edoardopirovano enabled auto-merge June 28, 2021 17:25
@edoardopirovano
edoardopirovano merged commit 53cf5d9 into github:main Jun 28, 2021
@github-actions github-actions Bot mentioned this pull request Jul 5, 2021
Merge main into v1 #614
Closed
5 tasks
@edoardopirovano
edoardopirovano deleted the split-create-analysis branch July 12, 2021 08:20
@github-actions github-actions Bot mentioned this pull request Jul 12, 2021
Merge main into v1 #616
Merged
4 of 5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@robertbrignull robertbrignull robertbrignull left review comments
@aeisenberg aeisenberg aeisenberg approved these changes
@esbena esbena Awaiting requested review from esbena

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

@edoardopirovano @aeisenberg @robertbrignull
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.