-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
codeql-action/init should explicitly delete an already present database (for self-hosted runners) #1722
Comments
--overwrite
option sometimes does not recognise an existing CodeQL database
In brief, the directory is taken for a codeql database if it contains |
I'm assuming you're using the The original use case for Looking through the code that implements the check, I can see a few theoretical possibilities where an earlier run that was killed a just the wrong time may have left the directory in a state that's not recognizable as a database. This would be a fairly rare occurrence -- but once a particular self-hosted runner has a directory in that state, there would be nothing that automatically clears it away. (In contrast, GitHub-hosted runners always start all just in a pristine container without anything left over from earlier jobs). As Chris says, it's hard to say exactly what has go wrong without looking at the actual directory content. Arguably the right fix ought to be that the action should clear out the database directory itself when it starts up rather than leaving it to the CLI to do so. (At least when it finds itself on a self-hosted runner, if that condition is easily detectable). |
--overwrite
option sometimes does not recognise an existing CodeQL database
(More precisely, if an earlier attempt to run |
If this guess is right, there seems to be a good chance that cleaning out the offending directory on the affected runner manually could get your setup working again while we decide whether to change the behavior of the action. |
Hello @hmakholm Your assumption is correct - we are running a GitHub Enterprise environment with selfhosted runners calling the codeql-action. To enable the 'overwrite' functionality, we use the The problem occurs on every run of the workflow, regardless of whether the previous run completed successfully or not. As suggested above, if we force the deletion of the codeql_databases directory, we can get around the problem (this is being implemented in the runners using the The concern/question though, is why is this external cleanup needed? On a successful execution the codeql_databases directory is populated and happily generates the sarif results, but the subsequent run aborts saying that if doesn't think the directory is a codeql_database - this suggests we are violating the rules used to identify a codeql_database, but we don't have clarity on what that rule requires. A clean run produces the following directories and a codeql-database.yml file ... and yet this triggers a failure on the subsequent run (if not cleaned up):
We aren't blocked but we are confused. |
Thanks, that was helpful. The I'll file an internal note to get that fixed. |
@hmakholm - Excellent, thanks. |
We are running CodeQL as an action on self-hosted runners and have enabled the 'over-write' option to clean the CodeQL database before each run.
However, some environments fail with the following message:
As suggested in the error message, we can manually delete the directory, allowing for a successful run.
We do not understand what is causing CodeQL to believe the directory is not a CodeQL database. We are not explicitly altering the contents or structure. As the directories involved are created by CodeQL within the workflow, the hope is to have CodeQL able to clean up it's workspace from within the workflow as well.
Ideally, we want to avoid having to implement an external cleanup step for the process.
We are curious to see what logic is being used to determine the 'CodeQL database' status of the targeted directory.
Regards,
Richard Seeton
The text was updated successfully, but these errors were encountered: