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

Maintenance locks and interactivity #598

Commits on Aug 22, 2023

  1. fixup! maintenance: delete stale lock files

    This change from microsoft#468 is causing multiple maintenance
    processes to get blocked on credentials instead of only one. The change
    did more harm than good.
    
    This reverts commit 95ed7f6.
    derrickstolee committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    1eae5bd View commit details
    Browse the repository at this point in the history

Commits on Aug 23, 2023

  1. credential: add new interactive config option

    When scripts or background maintenance wish to perform HTTP(S) requests,
    there is a risk that our stored credentials might be invalid. At the
    moment, this causes the credential helper to ping the user and block the
    process. Even if the credential helper does not ping the user, Git falls
    back to the 'askpass' method, which includes a direct ping to the user
    via the terminal.
    
    Even setting the 'core.askPass' config as something like 'echo' will
    causes Git to fallback to a terminal prompt. It uses
    git_terminal_prompt(), which finds the terminal from the environment and
    ignores whether stdin has been redirected. This can also block the
    process awaiting input.
    
    Create a new config option to prevent user interaction, favoring a
    failure to a blocked process.
    
    The chosen name, 'credential.interactive', is taken from the config
    option used by Git Credential Manager to already avoid user
    interactivity, so there is already one credential helper that integrates
    with this option. However, older versions of Git Credential Manager also
    accepted other string values, including 'auto', 'never', and 'always'.
    The modern use is to use a boolean value, but we should still be
    careful that some users could have these non-booleans. Further, we
    should respect 'never' the same as 'false'. This is respected by the
    implementation and test, but not mentioned in the documentation.
    
    The implementation for the Git interactions takes place within
    credential_getpass(). The method prototype is modified to return an
    'int' instead of 'void'. This allows us to detect that no attempt was
    made to fill the given credential, changing the single caller slightly.
    
    Also, a new trace2 region is added around the interactive portion of the
    credential request. This provides a way to measure the amount of time
    spent in that region for commands that _are_ interactive. It also makes
    a conventient way to test that the config option works with
    'test_region'.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    979bd6f View commit details
    Browse the repository at this point in the history
  2. maintenance: add custom config to background jobs

    At the moment, some background jobs are getting blocked on credentials
    during the 'prefetch' task. This leads to other tasks, such as
    incremental repacks, getting blocked. Further, if a user manages to fix
    their credentials, then they still need to cancel the background process
    before their background maintenance can continue working.
    
    Update the background schedules for our four scheduler integrations to
    include these config options via '-c' options:
    
     * 'credential.interactive=false' will stop Git and some credential
       helpers from prompting in the UI (assuming the '-c' parameters are
       carried through and respected by GCM).
    
     * 'core.askPass=true' will replace the text fallback for a username
       and password into the 'true' command, which will return a success in
       its exit code, but Git will treat the empty string returned as an
       invalid password and move on.
    
    We can do some testing that the credentials are passed, at least in the
    systemd case due to writing the service files.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    1fe1292 View commit details
    Browse the repository at this point in the history
  3. scalar: configure maintenance during 'reconfigure'

    The 'scalar reconfigure' command is intended to update registered repos
    with the latest settings available. However, up to now we were not
    reregistering the repos with background maintenance.
    
    In particular, this meant that the background maintenance schedule would
    not be updated if there are improvements between versions.
    
    Be sure to register repos for maintenance during the reconfigure step.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    a18c320 View commit details
    Browse the repository at this point in the history
  4. fixup! scalar: do initialize gvfs.sharedCache

    In this commit, we added the 'credential.interactive=never' option to
    unattended scalar options. This should be changed to 'false' to match
    the modern use of this config option.
    
    But also, we have a test that requires using askpass to get credentials,
    but the test is in unattended mode. Fix that test to include
    'credential.interactive=true' to bypass this issue.
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    e5459ea View commit details
    Browse the repository at this point in the history