Skip to content

Set up automated Library Manager submission system #1

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 17 commits into from
Apr 9, 2021
Merged

Set up automated Library Manager submission system #1

merged 17 commits into from
Apr 9, 2021

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Jan 15, 2021

No description provided.

Copy link
Contributor

@rsora rsora left a comment

Choose a reason for hiding this comment

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

This first iteration is very well made, can we merge it?
This way I'll start to do a couple of submission tests

This is the full list of repositories for the libraries of the Arduino Library Manager index.
Submissions of libraries to the Arduino Library Manager index can be done by submitting a pull request adding repositor
URLs to the list. The submissions are checked for compliance wih the requirements for addition to the index and as soon
as they are passing the pull request is merged and the entries are pushed to the index source file.
@per1234 per1234 marked this pull request as ready for review January 19, 2021 08:13
@per1234 per1234 requested a review from silvanocerza January 19, 2021 08:14
@per1234
Copy link
Contributor Author

per1234 commented Jan 19, 2021

It is now in a finished state. If you would like to try it out in more of a "sandboxed" manner, you can submit pull requests to the test branch of my fork:
https://github.com/per1234/library-manager-list
That is set up to commit to my fork of the Library Manager index source file repository rather than the real one:
https://github.com/per1234/library-manager-list/blob/test/.github/workflows/manage-prs.yml#L272

Comment on lines 275 to 283
- name: Add entry to index source file
run: |
INDEX_SOURCE_FILE_PATH="${{ github.workspace }}/repositories.txt"
echo "${{ needs.parse.outputs.index-entry }}" >> "$INDEX_SOURCE_FILE_PATH"
git config --global user.email "bot@arduino.cc"
git config --global user.name "ArduinoBot"
git add --update "$INDEX_SOURCE_FILE_PATH"
echo -e "Add submission # ${{ github.event.pull_request.number }}${{ github.event.issue.number }}\n\n${{ github.event.repository.html_url }}/pull/${{ github.event.pull_request.number }}${{ github.event.issue.number }}" | git commit --file -
git push

Choose a reason for hiding this comment

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

This kinda scares me, it's certainly fine since we don't have lots of submissions but in case we get a big influx of libraries it might fail in the future.
Not blocking for now though.

Copy link

@silvanocerza silvanocerza left a comment

Choose a reason for hiding this comment

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

I have some big concerns about the manage-prs.yml workflow, the rest seems fine to me.
Also I think we need a big security review on this, I feel like there can be lots of exploits in this process.

@silvanocerza
Copy link

Please please please, be more atomic with PRs.

@rsora rsora self-requested a review January 19, 2021 12:49
@rsora
Copy link
Contributor

rsora commented Jan 19, 2021

Re-requested review myself because I'll try your personal repo deployment @per1234

@per1234 per1234 marked this pull request as draft January 20, 2021 00:52
It's possible to accomplish the same thing in a more simple and secure manner by using the submission list.
With the current submission system, it's common for people to provide the tag/release URL rather than the repository
URL. I think it likely the same sort of thing will occur with the new system. Previously, a very naive check was done
for the path component of the URL to have two levels. It turns out that the Gitlab repository URLs have more levels than
that. The superior approach is to use `git ls-remote` to verify that the URL is a Git repository.
Rather that committing directly to the index source file repository, save the index entry to a workflow artifact, which
will be consumed by the system that updates the index source file.
This isolates the PR branch checkout from the request parsing process.
I had intended to test these out but didn't get around to it. The workflow_dispatch might be convenient, but it's not at
all essential since the same thing can be accomplished by commenting on the PR.
The index source file contains the normalized URL and the metadata that can't be derived from the library releases
("types" data and locked name) for each of the libraries in the Library Manager index. It's most appropriate to store it
in the same repository as the submission list.
@per1234 per1234 marked this pull request as ready for review January 24, 2021 15:03
This avoids the need to checkout the PR head ref.
This approach allows the diff to be written directly to a file, rather than needing to sanitize the contents of the
output from the octokit/request-action before writing it to the file via the shell.
per1234 added 3 commits March 31, 2021 09:16
Although it is convenient and best practices to have this file in place, it is not absolutely necessary, so it must go
bye-bye.
Now that the parser tool is moved out of the repository, it makes less sense to use the taskfile-based approach for the
CI infrastructure. In order to make the repository more contributor-friendly, the spell checking system is now reduced to
a single workflow file.
per1234 added 3 commits March 31, 2021 09:16
Now that the parser tool is moved out of the repository, it makes less sense to use the taskfile-based approach for the
CI infrastructure. In order to make the repository more contributor-friendly, the documentation and configuration
checking system is now confined to the .github subfolder.
Now that the parser tool is moved out of the repository, it makes less sense to use the taskfile-based approach for the
CI infrastructure. In order to make the repository more contributor-friendly, the license checking system is now
confined to a single workflow file.
Now that the parser tool code has been removed from the repository, the previous license is no longer appropriate.
@per1234
Copy link
Contributor Author

per1234 commented Apr 1, 2021

Thanks so much for your feedback @silvanocerza and @rsora. I have made a couple significant changes to this PR in response to feedback received via other channels:

Removal of parser tool

Previously, in addition to the list, this repository hosted the Golang tool used for parsing the PR diff to determine the request type, validating for thing not covered by Arduino Lint, and gathering the information needed for the Library Manager index source list entry on acceptance. That has now been moved to a dedicated repo. So the workflow now only needs to download the tool binary from the release asset in that repo.

Sparse root folder contents

All possible files have been moved out of the root of the repository. The root now only contains the Library Manager list, readme, and license files.

License change

With the Golang code removed from the repository and the primary item of interest being a list of URLs, it seemed like the previous GPLv3 license was no longer appropriate. I have changed it to CC0, but am happy to use whatever license is deemed best.

@per1234 per1234 requested a review from silvanocerza April 1, 2021 02:57
Copy link
Contributor

@rsora rsora left a comment

Choose a reason for hiding this comment

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

Excellent!

@per1234 per1234 merged commit c2fd5e2 into arduino:main Apr 9, 2021
@per1234 per1234 deleted the development branch April 9, 2021 15:17
@per1234 per1234 self-assigned this Nov 20, 2021
MatteoPologruto pushed a commit that referenced this pull request Dec 6, 2023
Update URL of "DirectCurrent Motor Module"
MatteoPologruto pushed a commit that referenced this pull request Jan 11, 2024
MatteoPologruto pushed a commit that referenced this pull request Mar 7, 2024
MatteoPologruto pushed a commit that referenced this pull request Dec 11, 2024
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