Skip to content

Commit 7075d95

Browse files
committed
Follow the instructions in konflux-ci/rpmbuild-pipeline#112
1 parent d42d038 commit 7075d95

File tree

4 files changed

+74
-1
lines changed

4 files changed

+74
-1
lines changed

Containerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ ADD python_scripts/select_architectures.py /usr/local/bin/select_architectures.p
3232
# TODO: We need to find a better place for this datafile (and autogenerate it)
3333
ADD arch-specific-macro-overrides.json /etc/arch-specific-macro-overrides.json
3434

35-
ADD patch-git.lua /usr/bin
35+
ADD patch-git-prepare.sh /usr/bin
3636

3737
# TODO: Find a better way to ensure that we never execute RPMSpecParser in Konflux.
3838
RUN sed -i 's/# Note: These calls will alter the results of any subsequent macro expansion/sys.exit(1)/' \

patch-git-prepare.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#! /bin/sh -x
2+
3+
# See https://github.com/konflux-ci/rpmbuild-pipeline/issues/112
4+
5+
export TZ=UTC LC_ALL=C.utf8
6+
git log --first-parent --no-renames --raw --pretty=fuller --date=default "$@" > patch-git-generated-log.txt

tests/patch-git-example-output.txt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
commit c8d343a3ff7f6be17ff1d0dd7f89d06845c0a18b
2+
Author: Pavel Raiskup <praiskup@redhat.com>
3+
AuthorDate: Thu Mar 6 18:43:42 2025 +0100
4+
Commit: Pavel Raiskup <praiskup@redhat.com>
5+
CommitDate: Thu Mar 6 19:23:04 2025 +0100
6+
7+
Correct Tekton path
8+
9+
:000000 100644 0000000 2bca131 A .tekton/environment-pull-request.yaml
10+
:000000 100644 0000000 0397e8d A .tekton/environment-push.yaml
11+
:100644 000000 2bca131 0000000 D environment-pull-request.yaml
12+
:100644 000000 0397e8d 0000000 D environment-push.yaml
13+
14+
commit 8c78e9e9c32492c00a75b31a281c57cc69e42f66
15+
Author: Pavel Raiskup <praiskup@redhat.com>
16+
AuthorDate: Thu Mar 6 14:15:36 2025 +0100
17+
Commit: Pavel Raiskup <praiskup@redhat.com>
18+
CommitDate: Thu Mar 6 14:24:17 2025 +0100
19+
20+
Tektonize
21+
22+
:000000 100644 0000000 2bca131 A environment-pull-request.yaml
23+
:000000 100644 0000000 0397e8d A environment-push.yaml
24+
25+
commit e0ea9d05f330a91bb1a5f60005bfae30a4b18df0
26+
Author: Pavel Raiskup <praiskup@redhat.com>
27+
AuthorDate: Tue Mar 4 12:47:00 2025 +0100
28+
Commit: Pavel Raiskup <praiskup@redhat.com>
29+
CommitDate: Tue Mar 4 12:47:00 2025 +0100
30+
31+
Fully-qualified image reference
32+
33+
:100644 100644 e4c5edd dfea447 M Containerfile
34+
35+
commit 1fca25484f458311cb64536cec315e62f275cdc1
36+
Author: Pavel Raiskup <praiskup@redhat.com>
37+
AuthorDate: Tue Mar 4 12:40:07 2025 +0100
38+
Commit: Pavel Raiskup <praiskup@redhat.com>
39+
CommitDate: Tue Mar 4 12:44:25 2025 +0100
40+
41+
Initial commit
42+
43+
:000000 100644 0000000 e4c5edd A Containerfile
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""
2+
Test patch-git-prepare.sh script
3+
"""
4+
import subprocess
5+
import tempfile
6+
from pathlib import Path
7+
8+
9+
def test_patch_git_prep():
10+
"""
11+
Just run the script against our repo, and compare expected output.
12+
"""
13+
base_dir = Path(__file__).parent.absolute()
14+
script_path = base_dir / ".." / "patch-git-prepare.sh"
15+
expected_file = base_dir / "patch-git-example-output.txt"
16+
17+
with tempfile.TemporaryDirectory(dir=base_dir) as tmp_dir:
18+
tmp_path = Path(tmp_dir)
19+
commit = "c8d343a3ff7f6be17ff1d0dd7f89d06845c0a18b"
20+
subprocess.run([str(script_path), commit], cwd=tmp_path, check=True)
21+
generated_file = tmp_path / "patch-git-generated-log.txt"
22+
actual_content = generated_file.read_text()
23+
expected_content = expected_file.read_text()
24+
assert actual_content == expected_content

0 commit comments

Comments
 (0)