Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minio: set version to a valid datetime string #121786

Merged
merged 1 commit into from May 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion pkgs/servers/minio/default.nix
@@ -1,5 +1,18 @@
{ lib, buildGoModule, fetchFromGitHub, nixosTests }:

let
# The web client verifies, that the server version is a valid datetime string:
# https://github.com/minio/minio/blob/3a0e7347cad25c60b2e51ff3194588b34d9e424c/browser/app/js/web.js#L51-L53
#
# Example:
# versionToTimestamp "2021-04-22T15-44-28Z"
# => "2021-04-22T15:44:28Z"
versionToTimestamp = version:
let
splitTS = builtins.elemAt (builtins.split "(.*)(T.*)" version) 1;
in
builtins.concatStringsSep "" [ (builtins.elemAt splitTS 0) (builtins.replaceStrings [ "-" ] [ ":" ] (builtins.elemAt splitTS 1)) ];
bachp marked this conversation as resolved.
Show resolved Hide resolved
in
buildGoModule rec {
pname = "minio";
version = "2021-04-22T15-44-28Z";
Expand All @@ -18,7 +31,7 @@ buildGoModule rec {
subPackages = [ "." ];

patchPhase = ''
sed -i "s/Version.*/Version = \"${version}\"/g" cmd/build-constants.go
sed -i "s/Version.*/Version = \"${versionToTimestamp version}\"/g" cmd/build-constants.go
sed -i "s/ReleaseTag.*/ReleaseTag = \"RELEASE.${version}\"/g" cmd/build-constants.go
sed -i "s/CommitID.*/CommitID = \"${src.rev}\"/g" cmd/build-constants.go
'';
Expand Down