Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion .devcontainer/S-CORE/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@ RUN groupadd --gid $USER_GID $USERNAME \
USER $USERNAME

# Install trudag using pipx
RUN pipx install git+https://gitlab.com/CodethinkLabs/trustable/trustable@9957f12171cb898d83df5ae708fdba0a38fece2e && \
RUN pipx install git+https://gitlab.com/CodethinkLabs/trustable/trustable@v2025.10.22 && \
pipx ensurepath
2 changes: 1 addition & 1 deletion .devcontainer/S-CORE/post_create_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ source .venv/bin/activate

# Install trustable
pip install --require-hashes -r .devcontainer/S-CORE/requirements.txt
pip install git+https://gitlab.com/CodethinkLabs/trustable/trustable@9957f12171cb898d83df5ae708fdba0a38fece2e
pip install git+https://gitlab.com/CodethinkLabs/trustable/trustable@v2025.10.22
4 changes: 3 additions & 1 deletion .dotstop_extensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,11 @@ Since no persistent data store is established as of now, the current implementat
The input of the data store are the data generated by the trudag tool during the `score` or `publish` operation. These data have the format:

```
[{"scores": [{id: "ID-1", "score": score}, ...], "info": {"Repository root": "my_repository", "Commit SHA": "sha_123", "Commit date/time": "%a %b %d %H:%M:%S %Y", "Commit tag": "my_tag", "CI job id": 123, "Schema version": 123, "Branch name": "my_branch"}}]
[{"scores": [{id: "ID-1", "score": score}, ...], "info": {"Repository root": "my_repository", "Commit SHA": "sha_123", "Commit date/time": <unix_timestamp>, "Commit tag": "my_tag", "CI job id": 123, "Schema version": 123, "Branch name": "my_branch"}}]
```

Note: Starting with trudag v2025.09.16, "Commit date/time" is a unix timestamp (integer) instead of a formatted string. The values for "Commit SHA", "Commit tag", "CI job id", and "Branch name" can also be `None`.

## push

This functionality writes the generated data into an sqlite database `TrustableScoring.db` located in the folder `TSF`. This database contains two tables, `commit_info`, where the metadata of "info" are stored, and `scores`, where the scores are stored, and which references `commit_info` via the date as foreign key.
Expand Down
21 changes: 13 additions & 8 deletions .dotstop_extensions/data_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@ def get_my_data() -> list[dict]:
command = f"SELECT * FROM scores WHERE date=={info[0]}"
cursor.execute(command)
scores = cursor.fetchall()
date = datetime.fromtimestamp(info[0])
date_as_string = date.strftime("%a %b %d %H:%M:%S %Y")
# Return unix timestamp directly for trudag v2025.09.16+ compatibility
# (older versions expected formatted string, newer versions expect int)
date_timestamp = info[0]
if len(info) == 6:
branch_name = ""
else:
branch_name = info[6] if info[6]!=None else ""
commit = {"Repository root": info[1],
"Commit SHA": info[2],
"Commit date/time": date_as_string,
"Commit date/time": date_timestamp,
"Commit tag": info[3],
"CI job id": info[4],
"Schema version": info[5],
Expand Down Expand Up @@ -71,11 +72,15 @@ def push_my_data(data: list[dict]):
# extract data from data
info = data[0].get("info")
scores = data[0].get("scores")
# Currently, the commit date is stored as string.
# Since the local timezone is used and for comparison,
# it would be better to have it as a unix-timestamp.
datum_string = info.get("Commit date/time")
datum = int(datetime.strptime(datum_string, "%a %b %d %H:%M:%S %Y").timestamp())
# Starting with trudag v2025.09.16, the commit date is already a unix timestamp (int).
# For backward compatibility, handle both string and int formats.
datum_value = info.get("Commit date/time")
if isinstance(datum_value, str):
# Old format: string date, convert to timestamp
datum = int(datetime.strptime(datum_value, "%a %b %d %H:%M:%S %Y").timestamp())
else:
# New format: already a unix timestamp
datum = datum_value
# check if current commit coincides with existing commit
cursor.execute("SELECT MAX(date) AS recent_commit FROM commit_info")
if datum == cursor.fetchone()[0]:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y graphviz
pip install git+https://gitlab.com/CodethinkLabs/trustable/trustable@9957f12171cb898d83df5ae708fdba0a38fece2e
pip install git+https://gitlab.com/CodethinkLabs/trustable/trustable@v2025.10.22

- name: Install tools
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_publication.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y graphviz
pip install git+https://gitlab.com/CodethinkLabs/trustable/trustable@9957f12171cb898d83df5ae708fdba0a38fece2e
pip install git+https://gitlab.com/CodethinkLabs/trustable/trustable@v2025.10.22

- name: Generate trudag report
run: |
Expand Down
Loading