Sitelet https://github.com/fsprojects/Paket/issues/1382
Skip to content

Nuget source credentials management #1382

Description

@FrenchMigVaz

Hello,
We are preparing the introduction of Paket for managing package references in our company for our main product codebase.
The packages for this codebase are stored in an Artifactory repository with no anonymous access.
Developers need to use their LDAP company credentials to access it, the build agents are using a build account.
A developer's password changes every 3 months, the build account password never changes.

We would like to use the command paket.exe config add-credentials to solve this problem.
It works fine to restore packages once the credentials are stored.
But when using this solution, we also need to catch up the moment where the stored credentials need to change properly.
We handle calling paket.bootstrapper.exe and paket.exe from a bootstrap.bat file in the root of our codebase. I wanted to programmatically detect when paket was failing to restore packages because of credentials.

Unfortunately, neither paket.bootstrapper.exe or paket.exe are returning a proper exit code different than 0 when there is a critical error:

  • paket.bootstrapper.exe is ordered to force download from Nuget, from a Nuget feed that does not exist, it returns exit code 0 (I tried to simulate a situation where the dev cannot access internet)
  • paket.exe is ordered to restore packages and the nuget source credentials are incorrect, it returns 0

The simple batch script I wrote to test that, meant to be executed from the root folder of the codebase:

@ECHO off

echo Downloading latest paket.exe with paket.boostrapper.exe

call "%~dp0\.paket\paket.bootstrapper.exe" --force-nuget --nuget-source=https://artifacts.sonova.com/artifactory/api/nuget/chinook-production

echo Exit Code for paket.bootstrapper.exe is %errorlevel%

if errorlevel 1 (

    if exist "%~dp0\.paket\paket.exe" (

        echo paket.bootstrapper.exe failed, but current paket.exe is present and can be used

    ) else (
        echo paket.bootstrapper.exe failed, and there is no existing paket.exe file.

        echo Package restoration process cannot continue

        pause

        exit /b 1
    )
)

echo.

echo Restoring packages with paket.exe

call "%~dp0\.paket\paket.exe" restore

echo Exit Code for paket.exe restore is %errorlevel%

if errorlevel 1 (
   echo paket.exe failed to restore packages

   exit /b %errorlevel%
)

pause

@ECHO on

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions