Azure / functions-action

Enable GitHub developers to deploy to Azure Function Apps using GitHub Actions
MIT License
152 stars 75 forks source link

Error with v1.5.2: path should be a relative path string but got "/home/runner/work/<repo>/<repo>/worker.config.json" #233

Closed zagjason-sa-taylorfarms closed 3 months ago

zagjason-sa-taylorfarms commented 3 months ago

New deployments using v1.5.2 are failing with the below error message. Reverting to 1.5.1 allows the deployment to complete successfully.

Error

Error: Execution Exception (state: PreparePublishContent) (step: Invocation)
Error:   path should be a `path.relative()`d string, but got "/home/runner/work/azure-splashtop-api-app/azure-splashtop-api-app/worker.config.json"
Error:     RangeError: path should be a `path.relative()`d string, but got "/home/runner/work/azure-splashtop-api-app/azure-splashtop-api-app/worker.config.json"
    at throwError (/home/runner/work/_actions/azure/functions-action/v1/node_modules/ignore/index.js:387:9)
    at checkPath (/home/runner/work/_actions/azure/functions-action/v1/node_modules/ignore/index.js:406:12)
    at Ignore._test (/home/runner/work/_actions/azure/functions-action/v1/node_modules/ignore/index.js:527:5)
    at Ignore.ignores (/home/runner/work/_actions/azure/functions-action/v1/node_modules/ignore/index.js:572:17)
    at /home/runner/work/_actions/azure/functions-action/v1/lib/utils/funcignore.js:35:30
    at Array.forEach (<anonymous>)
    at FuncIgnore.removeFilesFromFuncIgnore (/home/runner/work/_actions/azure/functions-action/v1/lib/utils/funcignore.js:33:18)
    at ContentPreparer.removeFilesDefinedInFuncignore (/home/runner/work/_actions/azure/functions-action/v1/lib/handlers/contentPreparer.js:166:28)
    at ContentPreparer.<anonymous> (/home/runner/work/_actions/azure/functions-action/v1/lib/handlers/contentPreparer.js:87:36)
    at Generator.next (<anonymous>)
Error: Deployment Failed!

workflow:

# this workflow will deploy the function code to Azure Function Apps

name: 'Build and Deploy Azure Functions'

on:
  workflow_call:
    inputs:
      gh_environment:
        description: GitHub Environment
        required: true
        type: string
      functionapp_name:
        description: Azure FuctionApp Name
        required: true
        type: string
      dotnet_version:
        description: DotNet version
        required: true
        type: string
    secrets:
      azure_client_id:
        description: Azure Client ID
        required: true
      azure_subscription_id:
        description: Azure Subscription ID
        required: true
      azure_tenant_id:
        description: Azure AD Tenant ID
        required: true

#These environment variables are used by the terraform azure provider to setup OIDD authenticate. 
env:
  ARM_CLIENT_ID: "${{ secrets.azure_client_id }}"
  ARM_SUBSCRIPTION_ID: "${{ secrets.azure_subscription_id }}"
  ARM_TENANT_ID: "${{ secrets.azure_tenant_id }}"

jobs:
  deploy-functions:
    name: 'Deploy Functions'
    runs-on: ubuntu-latest
    environment: ${{ inputs.gh_environment }}

    defaults:
      run:
        shell: bash
        working-directory: function-app

    steps:
    # Checkout the repository to the GitHub Actions runner
    - name: Checkout
      uses: actions/checkout@v4

    # Login to Azure
    - name: Azure Login
      uses: azure/login@v2
      with:
        client-id: ${{ secrets.AZURE_CLIENT_ID }}
        tenant-id: ${{ secrets.AZURE_TENANT_ID }}
        subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID}}

    - name: Setup DotNet ${{ inputs.dotnet_version }} Environment
      id: setup-dotnet
      uses: actions/setup-dotnet@v4
      with:
        dotnet-version: ${{ inputs.dotnet_version }}

    - name: Resolve Project Dependencies Using Dotnet
      id: resolve-dependencies
      run: |
        pushd '.'
        dotnet build --configuration Release --output ./output
        cp .funcignore ./output/
        popd

    - name: Deploy FunctionApp
      id: deploy-func
      uses: azure/functions-action@v1
      with:
        app-name: ${{ inputs.functionapp_name }}
        package: "function-app/output"
        respect-funcignore: true

.funcignore content

.git*
.vscode
__azurite_db*__.json
__blobstorage__
__queuestorage__
local.settings.json
test
README.md
GaaraZhu commented 3 months ago

Rolling back to the previous version solved the issue in my end. Azure/functions-action@v1.5.1

paychex-ssmithrand commented 3 months ago

Also getting this same issue! Ours is a python deployment.

patelchandni commented 3 months ago

Thank you for raising this. Until the issue is resolved, reverted v1 to v1.5.1

patelchandni commented 3 months ago

Fixed in PR: https://github.com/Azure/functions-action/pull/234

patelchandni commented 3 months ago

Released fix for v1.5.2. Now v1 is pointing again to v1.5.2.

@zagjason-sa-taylorfarms , @GaaraZhu , @paychex-ssmithrand - please confirm issue is fixed on v1. Thank you all!

Exelscior commented 3 months ago

Issue seems fixed now at least for us by returning to v1. Thank-you.