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

Support for path based tag structure in github_actions module for monorepo structures. #11286

Merged

Conversation

gopidesupavan
Copy link
Contributor

@gopidesupavan gopidesupavan commented Jan 12, 2025

What are you trying to accomplish?

Adding support to path based like tag structure for github_actions dependaboat module.

What: Adding support for path-based tag structures in the github_actions Dependabot module.

Why: Currently, Dependabot's github_actions module supports monorepo action bumps at the repository level. However, it does not work when a monorepo contains multiple actions, and the actions are tagged based on their paths.

At Apache Software Foundation, we are working on implementing organization-wide common actions in a single repository. For example, our current actions can be found here: https://github.com/apache/infrastructure-actions/. The plan is to structure tags based on action paths. This change will enable Dependabot to properly bump these actions, benefiting multiple projects that use them.

examples: We want tag action in this pattern restore/v1.0.0 so this can be referred in workflows apache/infrastructure-actions/stash/restore@restore/v1.0.0

Anything you want to highlight for special attention from reviewers?

The approach I've taken here is to name the dependency variable using the full action path whenever dealing with path-based tags.

Why is this necessary?
In the updater check flow, memorized filter results are used. This can lead to issues in repositories with path-based tags, as there's a chance of losing tag information when filtering eligible versions.

IMHO, we should treat path-based tags as an entirely new dependency section within the dependency set.

I could see one issue already created for this kind similar ask. #8451 it is trying to bump wrongly here.

I hope this can be solved.

How will you know you've accomplished your goal?

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • Ran the tests locally all are working fine
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • Yes i have added additional tests and existing tests are working fine , no changes to existing tests.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@gopidesupavan gopidesupavan requested a review from a team as a code owner January 12, 2025 17:52
@github-actions github-actions bot added the L: github:actions GitHub Actions label Jan 12, 2025
@gopidesupavan
Copy link
Contributor Author

I did dry run, here is results. working as expected.

[dependabot-core-dev] ~ $ bin/dry-run.rb github_actions gopidesupavan/monorepo-actions
=> cloning into /home/dependabot/tmp/gopidesupavan/monorepo-actions
=> parsing dependency files
🌍 --> GET https://github.com/gopidesupavan/monorepo-actions.git/info/refs?service=git-upload-pack
🌍 <-- 200 https://github.com/gopidesupavan/monorepo-actions.git/info/refs?service=git-upload-pack
🌍 --> GET https://github.com/gopidesupavan/monorepo-actions.git/info/refs?service=git-upload-pack
🌍 <-- 200 https://github.com/gopidesupavan/monorepo-actions.git/info/refs?service=git-upload-pack
🌍 --> GET https://github.com/gopidesupavan/monorepo-actions.git/info/refs?service=git-upload-pack
🌍 <-- 200 https://github.com/gopidesupavan/monorepo-actions.git/info/refs?service=git-upload-pack
=> updating 3 dependencies: gopidesupavan/monorepo-actions/first/init@init/v1.0.0, gopidesupavan/monorepo-actions/first/run@run/v2.0.0, gopidesupavan/monorepo-actions/second/exec@exec/1.0.0

=== gopidesupavan/monorepo-actions/first/init@init/v1.0.0 (1.0.0)
 => checking for updates 1/3
🌍 --> GET https://github.com/gopidesupavan/monorepo-actions.git/info/refs?service=git-upload-pack
🌍 <-- 200 https://github.com/gopidesupavan/monorepo-actions.git/info/refs?service=git-upload-pack
 => latest available version is 2.0.0
 => latest allowed version is 2.0.0
🌍 --> GET https://github.com/gopidesupavan/monorepo-actions.git/info/refs?service=git-upload-pack
🌍 <-- 200 https://github.com/gopidesupavan/monorepo-actions.git/info/refs?service=git-upload-pack
 => requirements to unlock: own
 => requirements update strategy: 
 => bump gopidesupavan/monorepo-actions/first/init@init/v1.0.0 from 1.0.0 to 2.0.0

    ± .github/workflows/version-bumps.yml
    ~~~
    --- /tmp/original20250112-6734-joe678       2025-01-12 17:51:03.520807449 +0000
    +++ /tmp/updated20250112-6734-e37ab0        2025-01-12 17:51:03.520807449 +0000
    @@ -7,7 +7,7 @@
         runs-on: ubuntu-latest
         steps:
           - name: "init"
    -        uses: gopidesupavan/monorepo-actions/first/init@init/v1.0.0
    +        uses: gopidesupavan/monorepo-actions/first/init@init/v2.0.0
           - name: "run"
             uses: gopidesupavan/monorepo-actions/first/run@run/v2.0.0
             
    ~~~
    2 insertions (+), 2 deletions (-)

=== gopidesupavan/monorepo-actions/first/run@run/v2.0.0 (2.0.0)
 => checking for updates 2/3
🌍 --> GET https://github.com/gopidesupavan/monorepo-actions.git/info/refs?service=git-upload-pack
🌍 <-- 200 https://github.com/gopidesupavan/monorepo-actions.git/info/refs?service=git-upload-pack
 => latest available version is 3.0.0
 => latest allowed version is 3.0.0
🌍 --> GET https://github.com/gopidesupavan/monorepo-actions.git/info/refs?service=git-upload-pack
🌍 <-- 200 https://github.com/gopidesupavan/monorepo-actions.git/info/refs?service=git-upload-pack
 => requirements to unlock: own
 => requirements update strategy: 
 => bump gopidesupavan/monorepo-actions/first/run@run/v2.0.0 from 2.0.0 to 3.0.0

    ± .github/workflows/version-bumps.yml
    ~~~
    --- /tmp/original20250112-6734-eyq6j5       2025-01-12 17:51:05.469807343 +0000
    +++ /tmp/updated20250112-6734-xnciuc        2025-01-12 17:51:05.469807343 +0000
    @@ -9,7 +9,7 @@
           - name: "init"
             uses: gopidesupavan/monorepo-actions/first/init@init/v1.0.0
           - name: "run"
    -        uses: gopidesupavan/monorepo-actions/first/run@run/v2.0.0
    +        uses: gopidesupavan/monorepo-actions/first/run@run/v3.0.0
             
       bump-check2:
         runs-on: ubuntu-latest
    ~~~
    2 insertions (+), 2 deletions (-)

=== gopidesupavan/monorepo-actions/second/exec@exec/1.0.0 (1.0.0)
 => checking for updates 3/3
🌍 --> GET https://github.com/gopidesupavan/monorepo-actions.git/info/refs?service=git-upload-pack
🌍 <-- 200 https://github.com/gopidesupavan/monorepo-actions.git/info/refs?service=git-upload-pack
 => latest available version is 2.0.0
 => latest allowed version is 2.0.0
🌍 --> GET https://github.com/gopidesupavan/monorepo-actions.git/info/refs?service=git-upload-pack
🌍 <-- 200 https://github.com/gopidesupavan/monorepo-actions.git/info/refs?service=git-upload-pack
 => requirements to unlock: own
 => requirements update strategy: 
 => bump gopidesupavan/monorepo-actions/second/exec@exec/1.0.0 from 1.0.0 to 2.0.0

    ± .github/workflows/version-bumps.yml
    ~~~
    --- /tmp/original20250112-6734-kx0qa        2025-01-12 17:51:07.674807223 +0000
    +++ /tmp/updated20250112-6734-sg1rdj        2025-01-12 17:51:07.674807223 +0000
    @@ -15,5 +15,5 @@
         runs-on: ubuntu-latest
         steps:
           - name: "exec"
    -        uses: gopidesupavan/monorepo-actions/second/exec@exec/1.0.0
    +        uses: gopidesupavan/monorepo-actions/second/exec@exec/2.0.0
       
    ~~~
    2 insertions (+), 2 deletions (-)

@gopidesupavan
Copy link
Contributor Author

cc: @potiuk @assignUser

@abdulapopoola
Copy link
Member

Thanks @gopidesupavan , we'll try to see how we can get this in this week.

@potiuk
Copy link

potiuk commented Jan 12, 2025

Nice ! Will be super useful to keep all the Apache Software Foundation's actions to be kept in a single monorepo !

randhircs
randhircs previously approved these changes Jan 16, 2025
@randhircs
Copy link
Member

randhircs commented Jan 16, 2025

@gopidesupavan
I approved it, however I see there is a conflict with the merge, could you resolve the conflict.

@gopidesupavan
Copy link
Contributor Author

@randhircs Thanks for review, have rebased looks good now :)

@randhircs randhircs force-pushed the fix-monorepo-version-reference branch from 0f48552 to 01c6540 Compare January 16, 2025 15:52
@randhircs randhircs self-requested a review January 16, 2025 15:52
@randhircs randhircs force-pushed the fix-monorepo-version-reference branch from 01c6540 to f579d7d Compare January 16, 2025 16:16
@randhircs randhircs force-pushed the fix-monorepo-version-reference branch from f579d7d to 5463710 Compare January 16, 2025 16:53
@randhircs randhircs merged commit 127a958 into dependabot:main Jan 16, 2025
37 checks passed
@gopidesupavan gopidesupavan deleted the fix-monorepo-version-reference branch January 16, 2025 17:51
@potiuk
Copy link

potiuk commented Jan 16, 2025

🎉 🙇‍♂️

@gopidesupavan
Copy link
Contributor Author

Wooho thank you @randhircs 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: github:actions GitHub Actions
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants