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

ci: automate pinning charms in regression tests #1215

Merged
merged 1 commit into from
May 29, 2024

Conversation

dimaqq
Copy link
Contributor

@dimaqq dimaqq commented May 15, 2024

Switch to using pinned versions of the charm (latest main) for our charm tests in the GitHub Actions.

  • charmcraft-pack.yaml
  • db-charm-tests.yaml
  • framework-tests.yaml no change needed
  • hello-charm-tests.yaml
  • observability-charm-tests.yaml
  • publish.yml aggregates other workflows
  • test-publish.yml aggregates other workflows
  • automation to update pins
    • detect changes
    • create PR to update pins
    • setup, token

Also I've re-enabled mysql-k8s charm test, as that apparently got fixed upstream.

Here's the configuration for the personal access token I'm using to develop the external charm "dependabot":

  • read/write access to the repo
  • workflow scope to push branches with changes to workflows

Screenshot 2024-05-23 at 17 07 50

@benhoyt
Copy link
Collaborator

benhoyt commented May 15, 2024

Yeah, something like that -- or should we pin the latest commit hashes on their main/master? @tonyandrewmeyer @IronCore864

@dimaqq
Copy link
Contributor Author

dimaqq commented May 15, 2024

They seem to tag latest on main with these tags, here's git log main for the prometheus charm:

git log snippet ```Git Revision List commit 091c41a49182826539eb4771f0463cd805554453 (tag: rev186, origin/main, origin/HEAD, main) Author: Noctua Date: Sat May 4 02:03:24 2024 +0200
chore: update charm libraries (#603)

commit 69b500c3d331bc1c35ac1c0e650c775e922410c4 (tag: rev185)
Author: Noctua webops+observability-noctua-bot@canonical.com
Date: Fri May 3 22:01:14 2024 +0200

chore: update charm libraries (#602)

commit d35f2ea680a6164d31ff3935a8f4bc9bda9ad7d3 (tag: rev184)
Author: Noctua webops+observability-noctua-bot@canonical.com
Date: Fri May 3 02:03:16 2024 +0200

chore: update charm libraries (#601)

commit fcfc555317058f0dae1f5fc73861c79c5415e9f9 (tag: rev183)
Author: Noctua webops+observability-noctua-bot@canonical.com
Date: Thu May 2 22:01:10 2024 +0200

chore: update charm libraries (#598)

commit 9077888faf9d8a8fc337d34c042ec1aa5e09a70c (tag: rev182, origin/external-url-in-datasource)
Author: Leon 82407168+sed-i@users.noreply.github.com
Date: Tue Apr 30 09:09:49 2024 -0400

Fix sanitation (#599)
</details>

@dimaqq dimaqq requested a review from IronCore864 May 15, 2024 08:31
@benhoyt
Copy link
Collaborator

benhoyt commented May 15, 2024

Okay, per team discussion, for observability charms we'll use the always-updated "revNNN" tags. For other teams' charms that don't always update the tag we'll use the latest commit hash.

@dimaqq dimaqq changed the title pin charms in regression tests ci: pin charms in regression tests May 15, 2024
@dimaqq dimaqq marked this pull request as ready for review May 15, 2024 16:38
Copy link
Contributor

@tonyandrewmeyer tonyandrewmeyer left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good, just a couple of small comments.

.github/workflows/db-charm-tests.yaml Outdated Show resolved Hide resolved
.github/workflows/charmcraft-pack.yaml Outdated Show resolved Hide resolved
.gitignore Show resolved Hide resolved
.github/workflows/hello-charm-tests.yaml Outdated Show resolved Hide resolved
.gitignore Show resolved Hide resolved
@dimaqq
Copy link
Contributor Author

dimaqq commented May 22, 2024

After Madrid conversations, I'm going to change pins to git commit hashes, each with a comment (tag?, date).

@dimaqq dimaqq force-pushed the pin-charms-in-regression-tests branch from 76273f1 to 61bedfa Compare May 23, 2024 05:57
@dimaqq dimaqq requested review from tonyandrewmeyer and benhoyt May 28, 2024 00:57
@dimaqq
Copy link
Contributor Author

dimaqq commented May 28, 2024

Example PRs that automation generates:

Copy link
Collaborator

@benhoyt benhoyt left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me -- thanks!

.github/workflows/update-charm-tests.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@tonyandrewmeyer tonyandrewmeyer left a comment

Choose a reason for hiding this comment

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

Looks good - a couple of questions and couple of nits.

I do think it would be worthwhile documenting how to run this manually in HACKING.md (unless that's going to be done in #1213). Just a short section that explains that this workflow/action exists, and how to run it (potentially triggering the action with GitHub's UI/CLI, or with act, but also just the basic GITHUB_TOKEN=github_xxxx python3 main.py ../../workflows/hello-charm-tests.yaml approach (which is the extent of local testing that I did for the review, fwiw).

.github/actions/update-charm-pins/main.py Outdated Show resolved Hide resolved
.github/workflows/update-charm-tests.yaml Show resolved Hide resolved
.github/actions/update-charm-pins/main.py Outdated Show resolved Hide resolved
.github/actions/update-charm-pins/main.py Show resolved Hide resolved
.github/actions/update-charm-pins/action.yaml Outdated Show resolved Hide resolved
@dimaqq dimaqq changed the title ci: pin charms in regression tests ci: automate pinning charms in regression tests May 28, 2024
@dimaqq dimaqq force-pushed the pin-charms-in-regression-tests branch from abc5af8 to 5cc512a Compare May 28, 2024 08:51
@dimaqq
Copy link
Contributor Author

dimaqq commented May 28, 2024

I've added a block to hacking and wrote a readme for the action.

@dimaqq dimaqq requested a review from tonyandrewmeyer May 28, 2024 08:59
@benhoyt
Copy link
Collaborator

benhoyt commented May 28, 2024

@dimaqq Is #1213 still relevant given the weekly automation in this PR?

Copy link
Contributor

@tonyandrewmeyer tonyandrewmeyer left a comment

Choose a reason for hiding this comment

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

Nice!

.github/actions/update-charm-pins/main.py Show resolved Hide resolved
HACKING.md Outdated Show resolved Hide resolved
@dimaqq
Copy link
Contributor Author

dimaqq commented May 29, 2024

I'll update #1213

Document new in .gitignore

ci: write back the new git commit hashes

nit: typo in HACKING.md

Co-authored-by: Tony Meyer <tony.meyer@gmail.com>
@dimaqq dimaqq force-pushed the pin-charms-in-regression-tests branch from 2b8052b to a24bac8 Compare May 29, 2024 01:02
@dimaqq dimaqq merged commit e40f78d into canonical:main May 29, 2024
26 checks passed
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