Skip to content

Commit

Permalink
Merge pull request #318850 from msanft/ssm-session-manager-plugin/bui…
Browse files Browse the repository at this point in the history
…ld-go-module

ssm-session-manager-plugin: migrate to buildGoModule
  • Loading branch information
Mic92 authored Jul 21, 2024
2 parents fd193e1 + bbb4986 commit 880af94
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 57 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
From e246c4f87c1af78be5f5a76f79bd66c27d63918f Mon Sep 17 00:00:00 2001
From: Paul Meyer <49727155+katexochen@users.noreply.github.com>
Date: Wed, 3 Jul 2024 21:38:15 +0200
Subject: [PATCH] module support

Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
---
go.mod | 26 ++++++++++++++++++++++++++
go.sum | 42 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 68 insertions(+)
create mode 100644 go.mod
create mode 100644 go.sum

diff --git a/go.mod b/go.mod
new file mode 100644
index 00000000..51c79d4c
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,26 @@
+module github.com/aws/session-manager-plugin
+
+go 1.22.3
+
+require (
+ github.com/aws/aws-sdk-go v1.54.14
+ github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575
+ github.com/eiannone/keyboard v0.0.0-20220611211555-0d226195f203
+ github.com/fsnotify/fsnotify v1.7.0
+ github.com/gorilla/websocket v1.5.3
+ github.com/stretchr/testify v1.9.0
+ github.com/twinj/uuid v0.0.0-20151029044442-89173bcdda19
+ github.com/xtaci/smux v1.5.24
+ golang.org/x/crypto v0.24.0
+ golang.org/x/sync v0.7.0
+ golang.org/x/sys v0.21.0
+)
+
+require (
+ github.com/davecgh/go-spew v1.1.1 // indirect
+ github.com/jmespath/go-jmespath v0.4.0 // indirect
+ github.com/pmezard/go-difflib v1.0.0 // indirect
+ github.com/stretchr/objx v0.5.2 // indirect
+ golang.org/x/term v0.21.0 // indirect
+ gopkg.in/yaml.v3 v3.0.1 // indirect
+)
diff --git a/go.sum b/go.sum
new file mode 100644
index 00000000..ca623749
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,42 @@
+github.com/aws/aws-sdk-go v1.54.14 h1:llJ60MzLzovyDE/rEDbUjS1cICh7krk1PwQwNlKRoeQ=
+github.com/aws/aws-sdk-go v1.54.14/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
+github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 h1:kHaBemcxl8o/pQ5VM1c8PVE1PubbNx3mjUr09OqWGCs=
+github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575/go.mod h1:9d6lWj8KzO/fd/NrVaLscBKmPigpZpn5YawRPw+e3Yo=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/eiannone/keyboard v0.0.0-20220611211555-0d226195f203 h1:XBBHcIb256gUJtLmY22n99HaZTz+r2Z51xUPi01m3wg=
+github.com/eiannone/keyboard v0.0.0-20220611211555-0d226195f203/go.mod h1:E1jcSv8FaEny+OP/5k9UxZVw9YFWGj7eI4KR/iOBqCg=
+github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
+github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
+github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
+github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
+github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
+github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
+github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
+github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
+github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
+github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
+github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
+github.com/twinj/uuid v0.0.0-20151029044442-89173bcdda19 h1:HlxV0XiEKMMyjS3gGtJmmFZsxQ22GsLvA7F980il+1w=
+github.com/twinj/uuid v0.0.0-20151029044442-89173bcdda19/go.mod h1:mMgcE1RHFUFqe5AfiwlINXisXfDGro23fWdPUfOMjRY=
+github.com/xtaci/smux v1.5.24 h1:77emW9dtnOxxOQ5ltR+8BbsX1kzcOxQ5gB+aaV9hXOY=
+github.com/xtaci/smux v1.5.24/go.mod h1:OMlQbT5vcgl2gb49mFkYo6SMf+zP3rcjcwQz7ZU7IGY=
+golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
+golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
+golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
+golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
+golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
+golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA=
+golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
--
2.45.1

70 changes: 70 additions & 0 deletions pkgs/by-name/ss/ssm-session-manager-plugin/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{ lib
, fetchFromGitHub
, buildGoModule
, fetchpatch
}:
buildGoModule rec {
pname = "ssm-session-manager-plugin";
version = "1.2.650.0";

src = fetchFromGitHub {
owner = "aws";
repo = "session-manager-plugin";
rev = version;
hash = "sha256-IcDVt/iE/EYV9Blvl7Gj0UFJcdsUCFdaSQkIto0CKRI=";
};

patches = [
# Add support for Go modules.
#
# This patch doesn't belong to any upstream PR, it is specially crafted for
# nixpkgs. Deleting the vendor dir is left out from the patch and done in
# postPatch instead, as otherwise the patch would be to big and GitHub returns
# an error.
#
# With https://github.com/aws/session-manager-plugin/pull/74 there is an
# upstream PR with the same goal. It isn't pulled here as patch for the same
# reason.
#
# Notice that the dependencies are pinned with the patch, and upstream dependency
# updates won't take effect. Patch should be recreated from time to time.
# - `rm -rf vendor`
# - `go mod init github.com/aws/session-manager-plugin`
# - `go mod tidy`
# - `go get github.com/twinj/uuid@v0.0.0-20151029044442-89173bcdda19`
# - `go mod tidy`
# - `git checkout HEAD vendor`
./0001-module-support.patch
];

postPatch = ''
rm -rf vendor
'';

vendorHash = "sha256-wK+aWRC5yrPtdihXAj6RlYC9ZTTPuGUg9wLY33skzeE=";

subPackages = [ "src/sessionmanagerplugin-main" ];

preBuild = ''
echo -n ${lib.escapeShellArg version} > VERSION
go run src/version/versiongenerator/version-gen.go
'';

doCheck = true;
checkFlags = [ "-skip=TestSetSessionHandlers" ];

preCheck = ''
if ! [[ $($GOPATH/bin/sessionmanagerplugin-main --version) = ${lib.escapeShellArg version} ]]; then
echo 'wrong version'
exit 1
fi
'';

meta = {
homepage = "https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html";
description = "Amazon SSM Session Manager Plugin";
mainProgram = "session-manager-plugin";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ amarshall mbaillie ];
};
}
2 changes: 0 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17382,8 +17382,6 @@ with pkgs;
inherit (darwin) libobjc;
};

ssm-session-manager-plugin = callPackage ../applications/networking/cluster/ssm-session-manager-plugin { };

starlark-rust = callPackage ../development/interpreters/starlark-rust { };

supercollider = libsForQt5.callPackage ../development/interpreters/supercollider {
Expand Down

0 comments on commit 880af94

Please sign in to comment.