Skip to content
This repository was archived by the owner on Jan 20, 2022. It is now read-only.

Conversation

@fourpastmidnight
Copy link
Contributor

The organization I currently work for recently had a spate of deployment failures when Octopus Deploy attempted to transform some application configuration files. After a few days' time, we finally determined that this internal Octopus Deploy process was responsible for the deployment failures because it does a directory scan looking for files to transform. One of the file's absolute path in the extracted deployment package location exceeded MAX_PATH characters.

The file exceeding the MAX_PATH length was a 0-byte text file that is created during builds made with Visual Studio (Build Tools) 2017/2019 as a result of this dotnet/msbuild pull request. This was not caught with the most recent release of OctoPack (v3.6.4 on 14 Jan. 2019) because the unit tests were never updated to use newer versions of the MSBuild build tools.

This pull request updates the unit tests to attempt to find newer versions of the MSBuild build tools (it's still hard-coded and will only work up to Visual Studio 2019) and use those first over older build tools. In addition, the OctoPack.targets file was updated to exclude this extraneous file from being packaged by OctoPack.

@CLAassistant
Copy link

CLAassistant commented Aug 13, 2020

CLA assistant check
All committers have signed the CLA.

@tothegills tothegills self-assigned this Aug 18, 2020
@fourpastmidnight fourpastmidnight force-pushed the fixes-CopyComplete-files-from-being-included-in-octopack-packages branch 2 times, most recently from 2fda0d9 to 6b2d597 Compare August 20, 2020 02:20
Back in January, 2018, PR 2878 at dotnet/msbuild was merged. (See
https://www.github.com/dotnet/msbuild/pull/2878). There was one simple
change, but it unknowingly caused OctoPack to start including extra
unnecessary files into OctoPack packages. We found it because we had
deployments blow up in Octopus Deploy due to file paths which exceeded
MAX_PATH length during deployment, specifically, during config file
transformation.

The PR had the result of, when copying files marked as CopyLocal, a
*.csproj.CopyComplete file is created. It's a marker for the build
process so that transitively referenced projects are built
appropriately. Near as far as I can tell, because the file is created
(via the Touch task) during this target, and subsequently added to the
@(FileWrites) item group, and because the path associated with
@(CopyUpToDateMarker) item group is an absolute path, the existing
exclusion in the OctoPack.targets file is not filtering out these files.
So they are being included in the OctoPack deployment packages. While
the files are 0-bytes in size and are harmless, they don't belong in the
package. They are not a deployable build artifact, and in my case,
caused deployment failures.

This wasn't caught in changes to OctoPack between Jan. 2018 and Jan.
2019 (the last time any change was made to this repo, and the date of
the most recent release) because the unit tests were never appropriately
updated to take into account newer versions of Visual Studio, namely
Visual Studio 2017 and Visual Studio 2019.

This commit updates the unit tests and the OctoPack.targets file so that
these useless *.csproj.CopyComplete files are not added to OctoPack
deployment packages.
@fourpastmidnight fourpastmidnight force-pushed the fixes-CopyComplete-files-from-being-included-in-octopack-packages branch from 6b2d597 to f364187 Compare August 20, 2020 14:46
Copy link
Contributor

@tothegills tothegills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant, thank you.

@tothegills tothegills merged commit 1b8c00c into OctopusDeploy:master Aug 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants