-
Notifications
You must be signed in to change notification settings - Fork 2
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
Refactor import and auto-commit Base images #19
Comments
I have created a proof of concept in an independent repo: auto-update-submodule-poc This is the workflow: https://github.com/josecelano/auto-update-submodule-poc/blob/main/.github/workflows/library-update.yml And this is the PR created automatically: josecelano/auto-update-submodule-poc#1 It seems the PR could be even auto merged: https://github.com/marketplace/actions/create-pull-request#auto-merge This solution has at least two advantages:
|
For the auto-merge maybe we could create another scheduled workflow (executed hourly) that gets a list of automatic PR and tries to find out if the PR workflow has finished. If the workflow for the PR has finished successfully the PR can be merged automatically. We need a way to know if a workflow for a PR has finished successfully. We have also described that need here. |
hi @da2ce7 @yeraydavidrodriguez I'm trying different approaches in this repo, but I can't find an easy solution. NOTES:
|
We have a discussion today. The starting point for the discussion was this document: with 2 proposals and notes. We agreed on trying a simpler solution:
If the git history you will see something like:
The commit message can contain a json with the job description. The workflow could be something like this:
Pros:
Cons:
We also decided to refactor the workflow before applying these changes. |
hi, @da2ce7 @yeraydavidrodriguez I have implemented the first version here. git log output:
I'm still using the concurrency option: but I'm planning to add a clone of the workflow with a different concurrency group, so I can run them manually and reproduce any problem I want. NOTE: please ignore the Python code, I have a "Typer" app scaffolding from a previous test. The commit full message is still empty (no json data). |
hi @da2ce7 @yeraydavidrodriguez I have finished the example: https://github.com/josecelano/library-consumer It seems to work, at least with two treads. I wrote some notes on the README file.
I have added a cronjob on the library to generate random content every hour. |
hi @da2ce7 I think we can split this problem into 2 steps: 1.- We refactor the workflow without implementing the lock system using git. Regarding point 1 (this issue) I have been discussing it with @yeraydavidrodriguez and we think there are a lot of alternatives. It depends on how we want to use the Librarian in other projects. We have identified these options:
I like option 6 because maybe it's too early to find the best way to use the Librarian without implementing even one case. And it should not be a big effort to extract the code once it's implemented. I mean, we can focus on solving our problem right now, and think later about how this solution can be used to solve other problems. There are still a lot of things pending to fix from the previous POC version. |
Regarding point 1 we (@da2ce7 , @yeraydavidrodriguez , @cgbosse ) were discussing today that the first option should be approach we must follow: 1. This website only uses some Librarian small actions (get dvc diff, pull dvc, auto-commit image). We continue using embedded actions for the website. We can end up having what we did not like too much for the librarian: a lot of small GitHub actions that we need to interconnect with a lot of inputs/outputs processing. Since we have already defined the lock system here we will work on a proposal to replace the current As a starting point, you can see my previous proposal in this issue description. At that time did not have the git-queue action implementation, so it does not include the lock system and it's only one workflow (worker). |
I'm going to start working again on this issue now that:
I'm going to replace the |
We decided to use only the local branch and push at the en don the workflow: See: #19
We decided to use only the local branch and push at the en don the workflow: See: #19
The workflow import-base-images.yml allows us to import new images from the library into this repo.
We have to change the workflow to start using the Librarian.
There are two big questions:
And some known problems:
There was also at least one accepted refactor. We have to use a PR instead of pushing directly to the main branch after every auto-commit. For example, if we create a commit adding a base image and we run again the workflow the commit is going to be created again because the library has not been updated yet in the main branch. In order to do that we have to split the workflow in two: one workflow is going to receive the event (the library has been updated) and it will create the new PR (I'm not sure if a PR created by the GitHub API triggers the workflows). The entry workflow would be called something like
create-pr-for-library-update.yml
. That workflow is going to create the new PR that will trigger theupdate-library.yml
workflow.Proposal 1: nested pull requests
On solution we proposed was:
We create a new workflow called:
update-library.yml
. This workflow will update the library submodule and will trigger a new workflow (import-base-images.yml
) in a nested branch. That nested PR will import the Base image into this repo. The nested PR have to be merged manually into the parent PR.Pros:
Cons:
Proposal 2: keep only one workflow for main and secondary tasks
We can try to keep it simple only with one workflow:
update-library.yml
. Secondary tasks could be steps in this workflow. For example, we can have a step to import the Base images. If we need to add more action we can add more steps.Specific actions for this repo (
resize-image
andchange-image-file-format
) could be merged into a single embedded action (process-base-images
).NOTES:
I would start with proposal 2 and move to proposal 1 if needed.
@da2ce7 @yeraydavidrodriguez could you add your thoughts?
The text was updated successfully, but these errors were encountered: