Skip to content

Commit 3275622

Browse files
committed
fix: determine correct version for Golang components
1 parent fc6810e commit 3275622

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

opa/Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,11 @@ WORKDIR /opa
8585

8686
RUN <<EOF
8787
# Unfortunately, we need to create a dummy Git repository to allow cyclonedx-gomod to determine the version of OPA
88-
git init
89-
git add go.mod
90-
git config --global user.email "[email protected]"
91-
git config --global user.name "dummy"
92-
git commit -m "dummy"
93-
git tag "${PRODUCT}"
88+
git init && \
89+
git config user.email "[email protected]" && \
90+
git config user.name "Fake commiter" && \
91+
git commit --allow-empty --message "Fake commit, so that we can create a tag" &&
92+
git tag "v${PRODUCT}"
9493
go build -o opa -buildmode=exe
9594
~/go/bin/cyclonedx-gomod app -json -output-version 1.5 -output "opa_${PRODUCT}.cdx.json" -packages -files
9695
EOF

statsd_exporter/Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@ curl "https://repo.stackable.tech/repository/packages/statsd_exporter/statsd_exp
3131
cd "statsd_exporter-${PRODUCT}" || exit
3232

3333
# Unfortunately, we need to create a dummy Git repository to allow cyclonedx-gomod to determine the version of statsd_exporter
34-
git init
35-
git add go.mod
36-
git config --global user.email "[email protected]"
37-
git config --global user.name "dummy"
38-
git commit -m "dummy"
39-
git tag "${PRODUCT}"
34+
git init && \
35+
git config user.email "[email protected]" && \
36+
git config user.name "Fake commiter" && \
37+
git commit --allow-empty --message "Fake commit, so that we can create a tag" &&
38+
git tag "v${PRODUCT}"
4039
go build -o ../statsd_exporter
4140
$GOPATH/bin/cyclonedx-gomod app -json -output-version 1.5 -output ../statsd_exporter-${PRODUCT}.cdx.json -packages -files
4241
)

0 commit comments

Comments
 (0)