Skip to content

Commit

Permalink
need to add backports for newer git - otherwise python3 git module wo…
Browse files Browse the repository at this point in the history
…n't work
  • Loading branch information
HenriWahl committed Jan 22, 2023
1 parent 45248a9 commit 97b4cb7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ LABEL [email protected]

ARG DEBIAN_FRONTEND=noninteractive

# need to add backports for newer git - otherwise python3 git module won't work
RUN echo "deb http://deb.debian.org/debian buster-backports main" > /etc/apt/sources.list.d/buster-backports.list

# python3 and git needed for build-modify-extension.py
RUN apt -y update && \
apt -y install python3 \
python3-git

# need to add backports for newer git - otherwise python3 git module won't work
RUN apt -y install -t buster-backports git

# scripts used need to be executable
COPY build/build-entrypoint.sh build/build-modify-extension.py /
RUN chmod +x /build-entrypoint.sh /build-modify-extension.py
Expand Down
6 changes: 5 additions & 1 deletion build/build-modify-extension.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@
if Path(package_file_path).exists() and Path(package_file_path).is_file():
# get version information from git repo
repo = Repo(path=git_repo_path, search_parent_directories=True)

print(repo.tags)
print(repo.head)

# if no tag is latest take repo head
version_repo = next((tag for tag in repo.tags if tag.commit == repo.head.commit), repo.head.commit)
if type(version_repo) == Commit:
# first 8 characters of commit
version = version_repo.hexsha[0:8]
elif type(version_repo) == TagReference:
# Tag
# Tagl
version = version_repo.name
if version.startswith('v'):
version = version.split('v')[1]
Expand Down

0 comments on commit 97b4cb7

Please sign in to comment.