1
0
mirror of https://github.com/quay/quay.git synced 2026-01-27 18:42:52 +03:00
Files
quay/_init.py
Kenny Lee Sin Cheong 86d150a204 dockerfile: refactor dockerfile (PROJQUAY-1997) (#787)
* cicd: toggle on more OCI conformance tests (PROJQUAY-1997)

This commit also has the CI keep the report around as a workflow
artifact.

Signed-off-by: Hank Donnay <hdonnay@redhat.com>

* external_libraries: patch out wider dependencies (PROJQUAY-1997)

This change makes it possible to run the external_libraries script
without needing to pull in the entire quay configuration framework. This
will allow for a more granular Dockerfile.

Signed-off-by: Hank Donnay <hdonnay@redhat.com>

* cicd: enable docker buildkit backend (PROJQUAY-1997)

Signed-off-by: Hank Donnay <hdonnay@redhat.com>

* Dockerfile: rework to be faster (PROJQUAY-1997)

This change allows for the Dockerfile to reuse more cache, and run in
parallel when using the BuildKit backend.

* init: Uses user site-package directory as Python root (PROJQUAY-1997)

Use `python3 -m site --user-site` as Python root when installing certs.

Co-authored-by: Hank Donnay <hdonnay@redhat.com>
2021-05-12 10:36:58 -04:00

61 lines
1.7 KiB
Python

import os
import re
import subprocess
try:
from util.config.provider import get_config_provider
except ModuleNotFoundError:
# Stub out this call so that we can run the external_libraries script
# without needing the entire codebase.
def get_config_provider(*args, **kwargs):
return None
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
CONF_DIR = os.getenv("QUAYCONF", os.path.join(ROOT_DIR, "conf/"))
STATIC_DIR = os.path.join(ROOT_DIR, "static/")
STATIC_LDN_DIR = os.path.join(STATIC_DIR, "ldn/")
STATIC_FONTS_DIR = os.path.join(STATIC_DIR, "fonts/")
STATIC_WEBFONTS_DIR = os.path.join(STATIC_DIR, "webfonts/")
TEMPLATE_DIR = os.path.join(ROOT_DIR, "templates/")
IS_TESTING = "TEST" in os.environ
IS_BUILDING = "BUILDING" in os.environ
IS_KUBERNETES = "KUBERNETES_SERVICE_HOST" in os.environ
OVERRIDE_CONFIG_DIRECTORY = os.path.join(CONF_DIR, "stack/")
config_provider = get_config_provider(
OVERRIDE_CONFIG_DIRECTORY,
"config.yaml",
"config.py",
testing=IS_TESTING,
kubernetes=IS_KUBERNETES,
)
def _get_version_number_changelog():
try:
with open(os.path.join(ROOT_DIR, "CHANGELOG.md")) as f:
for line in f:
if line[0:5] == "## [v":
return line.split("[")[1].split("]")[0]
except IOError:
return ""
def _get_git_sha():
if os.path.exists("GIT_HEAD"):
with open(os.path.join(ROOT_DIR, "GIT_HEAD")) as f:
return f.read()
else:
try:
return subprocess.check_output(["git", "rev-parse", "HEAD"]).strip()[0:8]
except (OSError, subprocess.CalledProcessError, Exception):
pass
return "unknown"
__version__ = _get_version_number_changelog()
__gitrev__ = _get_git_sha()