Skip to content

Commit

Permalink
Merge pull request #16050 from MinaProtocol/dkijania/fix_HEAD_error
Browse files Browse the repository at this point in the history
Pass BUILDKITE_BRANCH env variable to ensure correct debian version
  • Loading branch information
dkijania authored Sep 16, 2024
2 parents 7a3ad2b + 66ccf9f commit 783e1ce
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion buildkite/scripts/build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ echo " Includes mina daemon, archive-node, rosetta, generate keypair for devnet"


echo "--- Prepare debian packages"
./scripts/debian/build.sh $@
BRANCH_NAME="$BUILDKIE_BRANCH" ./scripts/debian/build.sh $@

echo "--- Git diff after build is complete:"
git diff --exit-code -- .
6 changes: 3 additions & 3 deletions buildkite/scripts/export-git-env-vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ function find_most_recent_numeric_tag() {
}

export GITHASH=$(git rev-parse --short=7 HEAD)
export GITBRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD | sed 's!/!-!g; s!_!-!g; s!#!-!g' )

export THIS_COMMIT_TAG=$(git tag --points-at HEAD)
export PROJECT="mina"
Expand All @@ -26,8 +25,9 @@ export BUILD_URL=${BUILDKITE_BUILD_URL}
set -u

export MINA_DEB_CODENAME=${MINA_DEB_CODENAME:=bullseye}
[[ -n "$BUILDKITE_BRANCH" ]] && export GITBRANCH=$(echo "$BUILDKITE_BRANCH" | sed 's!/!-!g; s!_!-!g; s!#!-!g')

[[ -n "$BUILDKITE_BRANCH" ]] && export GITBRANCH=$(echo "$BUILDKITE_BRANCH" | sed 's!/!-!g; s!_!-!g; s!#!-!g') || export GITBRANCH=$(git name-rev --name-only $GITHASH | sed "s/remotes\/origin\///g" | sed 's!/!-!g; s!_!-!g; s!#!-!g' )


export RELEASE=unstable

if [ "${BUILDKITE_REPO}" != "${MINA_REPO}" ]; then
Expand Down
9 changes: 8 additions & 1 deletion scripts/debian/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
set -eox pipefail

SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
source ${SCRIPTPATH}/../export-git-env-vars.sh

# In case of running this script on detached head, script has difficulties in finding out
# what is the current branch.
if [[ -n "$BRANCH_NAME" ]]; then
source ${SCRIPTPATH}/../export-git-env-vars.sh -b $BRANCH_NAME
else
source ${SCRIPTPATH}/../export-git-env-vars.sh
fi

echo "after export"

Expand Down
7 changes: 5 additions & 2 deletions scripts/export-git-env-vars.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/bin/bash
set -euo pipefail

set -x


# In case of running this script on detached head, script has difficulties in finding out
# what is the current
echo "Exporting Git Variables: "

git fetch
Expand All @@ -19,7 +21,8 @@ function find_most_recent_numeric_tag() {

export GITHASH=$(git rev-parse --short=7 HEAD)
export THIS_COMMIT_TAG=$(git tag --points-at HEAD)
export GITBRANCH=$(git name-rev --name-only $GITHASH | sed "s/remotes\/origin\///g" | sed 's!/!-!g; s!_!-!g; s!#!-!g' )

[[ -n "$BRANCH_NAME" ]] && export GITBRANCH=$(echo "$BRANCH_NAME" | sed 's!/!-!g; s!_!-!g; s!#!-!g') || export GITBRANCH=$(git name-rev --name-only $GITHASH | sed "s/remotes\/origin\///g" | sed 's!/!-!g; s!_!-!g; s!#!-!g' )

export GITTAG=$(find_most_recent_numeric_tag HEAD)

Expand Down

0 comments on commit 783e1ce

Please sign in to comment.