Skip to content

Commit 957e509

Browse files
authored
Merge pull request #37 from cmathews393/beta
Merge in version outputting to better track issues
2 parents c2b1c50 + d0f9eb6 commit 957e509

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

.github/workflows/docker-image.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ jobs:
3131
push: true
3232
tags: |
3333
0xchloe/spotiplex:${{ github.ref_name == 'main' && 'latest' || github.ref_name }}
34-
34+
build-args: |
35+
COMMIT_SHA=${{ github.sha }}

Dockerfile

+9-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@ ENV POETRY_VERSION=1.7.1
66
ENV PYTHONUNBUFFERED=1
77
ENV CRON_SCHEDULE=@daily
88
ENV DOCKER=True
9+
10+
# Accept commit SHA as a build argument
11+
ARG COMMIT_SHA
12+
ENV COMMIT_SHA=${COMMIT_SHA}
13+
914
# Install Poetry
1015
RUN pip install "poetry==$POETRY_VERSION"
1116

1217
# Copy the application source code
1318
COPY ./spotiplex ${SRC_DIR}/spotiplex
1419
COPY pyproject.toml poetry.lock ${SRC_DIR}/
1520
COPY README.md ${SRC_DIR}/
21+
1622
# Set the working directory
1723
WORKDIR ${SRC_DIR}
1824

@@ -24,11 +30,11 @@ RUN poetry config virtualenvs.create false \
2430
RUN wget -O /usr/local/bin/supercronic https://github.com/aptible/supercronic/releases/download/v0.1.11/supercronic-linux-amd64 \
2531
&& chmod +x /usr/local/bin/supercronic
2632

27-
2833
# Copy entrypoint script
2934
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
3035
RUN chmod +x /usr/local/bin/entrypoint.sh
3136

32-
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
33-
37+
# Log the commit SHA during the build
38+
RUN echo "Built from commit SHA: $COMMIT_SHA"
3439

40+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "spotiplex"
3-
version = "0.1.0"
3+
version = "1.0.0"
44
description = ""
55
authors = ["0xChloe <[email protected]>"]
66
license = "GPLv3"

spotiplex/config.py

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Config:
1313
"""Generic Config class to pull environment vars."""
1414

1515
if os.environ.get("DOCKER"):
16+
SPOTIPLEX_VERSION = os.environ.get("COMMIT_SHA")
1617
SPOTIFY_API_KEY = os.environ.get("SPOTIFY_API_KEY")
1718
SPOTIFY_API_ID = os.environ.get("SPOTIFY_API_ID")
1819

spotiplex/main.py

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import spotiplex.modules.confighandler.main as config_handler
99
import spotiplex.modules.spotiplex.main as sp_module
10+
from spotiplex.config import Config
1011

1112
logger.trace("Initializing logger...")
1213
logger.remove()
@@ -20,6 +21,7 @@
2021
@app.command()
2122
def sync_lidarr_imports() -> None:
2223
"""Syncs all playlists currently being pulled via Lidarr."""
24+
logger.debug("We are running on commit: ", Config.SPOTIPLEX_VERSION)
2325
sp_instance = sp_module.Spotiplex(lidarr=True, playlist_id=None)
2426
sp_instance.run()
2527

@@ -34,6 +36,7 @@ def generate_env() -> None:
3436
@app.command()
3537
def sync_manual_lists() -> None:
3638
"""Syncs all playlists specified in config file."""
39+
logger.debug("We are running on commit: ", Config.SPOTIPLEX_VERSION)
3740
sp_instance = sp_module.Spotiplex(lidarr=False, playlist_id=None)
3841
sp_instance.run()
3942

0 commit comments

Comments
 (0)