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

github cron job to update release branch snap_installation.yaml #83

Merged
merged 15 commits into from
May 3, 2024

Conversation

addyess
Copy link
Contributor

@addyess addyess commented Apr 25, 2024

Summary

Create a github cron job which updates release branches with latest available stable revision

Details

  • Creates PRs into release-xx branches to update the static revision configuration
  • Expects that there is a stable risk snap in the release channel
  • Might get confused if there are more than one match track in snapstore with the same revision (eg. 1.30 vs 1.30-classic)

@addyess addyess requested a review from a team as a code owner April 25, 2024 16:15

def find_snapstore_revision(track: str, arch: str, risk: str) -> str:
URL = f"https://api.snapcraft.io/v2/snaps/info/k8s?architecture={arch}&fields=revision"
HEADER = {"Snap-Device-Series": 16}
Copy link
Member

Choose a reason for hiding this comment

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

The client must send the Snap-Device-Series and User-Agent mandatory headers. For the Snap-Device-Series header, the only supported value so far is '16'.

Heh, funny magic numbers. Do you have any other information on why this field is required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://api.snapcraft.io/docs/info.html

The client must send the Snap-Device-Series and User-Agent mandatory headers. For the Snap-Device-Series header, the only supported value so far is '16'.

I'm guessing it's some kind of API versioning number? I have no clue

- name: Update Revision
id: update-revision
run: |
python3 .github/workflows/update-snap-revision.py ${{ matrix.arch }} ${{ env.TRACK }} stable
Copy link
Member

Choose a reason for hiding this comment

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

Just one question. Where is this TRACK envvar set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wow, nice call. Updated and spotted another bug. Thanks @mateoflorido

Copy link
Contributor Author

Choose a reason for hiding this comment

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

track env is now from here

@addyess addyess force-pushed the KU-690/job/update-snap-revision-job branch from 3526901 to cccbab7 Compare May 3, 2024 15:03
Copy link
Member

@mateoflorido mateoflorido left a comment

Choose a reason for hiding this comment

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

LGTM!

@addyess addyess merged commit 8f5fba7 into main May 3, 2024
34 checks passed
@addyess addyess deleted the KU-690/job/update-snap-revision-job branch May 3, 2024 17:54
addyess added a commit that referenced this pull request May 3, 2024
…#96)

* Create a github cron job which updates release branches with latest avaailable stable revision

* Fix bash regex on branch release names

* formatting

* Provider errors when branch doesn't match

* TRACK should be place into the GITHUB_ENV not GITHUB_OUTPUT

* Update .github/workflows/promote-charms.yaml



---------

Co-authored-by: Mateo Florido <[email protected]>
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.

2 participants