Skip to content

Add job delete support #4717

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

Merged
merged 10 commits into from
Jun 5, 2025
Merged

Add job delete support #4717

merged 10 commits into from
Jun 5, 2025

Conversation

bcl
Copy link
Contributor

@bcl bcl commented May 7, 2025

This pull request includes:

  • adequate testing for the new functionality or fixed issue
  • adequate documentation informing people about the change such as
    • submit a PR for the READMEs listed here
    • submit a PR for the osbuild.org website repository if this PR changed any behavior not covered by the automatically updated READMEs

@lzap
Copy link
Contributor

lzap commented May 7, 2025

Dropped some random stuff, this is not a review as I do not feel confident to do that yet.

@bcl bcl force-pushed the main-delete-jobs branch 2 times, most recently from eca164d to ab73a24 Compare May 13, 2025 17:07
@bcl bcl force-pushed the main-delete-jobs branch from ab73a24 to 055857f Compare May 16, 2025 23:10
@bcl
Copy link
Contributor Author

bcl commented May 16, 2025

Note that Snyk is wrong, no directory traversal is possible since it uses uuid.Parse() to make sure the id is a uuid not some arbitrary string.

@bcl bcl marked this pull request as ready for review May 16, 2025 23:28
@bcl bcl requested review from thozza and a team as code owners May 16, 2025 23:28
@bcl bcl requested review from mvo5 and achilleas-k and removed request for a team May 16, 2025 23:28
lzap
lzap previously approved these changes May 19, 2025
Copy link
Contributor

@lzap lzap left a comment

Choose a reason for hiding this comment

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

Thanks for adding those contexts.

@bcl bcl force-pushed the main-delete-jobs branch 3 times, most recently from 461e9eb to abe1fc1 Compare May 22, 2025 17:43
lzap
lzap previously approved these changes May 26, 2025
Copy link
Contributor

@lzap lzap left a comment

Choose a reason for hiding this comment

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

Yeah this is great! Small nitpick, but this is ready.

Someone else please review!

Copy link
Member

@thozza thozza left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

I've added a few questions inline and agree with @lzap's comment about carrying ctx when interacting with the DB. The rest LGTM.

Copy link
Member

@thozza thozza left a comment

Choose a reason for hiding this comment

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

Sorry, I misclicked. I wanted to request changes, instead of approving 😇

@bcl bcl force-pushed the main-delete-jobs branch from abe1fc1 to 3d8d038 Compare May 29, 2025 16:31
@bcl bcl requested a review from thozza May 29, 2025 16:31
bcl added 3 commits May 30, 2025 11:26
This allows database entries to be deleted.

Related: RHEL-60120
This allows jobs to be deleted from the database.
Currently only implemented by fsjobqueue. The function for
dbjobqueue currently returns nil.

This will remove all the job files used by the root job UUID as long as
no other job depends on them. ie. It starts at the top, and moves down
the dependency tree until it finds a job that is also used by another
job, removes the job to be deleted from its dependants list, and moves
back up the tree only deleting jobs with empty dependants lists.

Related: RHEL-60120
bcl added 7 commits May 30, 2025 11:26
This adds SQL to delete jobs and dependencies, and implements the
database version of the DeleteJob function.

Related: RHEL-60120
This adds tests for retrieving all root jobs, and deleting jobs
and unused dependencies. These tests are run against the fsjobqueue for
unit testing, and against dbjobqueue for integration testing.

Resolves: RHEL-60120
This removes all artifact directories, and their contents, if there
isn't an associated Job. This is used to clean up local artifacts after
the compose job has been deleted.

Related: RHEL-60120
This will be used to delete jobs and their artifacts.

Related: RHEL-60120
This adds the handler for DELETE /composes/{id} which will delete a job and
all of its dependencies, and any artifacts.

Related: RHEL-60120
It was returning a null body instead of an empty list.

Related: RHEL-60120
@bcl bcl force-pushed the main-delete-jobs branch from 3d8d038 to 43adaec Compare May 30, 2025 21:51
Copy link
Member

@thozza thozza left a comment

Choose a reason for hiding this comment

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

All good. Thanks for the changes and your patience!

@thozza thozza enabled auto-merge (rebase) June 5, 2025 08:32
@thozza thozza merged commit 12dd0b0 into osbuild:main Jun 5, 2025
45 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants