Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

(#1299) Add regex filter to include only build tags in the deployment script #1300

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion utility_scripts/deploy/deploy_hyperion.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import argparse
import os
import re
from subprocess import PIPE, CalledProcessError, Popen
from uuid import uuid1

Expand All @@ -8,6 +9,8 @@

recognised_beamlines = ["dev", "i03", "i04"]

VERSION_PATTERN = re.compile(r"^v?(\d+)\.(\d+)\.(\d+)$")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could: A more comprehensive pattern is in packaging.version.VERSION_PATTERN, we could use that instead so we don't have to maintain our own?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done



class repo:
# Set name, setup remote origin, get the latest version"""
Expand All @@ -18,7 +21,9 @@ def __init__(self, name: str, repo_args):
self.origin = self.repo.remotes.origin
self.origin.fetch()

self.versions = [t.name for t in self.repo.tags]
self.versions = [
t.name for t in self.repo.tags if VERSION_PATTERN.match(t.name)
]
self.versions.sort(key=Version, reverse=True)
print(f"Found {self.name}_versions:\n{os.linesep.join(self.versions)}")
self.latest_version_str = self.versions[0]
Expand Down
Loading