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 — Add `resolve-environment` action by mbg · Pull Request #1684 · github/codeql-action

Conversation

@mbg

@mbg mbg commented May 18, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Summary

This PR adds a new resolve-environment action which calls the new CLI resolve build-environment command to try and infer a configuration for the build environment that is suitable for the autobuilder. Example workflow (assuming a repository with a Go project):

jobs:
  analyze-linux:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - uses: github/codeql-action/resolve-environment@mbg/add-resolve-environment
        id: resolve-environment
        with:
          language: go

      - run: echo "${{ steps.resolve-environment.outputs.environment }}"

The action performs the following work:

  • Downloads the CodeQL CLI (optionally from the tools input); same behaviour as the init action.
  • Runs the resolve build-environment command and stores the JSON result received from that in the environment output

Sorry, something went wrong.

Uh oh!

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

aeisenberg and sidshank reacted with hooray emoji
All reactions
  • 🎉 2 reactions
@mbg mbg self-assigned this May 18, 2023
@mbg
mbg force-pushed the mbg/add-resolve-environment branch from 1dca7fb to bbaaef5 Compare May 26, 2023 10:40
henrymercer
henrymercer reviewed May 26, 2023
View reviewed changes

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

This is looking in good shape!

  • I think it's worth writing a CHANGELOG note for observant customers who are watching the repo to say that this Action is an internal experiment, is subject to change and shouldn't be used in production.
  • It'd be good to have a basic integration test of this once we have a CLI to test it against, just to make sure everything is wired up correctly.
  • We will need to make some internal changes to start capturing telemetry properly — for instance we need to add resolve-environment to an allowlist in the monolith. Though there's no rush to make this change.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread resolve-environment/action.yml Resolved

Uh oh!

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

Comment thread resolve-environment/action.yml Resolved

Uh oh!

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

Comment thread src/resolve-environment-action.ts Resolved

Uh oh!

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

Comment thread src/resolve-environment-action.ts Resolved

Uh oh!

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

Comment thread src/resolve-environment.ts Resolved

Uh oh!

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

Comment thread src/codeql.ts Resolved

Uh oh!

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

Comment thread src/resolve-environment-action.ts Resolved

Uh oh!

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

@mbg
mbg force-pushed the mbg/add-resolve-environment branch 3 times, most recently from a01d376 to f95520d Compare June 6, 2023 11:22
@mbg
mbg force-pushed the mbg/add-resolve-environment branch from 6a72d37 to f95520d Compare June 13, 2023 11:06
@mbg
mbg marked this pull request as ready for review June 13, 2023 11:11
@mbg
mbg requested a review from a team as a code owner June 13, 2023 11:11
aeisenberg
aeisenberg reviewed Jun 13, 2023
View reviewed changes
Comment thread CHANGELOG.md Resolved

Uh oh!

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

Comment thread src/resolve-environment-action.ts
);
core.setOutput("environment", result);
} catch (unwrappedError) {
const error = wrapError(unwrappedError);

@aeisenberg aeisenberg Jun 13, 2023

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.

Are there any known user errors that we should ignore? Eg- trying to resolve an unknown language? Trying to avoid spurious triggers of our SLOs.

Sorry, something went wrong.

Uh oh!

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

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

@mbg mbg Jun 14, 2023

Copy link
Copy Markdown
Member 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.

I think this will probably get addressed by the proposed handling of CLI errors in general: #1684 (comment)

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread src/resolve-environment-action.ts Resolved

Uh oh!

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

henrymercer
henrymercer reviewed Jun 13, 2023
View reviewed changes

@henrymercer henrymercer 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! Some minor suggestions to improve this before we merge.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread CHANGELOG.md Resolved

Uh oh!

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

Comment thread pr-checks/checks/resolve-environment-action.yml Resolved

Uh oh!

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

Comment thread resolve-environment/action.yml Resolved

Uh oh!

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

Comment thread resolve-environment/action.yml Resolved

Uh oh!

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

Comment thread src/codeql.ts Resolved

Uh oh!

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

Comment thread src/resolve-environment-action.ts Resolved

Uh oh!

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

Comment thread src/resolve-environment-action.ts Resolved

Uh oh!

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

Comment thread src/resolve-environment-action.ts Resolved

Uh oh!

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

Comment thread src/resolve-environment.ts Resolved

Uh oh!

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

Comment thread src/resolve-environment.ts Resolved

Uh oh!

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

@mbg
mbg force-pushed the mbg/add-resolve-environment branch from fa9ebea to 0485950 Compare June 13, 2023 19:15
mbg and others added 18 commits June 13, 2023 20:45
@mbg
Add initial stub for resolve-environment action
dce63d8
@mbg
Add resolveBuildEnvironment to CodeQL type
4322324
@mbg
Update OS representation
360d2b7
@mbg
Add resolve-environment to ActionName
cc95e67
@mbg
Add runResolveBuildEnvironment
4356c16
@mbg
Add initial workflow code dependent on init
ee80b30
@mbg
Add token and matrix inputs
0930314
@mbg
Fix: rename output
4518431
@mbg
Add working-directory input
527ea94
@mbg
Fix formatting for runResolveBuildEnvironment
59a9e3a
@mbg
Install CodeQL as part of the action
8216c3a
@mbg @henrymercer
Apply suggestions from code review
aef016d
Co-authored-by: Henry Mercer <[email protected]>
@mbg
Rename actionName to ACTION_NAME
ddb13a1
@mbg
Remove BuildEnvironmentOS
fce65da
@mbg
Propagate --working-dir argument
6f07b50
@mbg
Include CLI output in JSON error
e08f131
@mbg
Do not download CLI
829bba8
@mbg
Report success
64fa96a
mbg and others added 9 commits June 13, 2023 20:45
@mbg
Add integration test for resolve-environment
0b8c812
@mbg
Use nightly-latest for test for now
ef4bf4a
@mbg @henrymercer
Apply suggestions from code review
8e75e1a
Co-authored-by: Henry Mercer <[email protected]>
@mbg
Remove validateWorkflow call
16f3f1a
@mbg
Handle case where workingDir is undefined
6419f99
@mbg
Update action description
efe0e21
@mbg
Update working-directory description
1c73235
@mbg
Add CHANGELOG entry
ba64fee
@mbg
Improve changelog wording
c878505
@mbg
mbg force-pushed the mbg/add-resolve-environment branch from 0485950 to c878505 Compare June 13, 2023 19:47
@mbg
Rebuild integration test workflow
f239f49
@mbg

mbg commented Jun 13, 2023

Copy link
Copy Markdown
Member Author

In addition to the basic integration test included in this PR, we also have an internal repo with a more comprehensive test matrix which covers most cases that the Go autobuilder distinguishes between when resolving build environments. That forms an end-to-end test for all the new components related to this work.

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

Sorry, something went wrong.

Uh oh!

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

@mbg
Continue after CLI errors
899b5a2
@mbg
mbg requested review from aeisenberg and henrymercer June 14, 2023 15:04
henrymercer
henrymercer reviewed Jun 14, 2023
View reviewed changes

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

One improvement around better CLI error handling for old CLIs, otherwise this LGTM.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread src/resolve-environment-action.ts Resolved

Uh oh!

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

@mbg
Don't invoke CLI when command not supported
7a9f099
@mbg
mbg requested a review from henrymercer June 15, 2023 09:15
@mbg
Reformat
eb9703e
henrymercer
henrymercer previously approved these changes Jun 15, 2023
View reviewed changes

@henrymercer henrymercer left a comment •
edited
Loading

Uh oh!

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

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.

Checks are currently failing since nightly-latest doesn't have a version number of 2.13.4+ yet. I suggest we point to the new 2.13.4 bundle directly (stable-v2.13.4) or alternatively wait until #1721 is merged and use latest in the checks.

Sorry, something went wrong.

Uh oh!

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

All reactions
@mbg
Use stable-v2.13.4 for integration test
7e5bafc
@mbg
mbg dismissed henrymercer’s stale review via 7e5bafc June 15, 2023 10:04
@mbg
Improve step name in integration test
d4006d9
henrymercer
henrymercer approved these changes Jun 15, 2023
View reviewed changes

@henrymercer henrymercer 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 for addressing the feedback on the naming of the check step! This LGTM :shipit:

Sorry, something went wrong.

Uh oh!

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

All reactions
@mbg
mbg merged commit 0ac1815 into main Jun 15, 2023
@mbg
mbg deleted the mbg/add-resolve-environment branch June 15, 2023 16:50
@github-actions github-actions Bot mentioned this pull request Jun 21, 2023
Merge main into releases/v2 #1736
Merged
4 of 6 tasks
@aliscco aliscco mentioned this pull request Jun 24, 2023
[Snyk] Fix for 1 vulnerabilities aliscco/codeql-action#704
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@henrymercer henrymercer henrymercer approved these changes
@aeisenberg aeisenberg Awaiting requested review from aeisenberg

Uh oh!

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

Assignees

@mbg mbg

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

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