Merge pull request #272592 from l0b0/fix-aws-azure-login-puppeteer-browser

aws-azure-login: Link Puppeteer to Chromium
This commit is contained in:
Ivan Mincik 2024-01-15 19:12:42 +01:00 committed by GitHub
commit 192f06934e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 8 deletions

View File

@ -1,5 +1,7 @@
{ lib
, callPackage
, stdenv
, chromium
, fetchFromGitHub
, fetchYarnDeps
, makeWrapper
@ -7,24 +9,23 @@
, prefetch-yarn-deps
, yarn
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "aws-azure-login";
version = "3.6.1";
src = fetchFromGitHub {
owner = "aws-azure-login";
repo = "aws-azure-login";
rev = "v${version}";
rev = "v${finalAttrs.version}";
hash = "sha256-PvPnqaKD98h3dCjEOwF+Uc86xCJzn2b9XNHHn13h/2Y=";
};
offlineCache = fetchYarnDeps {
yarnLock = "${src}/yarn.lock";
yarnLock = "${finalAttrs.src}/yarn.lock";
hash = "sha256-SXQPRzF6b1FJl5HkyXNm3kGoNSDXux+0RYXBX93mOts=";
};
nativeBuildInputs = [
nativeBuildInputs = [
makeWrapper
nodejs
prefetch-yarn-deps
@ -60,17 +61,22 @@ stdenv.mkDerivation rec {
cp -r . "$out/lib/node_modules/aws-azure-login"
makeWrapper "${nodejs}/bin/node" "$out/bin/aws-azure-login" \
--add-flags "$out/lib/node_modules/aws-azure-login/lib/index.js"
--add-flags "$out/lib/node_modules/aws-azure-login/lib/index.js" \
--set PUPPETEER_EXECUTABLE_PATH "${lib.getExe chromium}"
runHook postInstall
'';
passthru.tests.aws-azure-login = callPackage ./tests.nix {
package = finalAttrs.finalPackage;
};
meta = {
description = "Use Azure AD SSO to log into the AWS via CLI";
homepage = "https://github.com/aws-azure-login/aws-azure-login";
license = lib.licenses.mit;
mainProgram = "aws-azure-login";
maintainers = with lib.maintainers; [ yurrriq ];
maintainers = with lib.maintainers; [ l0b0 ];
platforms = lib.platforms.all;
};
}
})

View File

@ -0,0 +1,24 @@
{ lib
, runCommand
, package
}:
runCommand "${package.pname}-tests"
{
HOME = "/tmp/home";
} ''
mkdir -p "''${HOME}/.aws"
cat > "''${HOME}/.aws/config" <<'EOF'
[profile my-profile]
azure_tenant_id=3f03e308-ada1-45f7-9cc3-ab777eaba2d3
azure_app_id_uri=4fbf61f5-7302-42e5-9585-b18ad0e4649d
azure_default_username=user@example.org
azure_default_role_arn=
azure_default_duration_hours=1
azure_default_remember_me=false
EOF
! ${lib.getExe package} --profile=my-profile 2> stderr
[[ "$(cat stderr)" == 'Unable to recognize page state! A screenshot has been dumped to aws-azure-login-unrecognized-state.png. If this problem persists, try running with --mode=gui or --mode=debug' ]]
touch $out
''