8000 Get tag from VERSION manifest by keshav-space · Pull Request #1895 · aboutcode-org/vulnerablecode · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Get tag from VERSION manifest #1895

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

Merged
merged 3 commits into from
Jun 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 12 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@ Release notes
=============


Version v36.1.2
---------------------

- Get tag from VERSION manifest #1895


Version v36.1.1
---------------------

- Update is_active help text in pipeline migration #1887


Version v36.1.0
---------------------

Expand Down
8 changes: 4 additions & 4 deletions docs/source/user-interface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ package URL or purl prefix fragment such as

The search by packages is available at the following URL:

`https://public.vulnerablecode.io/packages/search <https://public.vulnerablecode.io/packages/search>`_
`https://public.vulnerablecode.io/packages/search/ <https://public.vulnerablecode.io/packages/search/>`_

How to search by packages:

1. Go to the URL: `https://public.vulnerablecode.io/packages/search <https://public.vulnerablecode.io/packages/search>`_
1. Go to the URL: `https://public.vulnerablecode.io/packages/search/ <https://public.vulnerablecode.io/packages/search/>`_
2. Enter the package URL or purl prefix fragment such as ``pkg:pypi``
or by package name in the search box.
3. Click on the search button.
Expand All @@ -46,11 +46,11 @@ fragment of these identifiers like ``CVE-2021``.

The search by vulnerabilities is available at the following URL:

`https://public.vulnerablecode.io/vulnerabilities/search <https://public.vulnerablecode.io/vulnerabilities/search>`_
`https://public.vulnerablecode.io/vulnerabilities/search/ <https://public.vulnerablecode.io/vulnerabilities/search/>`_

How to search by vulnerabilities:

1. Go to the URL: `https://public.vulnerablecode.io/vulnerabilities/search <https://public.vulnerablecode.io/vulnerabilities/search>`_
1. Go to the URL: `https://public.vulnerablecode.io/vulnerabilities/search/ <https://public.vulnerablecode.io/vulnerabilities/search/>`_
2. Enter the VCID, CVE, GHSA, CPEs etc. in the search box.
3. Click on the search button.

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = vulnerablecode
version = 36.1.0
version = 36.1.2
license = Apache-2.0 AND CC-BY-SA-4.0

# description must be on ONE line https://github.com/pypa/setuptools/issues/1390
Expand Down
2 changes: 1 addition & 1 deletion vulnerabilities/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2005,7 +2005,7 @@ def set_vulnerablecode_version_and_commit(self):
msg = f"Field vulnerablecode_version already set to {self.vulnerablecode_version}"
raise ValueError(msg)

self.vulnerablecode_version = VULNERABLECODE_VERSION
self.vulnerablecode_version = vulnerablecode.get_git_tag()
self.vulnerablecode_commit = vulnerablecode.get_short_commit()
self.save(update_fields=["vulnerablecode_version", "vulnerablecode_commit"])

Expand Down
25 changes: 24 additions & 1 deletion vulnerablecode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import git

__version__ = "36.1.0"
__version__ = "36.1.2"


PROJECT_DIR = Path(__file__).resolve().parent
Expand Down Expand Up @@ -49,6 +49,29 @@ def get_git_commit_from_version_file():
return


def get_git_tag_from_version_file():
"""Return the tag from the ".VERSION" file."""
version_file = ROOT_DIR / ".VERSION"
if not version_file.exists():
return

try:
lines = version_file.read_text().splitlines()
ref_line = lines[0]
if "tag:" in ref_line:
if vcio_tag := ref_line.split("tag:")[-1].strip():
return vcio_tag
except (UnicodeDecodeError):
return


def get_git_tag():
"""Return the tag from the ".VERSION" file or __version__."""
if vcio_tag := get_git_tag_from_version_file():
return vcio_tag
return __version__


def get_short_commit():
"""
Return the short commit hash from the .VERSION file or from `git describe`
Expand Down
Loading
0