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

GH Actions: add new workflow to auto-update certificate bundle #669

Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Feb 2, 2022

Certificate: add checksum file

Add the checksum file for the certificate bundle to the package to allow both users of the package as well as maintainers of the package, to verify the validity of the included certificate bundle.

This file should only ever be updated at the same time as the certificate bundle is being updated.

GH Actions: new workflow to automatically update certificate bundle

This adds a new workflow which will automatically check the cURL website for an update to the certificate bundle once a day and if an updated bundle is found, it will automatically create a pull request against the develop branch to update the bundle in the Requests package.

The workflow will also update the certificate checksum file and verify the checksum of the downloaded certificate bundle.

Notes:

  • A condition has been added to prevent the cron job from running on forks (to conserve resources).
  • The workflow uses the recommended commands for automated downloads as per the https://curl.se/docs/caextract.html page.
    These recommended commands do a conditional download only when a file is changed and use an etag*.txt file to check whether the upstream file has changed.
    These etag*.txt files don't really need to be stored in the actual repo, so they have been added to the .gitignore file.
    In the workflow, these etag*.txt files are stored to and restored from a workflow cache to allow for the conditional download.
  • While the workflow runs on a cron job and manual updating of the certificate file/checksum file should therefore never be needed, as an extra security measure, the workflow will also run whenever a PR is opened to update the certificate files or when a change to the certificate files is pushed to the stable or develop branch.
    Note: as PRs which are opened from within a workflow do not trigger new workflows to be run (= default behaviour for GitHub Actions), the PR potentially created by this workflow will not trigger a recursive run of this workflow.
  • If a PR triggers this workflow and a certificate update would be needed, a (new) PR against the original PR will be opened with the certificate update.
  • If the workflow is triggered via the cronjob or for a push against stable/develop, any PR which may be opened will be opened against develop.

Fixes #635

@jrfnl jrfnl added this to the 2.x Next milestone Feb 2, 2022
@jrfnl jrfnl requested a review from schlessera February 2, 2022 01:44
@jrfnl jrfnl force-pushed the feature/ghactions-new-auto-update-certificate-workflow branch 2 times, most recently from d38ce03 to dc64a60 Compare February 2, 2022 03:09
@jrfnl
Copy link
Member Author

jrfnl commented Feb 2, 2022

Did some debugging and smoothed out the kinks.

PRs created due to the workflow being triggered via cronjob or due to a push to stable/develop will now open a pull request against develop.
PRs created due to a PR updating either the workflow or the certificate related files will be pulled against the PR branch which triggered the workflow.

@jrfnl jrfnl force-pushed the feature/ghactions-new-auto-update-certificate-workflow branch from dc64a60 to 8400bb6 Compare February 2, 2022 04:06
Add the checksum file for the certificate bundle to the package to allow both users of the package as well as maintainers of the package, to verify the validity of the included certificate bundle.

This file should only ever be updated at the same time as the certificate bundle is being updated.
This adds a new workflow which will automatically check the cURL website for an update to the certificate bundle once a day and if an updated bundle is found, it will automatically create a pull request against the `develop` branch to update the bundle in the Requests package.

The workflow will also update the certificate checksum file and verify the checksum of the downloaded certificate bundle.

Notes:
* A condition has been added to prevent the cron job from running on forks (to conserve resources).
* The workflow uses the recommended commands for automated downloads as per the https://curl.se/docs/caextract.html page.
    These recommended commands do a conditional download only when a file is changed and use an `etag*.txt` file to check whether the upstream file has changed.
    These `etag*.txt` files don't really need to be stored in the actual repo, so they have been added to the `.gitignore` file.
    In the workflow, these `etag*.txt` files are stored to and restored from a workflow cache to allow for the conditional download.
* While the workflow runs on a cron job and manual updating of the certificate file/checksum file should therefore never be needed, as an extra security measure, the workflow will also run whenever a PR is opened to update the certificate files or when a change to the certificate files is pushed to the `stable` or `develop` branch.
    Note: as PRs which are opened from within a workflow do not trigger new workflows to be run (= default behaviour for GitHub Actions), the PR potentially created by this workflow will not trigger a recursive run of this workflow.
* If a PR triggers this workflow and a certificate update would be needed, a (new) PR against the original PR will be opened with the certificate update.
* If the workflow is triggered via the cronjob or for a push against `stable`/`develop`, any PR which may be opened will be opened against `develop`.

Fixes 635
@jrfnl jrfnl force-pushed the feature/ghactions-new-auto-update-certificate-workflow branch from 8400bb6 to 1a0d0cd Compare February 7, 2022 15:16
@schlessera schlessera merged commit 779b4d1 into develop Feb 7, 2022
@schlessera schlessera deleted the feature/ghactions-new-auto-update-certificate-workflow branch February 7, 2022 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Task: automate updating the certificates bundle
2 participants