Skip to content
Snippets Groups Projects
Verified Commit 26c63f85 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: test scripts

parent f6b81496
No related branches found
No related tags found
No related merge requests found
Pipeline #26134 failed
......@@ -55,14 +55,6 @@
bob = let
projectDefinition = import ./project.nix;
projectHash =
if (self' ? shortRev)
then self'.shortRev
else "dirty";
lastModifiedDate =
self'.lastModifiedDate or self'.lastModified or "19700101";
sourcePath = ./source;
in
# https://nixos.wiki/wiki/Go
......@@ -79,10 +71,10 @@
ldflags = [
"-s -w"
"-X '${projectDefinition.modulePath}/release.version=${projectDefinition.version}'"
"-X '${projectDefinition.modulePath}/release.commit=${projectHash}'"
"-X '${projectDefinition.modulePath}/release.commit=${projectDefinition.commitHash}'"
"-X '${projectDefinition.modulePath}/release.name=${projectDefinition.name}'"
"-X '${projectDefinition.modulePath}/release.mnemonic=${projectDefinition.mnemonic}'"
"-X '${projectDefinition.modulePath}/release.buildDate=${lastModifiedDate}'"
"-X '${projectDefinition.modulePath}/release.buildDate=${builtins.date}'"
];
#vendorHash = null;
......
......@@ -7,4 +7,5 @@
modulePath = "gitlab.schukai.com/oss/bob";
version = "0.4.11"; ## do not change this line; it will be updated automatically
vendorHash = null; ## do not change this line; it will be updated automatically
commitHash = "f6b8149"; ## do not change this line; it will be updated automatically
}
......@@ -11,9 +11,10 @@ in ''
#!${pkgs.bash}/bin/bash
${common}
defaultHash="${pkgs.lib.fakeHash}"
echo_step "Reset vendorHash to default value: $defaultHash"
${pkgs.gnused}/bin/sed -i "s|vendorHash\s*=\s*null|vendorHash = \"$defaultHash\"|g" ${workingDirectory}/project.nix
${pkgs.gnused}/bin/sed -i "s|vendorHash\s*=\s*\"[^\"]\"|vendorHash = \"$defaultHash\"|g" ${workingDirectory}/project.nix
......@@ -31,8 +32,6 @@ in ''
fi
echo_ok "No dependencies found and vendorHash is set to null."
${pkgs.git}/bin/git add $filepath/project.nix
${pkgs.git}/bin/git commit -m "chore: Update vendorHash to null" ${workingDirectory}/project.nix
exit 0
fi
......
......@@ -17,10 +17,21 @@ ${common}
cmd=${versionsTool}/bin/version
echo_step "Getting current commit hash"
HASH=$(${pkgs.git}/bin/git -C ${workingDirectory}/ rev-parse --short HEAD)
echo_ok "Current commit hash is ''${HASH}"
echo_step "Replacing hash in project.nix"
if ! ${pkgs.gnused}/bin/sed -i "s|commitHash\s*=\s*\"[^\"]*\"|commitHash = \"''${HASH}\"|g" ${workingDirectory}/project.nix ; then
echo_fail "Hash not replaced"
exit 1
fi
echo_ok "Hash updated"
echo_step "Checking if there is a new version"
if ! $cmd auto --git --exit-code-if-no-bump ; then
echo_step "No version bump"
echo_fail "No version jump to a new version"
fi
VERSION=$($cmd print --git)
......@@ -31,15 +42,14 @@ if [[ -z "''${VERSION}" ]]; then
exit 1
fi
echo_step "Replacing version in project.nix"
echo_step "Check version in project.nix"
# check if version replaced
if ! ${pkgs.gnused}/bin/sed -i "s/version\s*=\s*\"[^\"]*\"/version = \"''${VERSION}\"/g" ${workingDirectory}/project.nix; then
echo_fail "Version not replaced"
exit 1
exit 1
fi
echo_ok "Version replaced"
echo_ok "Version and hash updated"
''
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment