Skip to content
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

Automation: better dependency management #690

Merged
merged 9 commits into from
Apr 12, 2024

Conversation

Wabri
Copy link
Member

@Wabri Wabri commented Mar 29, 2024

Better description to issues

Now the issue contains a better explanation:

image

Automatic update issue when a new package is out

If a new version of a packages comes out and there is already another issue that have a reference to the old latest package:

  • update title and description
  • comment on the issue with a reference to the previous title and description
image

PR opening and update itself

  • Create the branch automation/dependencies_update if not already exists
  • Update the requirement file passed by the environment and create the commit
  • If exists the pr related to this changes it will update the description
  • if not exists the pr than it will create a new one
image

2 more variable to personalise the action

OPEN_PR and OPEN_PR_BASE to enable the automated creation of the pull request and the second is to set the base branch to where the pr must be merge to.

Better logging

image

Example of 2 consecutive runs

First run

https://github.com/Wabri/community.sap_install/actions/runs/8572426995/job/23494940880#step:3:405

##### Collect datas #####
INFO: create dictionary from file
INFO: create dictionary from output
##### Create datas #####
INFO: Branch created -> https://github.com/Wabri/community.sap_install/tree/automation/dependencies_update
##### Run checks #####
----- Check ansible -----
INFO: current version 9.1.0
INFO: latest version 9.4.0
INFO: Issue created -> https://github.com/Wabri/community.sap_install/issues/101
----------------
----- Check ansible-compat -----
INFO: current version 4.1.10
INFO: latest version 4.1.11
INFO: Issue created -> https://github.com/Wabri/community.sap_install/issues/102
----------------
----- Check ansible-core -----
INFO: current version 2.16.2
INFO: latest version 2.16.5
INFO: Issue created -> https://github.com/Wabri/community.sap_install/issues/103
----------------
----- Check ansible-lint -----
INFO: current version 6.22.1
INFO: latest version 24.2.1
INFO: Issue created -> https://github.com/Wabri/community.sap_install/issues/104
----------------
INFO: Pull Request open -> https://github.com/Wabri/community.sap_install/pull/105
  • collect metadata from file (REQUIREMENT_FILE) and output (pip3 list --outdated)
  • create the branch automation/dependencies_update where to put all the changes
  • run all the checks for every package found in the requirement file
  • 4 issue created
  • a new pull requests is created

Changes to reproduce a use-case

  • edit title and description of ansible:9.1.0 issue with version as it was latest 9.3.0
  • same with ansible-lint:6.22.1 issue with 24.1.1
  • change description by removing a closes issue of ansible core to reproduce the case when a newest package came out when the pr is already opened

Second run:

https://github.com/Wabri/community.sap_install/actions/runs/8572506782/job/23495216128#step:3:404

##### Collect datas #####
INFO: create dictionary from file
INFO: create dictionary from output
##### Create datas #####
INFO: Branch -> https://github.com/Wabri/community.sap_install/tree/automation/dependencies_update
##### Run checks #####
----- Check ansible -----
INFO: current version 9.1.0
INFO: latest version 9.4.0
INFO: Comment done in -> https://github.com/Wabri/community.sap_install/issues/101
INFO: Issue updated -> https://github.com/Wabri/community.sap_install/issues/101
----------------
----- Check ansible-compat -----
INFO: current version 4.1.10
INFO: latest version 4.1.11
INFO: Issue -> https://github.com/Wabri/community.sap_install/issues/102
----------------
----- Check ansible-core -----
INFO: current version 2.16.2
INFO: latest version 2.16.5
INFO: Issue -> https://github.com/Wabri/community.sap_install/issues/103
----------------
----- Check ansible-lint -----
INFO: current version 6.22.1
INFO: latest version 24.2.1
INFO: Comment done in -> https://github.com/Wabri/community.sap_install/issues/104
INFO: Issue updated -> https://github.com/Wabri/community.sap_install/issues/104
----------------
INFO: Pull Request updated -> https://github.com/Wabri/community.sap_install/pull/105
  • collect metadata from file (REQUIREMENT_FILE) and output (pip3 list --outdated)
  • reference to the already existing branch automation/dependencies_update
  • run all the checks for every package found in the requirement file
    • 2 issue updated as expected
  • pull request updated as expected

@Wabri Wabri self-assigned this Mar 29, 2024
@Wabri Wabri marked this pull request as draft March 29, 2024 16:51
@Wabri Wabri added the enhancement New feature or request label Mar 29, 2024
@Wabri Wabri closed this Mar 29, 2024
@Wabri Wabri deleted the experiment/open_pull_request branch March 29, 2024 17:17
@Wabri Wabri restored the experiment/open_pull_request branch March 29, 2024 17:17
@Wabri Wabri reopened this Apr 2, 2024
@Wabri Wabri marked this pull request as ready for review April 3, 2024 08:38
Copy link
Contributor

@kksat kksat left a comment

Choose a reason for hiding this comment

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

I do not understand why anyone would want to implement functionality similar to something that is already available in dependabot and maintain it. I cannot review this PR.
My opinion should not discourage anyone from merging this PR. I was asked to review. It seemed impolite to ignore the request.

Copy link
Member

@berndfinger berndfinger left a comment

Choose a reason for hiding this comment

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

The description of the functionality looks good to me and the solution appears to be able to handle the dependency topics similar to what we had discussed as we want it - not updating dependencies automatically and being able to update unresolved dependency PRs. I'd also like to have issues updated instead of closing the outdated ones, so that we don't have a lot of those issues to search through. Do you think you can implement that as well?

@Wabri Wabri force-pushed the experiment/open_pull_request branch from 7c0e259 to 040f93e Compare April 5, 2024 14:42
@Wabri
Copy link
Member Author

Wabri commented Apr 5, 2024

Done the change that @berndfinger requests, done some more test and update the description of the pr.

Check it for the insight of the feature request!

@Wabri Wabri requested a review from berndfinger April 5, 2024 16:09
This prevents the issue creation when run after a merge into a different
branch than the default one
@Wabri
Copy link
Member Author

Wabri commented Apr 12, 2024

I cant do the merge without at least 1 review :) do you want to be the one @berndfinger ?

@berndfinger
Copy link
Member

@Wabri
Copy link
Member Author

Wabri commented Apr 12, 2024

Yes, the only difference is that in my fork I've use the main as a base for the pr, but in the main repository (this one) all the pr and changes will be referred to the dev branch.

After the merge of this pr, I'll run the action for the first time and check that everything went fine. Also the old issue: #692, #674, #683, and #691, will be removed to let the newly actions have a clean run.

Copy link
Member

@berndfinger berndfinger left a comment

Choose a reason for hiding this comment

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

LGTM!

@Wabri Wabri merged commit 42af6ba into sap-linuxlab:main Apr 12, 2024
1 check failed
@Wabri Wabri deleted the experiment/open_pull_request branch April 12, 2024 15:54
@Wabri Wabri restored the experiment/open_pull_request branch April 12, 2024 16:00
@Wabri Wabri deleted the experiment/open_pull_request branch April 12, 2024 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants