mirror of
https://github.com/openshift/installer.git
synced 2026-02-06 18:47:19 +01:00
hack/build: Use SOURCE_GIT_COMMIT if set
ART copies occasional snapshots from upstream repositories like this
one into dist-git repositories for their builds. That means their
commit hashes diverge from ours, because they have a different history
behind them:
$ oc adm release info --image-for=installer registry.svc.ci.openshift.org/ocp/release:4.1.0-0.nightly-2019-05-09-204138
quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:9b9a6273ca34edab857324e9a32e9f333d0fdd52c15851fa4d0e51447d92e3c0
$ oc image info quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:9b9a6273ca34edab857324e9a32e9f333d0fdd52c15851fa4d0e51447d92e3c0 | grep ' io.openshift'
io.openshift.build.commit.id=403a93d1f683384800597ac38e9c2fc0180b3a5d
io.openshift.build.commit.url=403a93d1f6
io.openshift.build.source-location=https://github.com/openshift/installer
io.openshift.tags=openshift,base
$ oc image extract --file /usr/bin/openshift-install quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:9b9a6273ca34edab857324e9a32e9f333d0fdd52c15851fa4d0e51447d92e3c0
$ chmod +x openshift-install
$ ./openshift-install version
./openshift-install v4.1.0-201905091432-dirty
built from commit 10c88f2455d26c1ac1465dbbc44825e4366eb467
release image registry.svc.ci.openshift.org/origin/release:v4.1
Tree hashes should still match, but we don't want to have to explain
the difference between commits and trees to users. ART is going to
set the SOURCE_GIT_COMMIT environment variable for us with the
associated upstream commit. With this commit, we'll use that when
it's set, and fall back to querying the local repository when it
isn't.
This commit is contained in:
@@ -31,7 +31,8 @@ then
|
||||
fi
|
||||
|
||||
MODE="${MODE:-release}"
|
||||
LDFLAGS="${LDFLAGS} -X github.com/openshift/installer/pkg/version.Raw=$(git describe --always --abbrev=40 --dirty) -X github.com/openshift/installer/pkg/version.Commit=$(git rev-parse --verify 'HEAD^{commit}')"
|
||||
GIT_COMMIT="${SOURCE_GIT_COMMIT:-$(git rev-parse --verify 'HEAD^{commit}')}"
|
||||
LDFLAGS="${LDFLAGS} -X github.com/openshift/installer/pkg/version.Raw=$(git describe --always --abbrev=40 --dirty) -X github.com/openshift/installer/pkg/version.Commit=${GIT_COMMIT}"
|
||||
TAGS="${TAGS:-}"
|
||||
OUTPUT="${OUTPUT:-bin/openshift-install}"
|
||||
export CGO_ENABLED=0
|
||||
|
||||
Reference in New Issue
Block a user