-
Notifications
You must be signed in to change notification settings - Fork 15
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
deploy: automatic version bumps #2097
base: develop
Are you sure you want to change the base?
Conversation
Used curl to file the pull request to validate the parameters, with the API key that will be used by the job. |
Thank you for your pull request! Should you want to clear the PR build directory after failures, please use this pipeline. Before running the cleanup pipeline, please ensure that any PR building pipelines have been cancelled or finished running. |
To test your PR, use the following on BlueBrain5: unset MODULEPATH
. /gpfs/bbp.cscs.ch/ssd/apps/bsd/pulls/2097/config/modules.sh
module load unstable |
To test your PR, use the following on BlueBrain5: unset MODULEPATH
. /gpfs/bbp.cscs.ch/ssd/apps/bsd/pulls/2097/config/modules.sh
module load unstable |
6 similar comments
To test your PR, use the following on BlueBrain5: unset MODULEPATH
. /gpfs/bbp.cscs.ch/ssd/apps/bsd/pulls/2097/config/modules.sh
module load unstable |
To test your PR, use the following on BlueBrain5: unset MODULEPATH
. /gpfs/bbp.cscs.ch/ssd/apps/bsd/pulls/2097/config/modules.sh
module load unstable |
To test your PR, use the following on BlueBrain5: unset MODULEPATH
. /gpfs/bbp.cscs.ch/ssd/apps/bsd/pulls/2097/config/modules.sh
module load unstable |
To test your PR, use the following on BlueBrain5: unset MODULEPATH
. /gpfs/bbp.cscs.ch/ssd/apps/bsd/pulls/2097/config/modules.sh
module load unstable |
To test your PR, use the following on BlueBrain5: unset MODULEPATH
. /gpfs/bbp.cscs.ch/ssd/apps/bsd/pulls/2097/config/modules.sh
module load unstable |
To test your PR, use the following on BlueBrain5: unset MODULEPATH
. /gpfs/bbp.cscs.ch/ssd/apps/bsd/pulls/2097/config/modules.sh
module load unstable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just had a quick skim through.
I'm not sure if you considered this, but note that we have some similar logic for manipulating recipes - implemented as a custom Spack command - in https://github.com/BlueBrain/spack/blob/develop/bluebrain/spack-scripting/scripting/cmd/configure_pipeline.py; we use that for configuring Spack in CI pipelines. One still has to fudge the recipe .py
somewhat manually, but you would avoid having to parse the recipes to extract the versions and so on.
Up to you.
I hadn't seen that specific code, but it does answer my initial "how do I get the package object in a clean way". Replacing the current code with something similar is definitely possible and gets rid of a regex and makes I'm still reading the source to insert the new version though |
To test your PR, use the following on BlueBrain5: unset MODULEPATH
. /gpfs/bbp.cscs.ch/ssd/apps/bsd/pulls/2097/config/modules.sh
module load unstable |
To test your PR, use the following on BlueBrain5: unset MODULEPATH
. /gpfs/bbp.cscs.ch/ssd/apps/bsd/pulls/2097/config/modules.sh
module load unstable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to have this be a proper Spack extension in the scripting part. That would also allow to quickly check versions on BB5 manually.
if "CI_JOB_TOKEN" in os.environ: | ||
logger.debug("CI_JOB_TOKEN found - running on gitlab") | ||
package_git_url = ( | ||
f"https://gitlab-ci-token:{os.environ['CI_JOB_TOKEN']}@{package_git_url}" | ||
) | ||
else: | ||
logger.debug("CI_JOB_TOKEN not found - SSH should be configured on your machine") | ||
package_git_url = f"ssh://{package_git_url}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be done with the same logic we already have in gitlab-pipelines
, outside of Python. Then we don't need to know about tokens and all that in the Python part (and don't have to modify git URLs)
logger.info(f"===> Adding version {latest_source_version} for {package}") | ||
source_lines = self.get_source_lines(package_file) | ||
for idx, line in enumerate(source_lines): | ||
if line.strip().startswith("version("): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be a regexp... r"^( )+version\("
. But actually: we don't want to add version directives into nested statements. Those are normally indicative of a programmatic approach to version bumping. Thus a fixed indent of 4 should be checked and used?
sys.path.append("./lib/spack/") | ||
sys.path.append("./lib/spack/external/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't be needed if this were a proper extension.
PACKAGES = { | ||
"brayns": {"tag_regex": re.compile(r"\d+\.\d+\.\d+")}, | ||
"brainbuilder": { | ||
"tag_regex": re.compile(r"brainbuilder-v\d+\.\d+\.\d+"), | ||
"tag_strip": "brainbuilder-", | ||
}, | ||
"synapsetool": {"tag_regex": re.compile(r"v\d+\.\d+\.\d+")}, | ||
"regiodesics": {"tag_regex": re.compile(r"\d+\.\d+\.\d+")}, | ||
"touchdetector": {"tag_regex": re.compile(r"\d+\.\d+\.\d+")}, | ||
"spykfunc": {"tag_regex": re.compile(r"v\d+\.\d+\.\d+")}, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So... Why not do it all in Spack?
Could query our repositories for packages and updates like this:
#!/usr/bin/env spack-python
import re
from spack.version import Version
from spack.util.executable import which
VERSION_RE = re.compile(r'(?:([^0-9].+)-)?v?(\d+\.\d+(?:\.\d+)*)$')
def homogenize(s: str):
if s.startswith("py-"):
s = s[3:]
return s.lower().replace("-", "").replace("_", "")
repo = spack.repo.path.get_repo("bluebrain")
pkgs = repo.all_package_classes()
git = which("git")
for pkg in pkgs:
print(pkg.name)
if url := getattr(pkg, "git", None):
most_recent = max([v for v in pkg.versions if not v.isdevelop()])
candidates = []
tags = {}
for l in git("ls-remote", "--tags", url, output=str).splitlines():
if l.endswith("{}"):
continue
_, tag = l.rsplit("/", 1)
if m := VERSION_RE.search(tag):
prefix, version = m.groups()
if prefix and homogenize(prefix) != homogenize(pkg.name):
continue
candidates.append(Version(version))
tags[Version(version)] = tag
if not candidates:
continue
most_recent_found = max(candidates)
if most_recent_found > most_recent:
print(f"Current version: {most_recent}")
print(f"New version: {most_recent_found} - {tags[most_recent_foun
d]}")
print(url)
Oh, and the source of |
New script that will automatically create new versions of certain packages