question

MichaelvanOlden-1009 avatar image
0 Votes"
MichaelvanOlden-1009 asked MichaelvanOlden-1009 commented

Azure App Service (Linux) CI/CD build does not remove files that were deleted from repository

I'm using Azure App Service (Linux) App Service Build Service (CI/CD) to deploy a PHP application.

I removed the files (package.json, eraseme.php), but those files are not deleted from /wwwroot when the site is deployed to Azure.

The Azure App Service Build Service does the following:

Clones the repository to a local directory path "/repository".
Runs package.json and composer.json to install dependencies.
Copies "/repository" to "/wwwroot".
When I list the contents of the "/repository" directory, my deleted files are NOT THERE. This directory properly reflects the 'master' branch of my GIT repository.

However, when the files are moved to "/wwwroot", the package.json and eraseme.php files ARE STILL THERE.

Has anyone else run into this issue? If so, I would appreciate any guidance that you are willing to offer.

Logs from Azure CI/CD deployment:

 4:45:08 PM - Updating submodules.
 4:45:10 PM - Preparing deployment for commit id 'da0f786f06'.
 4:45:10 PM - Repository path is /home/site/repository
 4:45:10 PM - Running oryx build...  (See Oryx logs below)
 4:47:23 PM - Running post deployment command(s)...
 4:47:24 PM - Triggering recycle (preview mode disabled).
 4:47:24 PM - Deployment successful.

Oryx Logs

 Command: oryx build /home/site/repository -o /home/site/wwwroot --platform php --platform-version 7.3 -i /tmp/8d8ea4eb902b3c0 --log-file /tmp/build-debug.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.20210120.1, Commit: 66c7820d7df527aaffabd2563a49ad57930999c9, ReleaseTagName: 20210120.1
    
 Build Operation ID: |G/7ihko0yFs=.b39d9a41_
 Repository Commit : da0f786f0646fc957398a50da31f19aff35f6193
    
 Detecting platforms...
 Detected following platforms:
 php: 7.3.26
    
 Using intermediate directory '/tmp/8d8ea4eb902b3c0'.
    
 Copying files to the intermediate directory...
 Done in 52 sec(s).
    
 Source directory : /tmp/8d8ea4eb902b3c0
 Destination directory: /home/site/wwwroot
    
 PHP executable: /tmp/oryx/platforms/php/7.3.26/bin/php
 Composer archive: /opt/php-composer/1.9.3/composer.phar
 Running 'composer install --ignore-platform-reqs --no-interaction'...
    
 Loading composer repositories with package information
 Installing dependencies (including require-dev) from lock file
 Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
 Package operations: 5 installs, 0 updates, 0 removals
 - Installing ckdarby/silverpopphp (dev-master 3b8c5ed): Cloning 3b8c5ed525 from cache
 - Installing robrichards/xmlseclibs (dev-master 0f54660): Cloning 0f5466070e from cache
 - Installing robrichards/wse-php (2.0.3): Loading from cache
 - Installing firebase/php-jwt (dev-master bac0422): Cloning bac0422822 from cache
 - Installing salesforce-mc/fuel-sdk-php (dev-master 8018468): Cloning 8018468706 from cache
 Generating autoload files
 Preparing output...
    
 Copying files to destination directory '/home/site/wwwroot'...
 Done in 31 sec(s).
    
 Removing existing manifest file
 Creating a manifest file...
 Manifest file created.
    
 Done in 88 sec(s).


azure-webapps-content-deployment
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ryanchill avatar image
1 Vote"
ryanchill answered MichaelvanOlden-1009 commented

Hi @MichaelvanOlden-1009,

The Azure App Service Deploy task has a RemoveAdditionalFilesFlag setting. Set that to true to remove the files that's on the destination. That should remove package.json and eraseme.php.

Regards,
Ryan


· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you @ryanchill for your help!

You are correct, 'RemoveAdditionalFilesFlag: true/false' is the setting that we need. However, it does not appear to be an option when using the 'Azure Service Build Service' CI/CD. This is the CI/CD method that we want to use. Note, this is different than 'Azure Pipelines' CI/CD, which we are not using.

As a follow-up question, I would like to know if the 'RemoveAdditionalFilesFlag: true/false' setting is configurable somehow using Azure Service Build Service.

0 Votes 0 ·
ryanchill avatar image ryanchill MichaelvanOlden-1009 ·

If you're using Kudu as your source repository for deployments, I didn't find any remove additional file settings in https://github.com/projectkudu/kudu/wiki. Kudu will simply use the files in the repo folder, usually https://yourwebapp.scm.azurewebsites.net/api/vfs/site/repository/ assuming SCM_REPOSITORY_PATH hasn't been modified. I would verify the files aren't part of the repo. If they are, that's why they keep popping up and just use git rm to get remove them. Same applies if your Kudu is using an external repository.

1 Vote 1 ·

Thanks again @ryanchill for taking time out to help me!

1 Vote 1 ·