microsoft / microsoft/Oryx

Scripts in appsvc.yaml are mangled by replacing newlines with semicolons

Open
#2,415 0 comments 0 reactions 1 assignee View on GitHub

@sarsharma is already working on this.

Since May 2, 2024.

Dominant language
C#
Stars
881
Forks
195
Avg merge
20h 13m
Merged PRs (30d)
13

Description

Bug Report
  • At what date and time did you most recently experience the problem?

April 29, 2024 11:00 AM EDT

  • Where did you experience the problem? E.g. Azure Web Apps, Azure Functions, Azure Container Registry, or offline use.

Azure Web Apps

  • If your repo is publicly available please share its URL:

N/A

  • What happened?

The build service mangles the pre- and post-build scripts in appsvc.yaml by blindly replacing every newline with a semicolon. This can result in invalid shell syntax and a build failure.

Problem code is here:

https://github.com/microsoft/Oryx/blob/d37b2225a252ab2c04b4726024d047cf01ea1318/src/BuildScriptGenerator/DefaultBuildScriptGenerator.cs#L345

and here:

https://github.com/microsoft/Oryx/blob/d37b2225a252ab2c04b4726024d047cf01ea1318/src/BuildScriptGenerator/DefaultBuildScriptGenerator.cs#L355

  • What did you expect or want to happen?

My build to pass and my scripts to not be modified

  • How can we reproduce it?

Create an appsvc.yaml with the following content:

version: 1

pre-build: |
  if true; then
      echo Pre-build script ran successfully
  fi
  • Do you have log output? Please include between the backticks:
Deploy Async
Updating branch 'master'.
Updating submodules.
Preparing deployment for commit id 'b85a120746'.
PreDeployment: context.CleanOutputPath False
PreDeployment: context.OutputPath /home/site/wwwroot
Repository path is /home/site/repository
Running oryx build...
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.20230508.1, Commit: 7fe2bf39b357dd68572b438a85ca50b5ecfb4592, ReleaseTagName: 20230508.1

Build Operation ID: 93a2122bf380fa0c
Repository Commit : b85a12074694b3cd0ca4a9698e45e0df6a431f4e
OS Type           : bullseye
Image Type        : githubactions

Detecting platforms...
Detected following platforms:
  python: 3.10.13

Found BuildConfigurationFile
Overriding the pre-build commands with the BuildConfigurationFile section
        if true; then;  echo Pre-build script ran successfully;fi;

Using intermediate directory '/tmp/8dc685f7d24a77f'.

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

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

Executing pre-build command...
/tmp/BuildScriptGenerator/c9d188f914de4b4bb3c873ac914f9216/build.sh: line 100: syntax error near unexpected token `;'

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

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

Deployment Failed. deployer =  deploymentPath =
Deployment failed
Error - Changes committed to remote repository but deployment to website failed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.