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

[WebToolsE2E][Aspire]Error "failed to add files..." pop up after run command "azd pipeline config" #3868

Closed
v-yuwzh opened this issue May 7, 2024 · 3 comments

Comments

@v-yuwzh
Copy link

v-yuwzh commented May 7, 2024

INSTALL STEPS

  1. Clean machine: Win11 x64 23h2 ENU
  2. Install Dev17.10.0 Preview 7 [rel.d17.10-34902.84] (Includes Aspire 8.0.0-preview.7.24251.11)
  3. Apply NuGet Feeds.
  4. Install azd use power shell
    powershell -ex AllSigned -c "Invoke-RestMethod 'https://aka.ms/install-azd.ps1' -OutFile 'install-azd.ps1'; ./install-azd.ps1 -Version 'daily'"

REPRO STEPS
1.File > New Project > .NET Aspire Starter Application > Make sure .NET 8.0 is select, ensure that Use Redis for caching(requires a supported container runtime) is checked.
2.Open a new terminal window and cd into the root of the project and type azd init.
3.Create a folder named .github at the root of your project, create a folder workflows in ".github" folder, create
azure-dev.yml in folder "workflows" then add below code to azure-dev.yml file.

on:
  workflow_dispatch:
  push:
    # Run when commits are pushed to mainline branch (main or master)
    # Set this to the mainline branch you are using
    branches:
      - main

permissions:
  id-token: write
  contents: read

jobs:
  build:
    runs-on: ubuntu-latest
    env:
      AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
      AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
      AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
      AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
      AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
      AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install azd
        uses: Azure/setup-azd@v0.1.0

      - name: Install .NET Aspire workload
        run: dotnet workload install aspire

      - name: Log in with Azure (Federated Credentials)
        if: ${{ env.AZURE_CLIENT_ID != '' }}
        run: |
          azd auth login `
            --client-id "$Env:AZURE_CLIENT_ID" `
            --federated-credential-provider "github" `
            --tenant-id "$Env:AZURE_TENANT_ID"
        shell: pwsh

      - name: Log in with Azure (Client Credentials)
        if: ${{ env.AZURE_CREDENTIALS != '' }}
        run: |
          $info = $Env:AZURE_CREDENTIALS | ConvertFrom-Json -AsHashtable;
          Write-Host "::add-mask::$($info.clientSecret)"

          azd auth login `
            --client-id "$($info.clientId)" `
            --client-secret "$($info.clientSecret)" `
            --tenant-id "$($info.tenantId)"
        shell: pwsh

      - name: Provision Infrastructure
        run: azd provision --no-prompt

      - name: Deploy Application
        run: azd deploy --no-prompt

4.Run the azd pipeline config command and type "y" when azd prompts you to commit and push your local changes to start the configured CI pipeline.

Note:
1.The workaround is sample, just close the vs and the command window, then reopen the command window, rerun the "azd pipeline config", this issue will not repro.
2.When do scenario Tutorial: Deploy a .NET Aspire app using the Azure Developer CLI and GitHub Actions meet this issue, can refer this for details info.

ACTUAL: Error pop up"failed to add files..."
image

ERROR: git push: adding files: failed to add files: exit code: 128, stdout: , stderr: warning: in the working copy of '.gitignore', LF will be replaced by CRLF the next time Git touches it
error: open(".vs/AspireSample/FileContentIndex/c963a3b7-5269-46f1-8405-9bf21f5b58c9.vsidx"): Permission denied
error: unable to index file '.vs/AspireSample/FileContentIndex/c963a3b7-5269-46f1-8405-9bf21f5b58c9.vsidx'
fatal: adding files failed

EXPECTED No Error pop up.

@v-yuwzh v-yuwzh changed the title [WebToolsE2E][Aspire]Error "failed to add files..." pop up after run command "azd pipeline config " [WebToolsE2E][Aspire]Error "failed to add files..." pop up after run command "azd pipeline config" May 7, 2024
@rajeshkamal5050
Copy link

@v-yuwzh doesn't seem to be an issue with azd pipeline config since the error is coming from git push.

Please try adding .vs/* to .gitignore and try. @vhvb1989 do you see anything else going on?

@v-yuwzh
Copy link
Author

v-yuwzh commented May 11, 2024

@rajeshkamal5050 , when add .vs/* to .gitignore, this issue will not repro, thanks for your solution.

Copy link
Contributor

Hi @v-yuwzh, since you haven’t asked that we “/unresolve” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve” to reopen the issue.

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

No branches or pull requests

2 participants