Skip to content

Broken autogenerated build.sh script #2613

@donsokolone

Description

@donsokolone

Bug Report

I'm having an issue with deploying Azure Web App (of type webAppLinux) due to a bug in generated build.sh script for my pipeline configuration.

Here is the build log output:

Starting: Deploy Azure Web App : <CENSORED>
==============================================================================
Task         : Azure Web App
Description  : Deploy an Azure Web App for Linux or Windows
Version      : 1.257.0
Author       : Microsoft Corporation
Help         : https://aka.ms/azurewebapptroubleshooting
==============================================================================
Got service connection details for Azure App Service:'<CENSORED>'
Package deployment using ZIP Deploy initiated.
Updating submodules.
Preparing deployment for commit id 'f940ddb7-1'.
PreDeployment: context.CleanOutputPath False
PreDeployment: context.OutputPath /home/site/wwwroot
Repository path is /tmp/zipdeploy/extracted
Running oryx build...
Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.11 -p virtualenv_name=antenv --log-file /tmp/build-debug.log  -i /tmp/8ddbd43eec68bfd --compress-destination-dir | tee /tmp/oryx-build.log
Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
You can report issues at https://github.com/Microsoft/Oryx/issues

Oryx Version: 0.2.20250611.1+0649de32f1279969c9023dd41b389cce4bb94493, Commit: 0649de32f1279969c9023dd41b389cce4bb94493, ReleaseTagName: 20250611.1

Build Operation ID: 34612743655faa00
Repository Commit : f940ddb7-1bc8-4900-96ce-1e08bc0b93fe
OS Type           : bullseye
Image Type        : githubactions

Primary SDK Storage URL: https://oryx-cdn.microsoft.io
Backup SDK Storage URL: https://oryxsdks-cdn.azureedge.net
Detecting platforms...
External SDK provider is enabled.
Requesting metadata for platform python from external SDK provider
Requesting metadata for platform python from external SDK provider
Detected following platforms:
  python: 3.11.12
Requesting metadata for platform python from external SDK provider
Version '3.11.12' of platform 'python' is not installed. Generating script to install it...

Using intermediate directory '/tmp/8ddbd43eec68bfd'.

Copying files to the intermediate directory...
Done in 0 sec(s).

Source directory     : /tmp/8ddbd43eec68bfd
Destination directory: /home/site/wwwroot


Downloading and extracting 'python' version '3.11.12' to '/tmp/oryx/platforms/python/3.11.12'...
Detected image debian flavor: bullseye.
Skipping download of python version 3.11.12 as it is available in external sdk provider cache...
Extracting contents...
Successfully extracted python version 3.11.12 from external sdk provider cache...
Done in 6 sec(s).

image detector file exists, platform is python..
OS detector file exists, OS is bullseye..
Executing pre-build command...
/tmp/BuildScriptGenerator/ad3d7f27e98c4729936217c85673d61a/build.sh: line 204: Mon: command not found
/tmp/BuildScriptGenerator/ad3d7f27e98c4729936217c85673d61a/build.sh: line 204: Mon: command not found\n/bin/bash -c "oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.11 -p virtualenv_name=antenv --log-file /tmp/build-debug.log  -i /tmp/8ddbd43eec68bfd --compress-destination-dir | tee /tmp/oryx-build.log ; exit $PIPESTATUS "

Generating summary of Oryx build
Parsing the build logs
Found 0 issue(s)

Build Summary :
===============
Errors (0)
Warnings (0)

Deployment Failed. deployer = VSTS_ZIP_DEPLOY deploymentPath = ZipDeploy. Extract zip.
##[error]Failed to deploy web package to App Service.
##[warning]Can't find loc string for key: KuduStackTraceURL
##[error]KuduStackTraceURL https://$<CENSORED>/api/vfs/LogFiles/kudu/trace
##[error]Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
Successfully updated deployment History at https://<CENSORED>/api/deployments/3688331751885376796
App Service Application URL: <CENSORED>
Finishing: Deploy Azure Web App : <CENSORED>

Bugged line 204 in generated build script contains following code:

`date` >> build-date.txt

But it should be:

echo `date` >> build-date.txt

Below is Azure Pipeline YAML that I use:

# Python to Linux Web App on Azure
# Build your Python project and deploy it to Azure as a Linux Web App.
# Change python version to one thats appropriate for your application.
# https://docs.microsoft.com/azure/devops/pipelines/languages/python

trigger:
  - main

parameters:
  - name: slot
    displayName: Slot
    type: string
    default: production
    values:
      - production
      - slot

variables:
  azureServiceConnectionName: "<CENSORED>"
  webAppName: "<CENSORED>"
  environmentName: "<CENSORED>"
  projectRoot: $(System.DefaultWorkingDirectory)
  pythonVersion: "3.11"

stages:
  - stage: Build
    displayName: Build stage
    jobs:
      - job: BuildJob
        pool:
          vmImage: ubuntu-22.04
        steps:
          - task: UsePythonVersion@0
            inputs:
              versionSpec: "$(pythonVersion)"
            displayName: "Use Python $(pythonVersion)"
          - task: ArchiveFiles@2
            displayName: "Archive files"
            inputs:
              rootFolderOrFile: "$(projectRoot)"
              includeRootFolder: false
              archiveType: zip
              archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
              replaceExistingArchive: true
          - publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
            displayName: "Publish package"
            artifact: drop

  - stage: Deploy
    displayName: "Deploy Web App"
    dependsOn: Build
    condition: succeeded()
    jobs:
      - deployment: DeploymentJob
        pool:
          name: TCI-OnPrem-Win
        environment: $(environmentName)
        strategy:
          runOnce:
            deploy:
              steps:
                - task: AzureWebApp@1
                  displayName: "Deploy Azure Web App : $(webAppName)"
                  inputs:
                    azureSubscription: $(azureServiceConnectionName)
                    appType: "webAppLinux"
                    appName: $(webAppName)
                    package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip
                    slotName: ${{ parameters.slot }}
                    runtimeStack: "PYTHON|3.11"
                    # There seems to be a problem with using startup scripts (startup.sh)
                    # and the windows agent used to deploy the application.
                    # The agent messes up the line terminators of the script, making it unusable
                    startUpCommand: "apt-get update && apt-get install -y git && gunicorn"

Kudu version:

Kudu Version : 20250623.5
Commit       : 353543ec4c45fcbfd4750522d32c94e23b31927a

Could you fix that please as this prevents me & my project team from conducting critical production deployments? Thank you!

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