Skip to content

Commit

Permalink
7 char git shorthash
Browse files Browse the repository at this point in the history
  • Loading branch information
emdoyle committed Aug 18, 2024
1 parent ffdb571 commit d399761
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion api/src/deploy/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async def deploy(
try:
deploy_config = DeployConfig(**json.loads(json_data))
# TODO: more careful handling here
deploy_config.git_hash = deploy_config.git_hash[:8]
deploy_config.git_hash = deploy_config.git_hash[:7]
except Exception:
raise HTTPException(status_code=422, detail="Couldn't process deployment data.")

Expand Down
8 changes: 4 additions & 4 deletions pkg/pare/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
@lru_cache(maxsize=1)
def get_current_git_hash() -> str:
if settings.PARE_GIT_HASH:
if len(settings.PARE_GIT_HASH) > 8:
if len(settings.PARE_GIT_HASH) > 7:
log_warning(
"PARE_GIT_HASH is longer than 8 characters. Using the first 8 characters."
"PARE_GIT_HASH is longer than 7 characters. Using the first 7 characters."
)
return settings.PARE_GIT_HASH[:8]
return settings.PARE_GIT_HASH[:7]

# if the git hash is not provided, we will try to get it from the current git state
try:
Expand All @@ -28,7 +28,7 @@ def get_current_git_hash() -> str:

try:
return (
subprocess.check_output(["git", "rev-parse", "HEAD"]).decode().strip()[:8]
subprocess.check_output(["git", "rev-parse", "HEAD"]).decode().strip()[:7]
)
except subprocess.CalledProcessError:
log_error("Pare failed to get the current git hash.")
Expand Down

0 comments on commit d399761

Please sign in to comment.