Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output build artifacts to artifacts folder #8159

Merged
merged 16 commits into from
Jan 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
**/*

# Include the build.
!src/Package/Release/ResourceManager/**/*
!src/Package/Debug/ResourceManager/**/*
!artifacts/Release/**/*
!artifacts/Debug/**/*
!tools/InstallationTests/NetcoreTests/**/*
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Azure PowerShell specific
src/Publish/
src/Package/
artifacts/
src/Stack/
src/local-artifacts/*
/tools/AzureRM/AzureRM.psm1
Expand Down
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ before_install:
# https://github.com/travis-ci/travis-ci/issues/1066#issuecomment-383489298
script:
- sudo dotnet msbuild build.proj /t:Full /p:Configuration=$CONFIG || travis_terminate 1
# - sudo dotnet src/Package/StaticAnalysis/StaticAnalysis.Netcore.dll -p $TRAVIS_BUILD_DIR/src/Package/$CONFIG -r $TRAVIS_BUILD_DIR/src/Package/StaticAnalysis -u || travis_terminate 1
# - sudo pwsh -NonInteractive -NoLogo -NoProfile -File tools/TestModuleLoading.ps1 || travis_terminate 1
# - sudo dotnet test src/Azure.PowerShell.Netcore.Test.sln --filter "AcceptanceType=CheckIn&RunType!=DesktopOnly" --configuration $CONFIG --framework netcoreapp2.0

after_success:
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ FROM mcr.microsoft.com/powershell

ARG CONFIG=Release

COPY src/Package/${CONFIG}/ResourceManager/AzureResourceManager /usr/local/share/powershell/Modules
COPY artifacts/${CONFIG} /usr/local/share/powershell/Modules
COPY tools/InstallationTests/NetcoreTests /azpstests
2 changes: 1 addition & 1 deletion Repo.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
<RepoSrc>$(RepoRoot)src\</RepoSrc>
<RepoArtifacts>$(RepoSrc)Package\</RepoArtifacts>
<RepoArtifacts>$(RepoRoot)artifacts\</RepoArtifacts>
<RepoTools>$(RepoRoot)tools\</RepoTools>
</PropertyGroup>

Expand Down
89 changes: 39 additions & 50 deletions build.proj
Original file line number Diff line number Diff line change
@@ -1,67 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!--
Available Targets:
<!--
Available Targets:

/t:Clean
Removes temporary build outputs.
/t:Clean
Removes temporary build outputs.

/t:Build
Builds assemblies.
/t:Build
Builds assemblies.

/t:Test
Runs tests
/t:Test
Runs tests

/t:Publish
Creates local nuget packages and MSI
/t:Publish
Creates local nuget packages and MSI

/p:CodeSign=True
Code sign binaries, mainly for official release. Default is false.
/p:CodeSign=True
Code sign binaries, mainly for official release. Default is false.

/p:CodeSign=True;DelaySign=True
Test the code sign workflow locally.
/p:CodeSign=True;DelaySign=True
Test the code sign workflow locally.

/p:Scope
'ServiceManagement': service management
'AzureStorage': storage data plane cmdlets
'Stack': Azure Stack cmdlets
'Subfolder under src\ResourceManager': An individual cmdlet module
By default, it builds everything
/p:Scope
'ServiceManagement': service management
'AzureStorage': storage data plane cmdlets
'Stack': Azure Stack cmdlets
'Subfolder under src\ResourceManager': An individual cmdlet module
By default, it builds everything

/p:SkipHelp=True
Skips help generation, mainly for local builds to save time.
/p:SkipHelp=True
Skips help generation, mainly for local builds to save time.

/p:SkipNugetRestore=True
Skips nuget restore, mainly for local builds to save time when you have already restored nugets.
/p:SkipNugetRestore=True
Skips nuget restore, mainly for local builds to save time when you have already restored nugets.

/p:SkipDependencyAnalysis=True
Skips build validation, mainly for local builds to save time.
/p:SkipDependencyAnalysis=True
Skips build validation, mainly for local builds to save time.

/p:QuickBuild=true
Same thing as doing SkipHelp, SkipNugetRestore, and SkipDependencyAnalysis
/p:QuickBuild=true
Same thing as doing SkipHelp, SkipNugetRestore, and SkipDependencyAnalysis
-->
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

-->
<Import Project="$(MSBuildThisFileDirectory)Repo.props" />

<!-- Define default build properties -->
<PropertyGroup>
<LibraryRoot>$(MSBuildThisFileDirectory)</LibraryRoot>
<LibrarySourceFolder>$(LibraryRoot)src</LibrarySourceFolder>
<LibraryToolsFolder>$(LibraryRoot)tools</LibraryToolsFolder>
<LocalFeedFolder>$(LibraryToolsFolder)\LocalFeed</LocalFeedFolder>
<PublishDirectory>$(LibrarySourceFolder)\Publish</PublishDirectory>
<Configuration Condition=" '$(Configuration)' != 'Release'">Debug</Configuration>
<CodeSign>false</CodeSign>
<!--Set this true only if you want to test the code sign workflow locally-->
<DelaySign Condition =" '$(DelaySign)' == '' ">false</DelaySign>
<SignedOutputRootDir>$(LibraryRoot)signed</SignedOutputRootDir>
<BuildOutputDirectory>$(PublishDirectory)\Build</BuildOutputDirectory>
<TestOutputDirectory>$(PublishDirectory)\TestResults</TestOutputDirectory>
<PackageDirectory>$(LibraryRoot)\artifacts</PackageDirectory>
<TestOutputDirectory>$(PackageDirectory)\Test</TestOutputDirectory>
<BuildInParallel Condition="'$(BuildInParallel)' == ''">true</BuildInParallel>
<NuGetPublishingSource Condition=" '$(NuGetPublishingSource)' == '' ">$(LibrarySourceFolder)</NuGetPublishingSource>
<Scope Condition="$(Scope) == ''" >All</Scope>
<BuildTasksPath>$(LibraryToolsFolder)\BuildPackagesTask\Microsoft.Azure.Build.Tasks\bin\$(Configuration)</BuildTasksPath>
<PackageDirectory>$(LibrarySourceFolder)\Package</PackageDirectory>
<StackPackageFolder>$(LibrarySourceFolder)\Stack</StackPackageFolder>
<NetCore Condition="'$(NetCore)' != 'true'">false</NetCore>
</PropertyGroup>
Expand Down Expand Up @@ -135,7 +133,7 @@
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;Remove-Item -Path (Join-Path ($env:USERPROFILE) .nuget packages) -Recurse -Force -Confirm:$false -ErrorAction Ignore&quot;" ContinueOnError="WarnAndContinue" IgnoreExitCode="true" />

<!-- Remove Package, Publish, bin, obj, and TestResults directories -->
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;Remove-Item -Path $(PackageDirectory),$(PublishDirectory) -Recurse -Force -Confirm:$false -ErrorAction Ignore&quot;" ContinueOnError="WarnAndContinue" IgnoreExitCode="true" />
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;Remove-Item -Path $(PackageDirectory) -Recurse -Force -Confirm:$false -ErrorAction Ignore&quot;" ContinueOnError="WarnAndContinue" IgnoreExitCode="true" />
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;Get-ChildItem -Path $(MSBuildThisFileDirectory) -Recurse -Include 'bin','obj','TestResults' | Remove-Item -Recurse -Force -Confirm:$false -ErrorAction Ignore&quot;" ContinueOnError="WarnAndContinue" IgnoreExitCode="true" />
</Target>

Expand Down Expand Up @@ -255,15 +253,6 @@
<Artifacts Include="@(GetAllFiles->'%(RootDir)%(Directory)'->Distinct())" />
</ItemGroup>
<RemoveDir Directories="%(Artifacts.Identity)" ContinueOnError="true" />

<ItemGroup>
<ExtraPsdFiles Include="$(PackageDirectory)\$(Configuration)\ResourceManager\AzureResourceManager\Az.Resources\Az.Tags.psd1" />
<ExtraPsdFiles Include="$(PackageDirectory)\$(Configuration)\ResourceManager\AzureResourceManager\Az.Websites\Az.Resources.psd1" />
<ExtraPsdFiles Include="$(PackageDirectory)\$(Configuration)\ResourceManager\AzureResourceManager\Az.Websites\Az.Tags.psd1" />
<ExtraPsdFiles Include="$(PackageDirectory)\$(Configuration)\ResourceManager\AzureResourceManager\Az.Network\Az.Resources.psd1" />
<ExtraPsdFiles Include="$(PackageDirectory)\$(Configuration)\ResourceManager\AzureResourceManager\Az.Network\Az.Tags.psd1" />
</ItemGroup>
<Delete Files="@(ExtraPsdFiles->'%(FullPath)')" />
<!-- TODO: </REMOVE THIS SECTION> -->


Expand Down Expand Up @@ -325,7 +314,7 @@
<SkipHelpValue Condition=" '$(SkipHelp)' == 'true' ">-s</SkipHelpValue>
</PropertyGroup>
<!-- TODO: Use '-m @(ModulesChanged)' in command when FilterBuild is fixed. -->
<!-- <Exec Command="dotnet $(MSBuildThisFileDirectory)src/Package/StaticAnalysis/StaticAnalysis.Netcore.dll -p $(MSBuildThisFileDirectory)src/Package/$(Configuration) -r $(MSBuildThisFileDirectory)src/Package/StaticAnalysis $(SkipHelpValue) -u" /> -->
<!-- <Exec Command="dotnet $(MSBuildThisFileDirectory)artifacts/StaticAnalysis/StaticAnalysis.Netcore.dll -p $(MSBuildThisFileDirectory)artifacts/$(Configuration) -r $(MSBuildThisFileDirectory)artifacts/StaticAnalysis $(SkipHelpValue) -u" /> -->

<OnError ExecuteTargets="StaticAnalysisErrorMessage" />
</Target>
Expand All @@ -344,7 +333,7 @@
<PropertyGroup>
<SkipHelpValue Condition=" '$(SkipHelp)' == 'true' ">-s</SkipHelpValue>
</PropertyGroup>
<Exec Command="dotnet $(MSBuildProjectDirectory)\src\Package\StaticAnalysis.Netcore.dll -p $(MSBuildProjectDirectory)\src\Package\$(Configuration) -r $(MSBuildProjectDirectory)\src\Package $(SkipHelpValue) -u -m @(ModulesChanged)" />
<Exec Command="dotnet $(MSBuildProjectDirectory)\artifacts\StaticAnalysis.Netcore.dll -p $(MSBuildProjectDirectory)\artifacts\$(Configuration) -r $(MSBuildProjectDirectory)\artifacts $(SkipHelpValue) -u -m @(ModulesChanged)" />

<OnError ExecuteTargets="StaticAnalysisErrorMessage"/>
</Target>
Expand Down Expand Up @@ -400,7 +389,7 @@
</Target>

<Target Name="TestFailureErrorMessage">
<Error Text="Test failures occured, check the files in src/Publish/TestResults." />
<Error Text="Test failures occured, check the files in artifacts/Test" />
</Target>

<Target Name="BinScopeCheck">
Expand All @@ -409,7 +398,7 @@
</Target>

<Target Name="BinScopeErrorMessage">
<Error Text="Binscope failed, please check the files in src/Package/BinScope" />
<Error Text="Binscope failed, please check the files in artifacts/BinScope" />
</Target>

<Target Name="RunPoliCheck">
Expand All @@ -418,7 +407,7 @@
</Target>

<Target Name="PoliCheckErrorMessage">
<Error Text="PoliCheck failed with a Severity 1 issue, please check the report at in src/Package/PoliCheck-Scan.html" />
<Error Text="PoliCheck failed with a Severity 1 issue, please check the report at in artifacts/PoliCheck-Scan.html" />
</Target>

</Project>
6 changes: 3 additions & 3 deletions documentation/Debugging-StaticAnalysis-Errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ Our StaticAnalysis tools help us ensure our modules follow PowerShell guidelines
## How to know if you have a StaticAnalysis Error
If your build is failing, click on the Jenkins job inside the PR (marked as "Default" within checks). Then check the Console Output within the Jenkins job. If you have this error, then you have failed StaticAnalysis:
```
d:\workspace\powershell\build.proj(511,5): error MSB3073: The command "d:\workspace\powershell\src\Package\StaticAnalysis.exe d:\workspace\powershell\src\Package\Debug d:\workspace\powershell\src\Package true false" exited with code 255.
d:\workspace\powershell\build.proj(511,5): error MSB3073: The command "d:\workspace\powershell\artifacts\StaticAnalysis.exe d:\workspace\powershell\artifacts\Debug d:\workspace\powershell\artifacts true false" exited with code 255.
```

## Where to find StaticAnalysis reports

The StaticAnalysis reports could show up in two different places in the CI build:
- On the status page in Jenkins, under the Build Artifacts: the relevant files are `BreakingChangeIssues.csv`, `SignatureIssues.csv`, and/or `HelpIssues.csv`.
- On the status page in Jenkins, click Build Artifacts then navigate to src/Package. You will see `BreakingChangeIssues.csv`, `SignatureIssues.csv`, and/or `HelpIssues.csv`.
- On the status page in Jenkins, click Build Artifacts then navigate to artifacts. You will see `BreakingChangeIssues.csv`, `SignatureIssues.csv`, and/or `HelpIssues.csv`.

Locally, the StaticAnalysis report will show up under Azure-PowerShell/src/Package. You will see `BreakingChangeIssues.csv`, `SignatureIssues.csv`, and/or `HelpIssues.csv`. You can generate these files by running
Locally, the StaticAnalysis report will show up under Azure-PowerShell/artifacts. You will see `BreakingChangeIssues.csv`, `SignatureIssues.csv`, and/or `HelpIssues.csv`. You can generate these files by running
```
msbuild build.proj
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ Now, you'll need to edit the solution file. Open the `<SERVICE>.sln` in your tex

After the solution file is updated, save and close it. Now, open the solution file in Visual Studio. Right click on the `Commands.<SERVICE>` project in the `Solution Explorer` and select `Unload project`. Right click on the unloaded project and select `Edit Commands.<SERVICE>.csproj`. Once opened, ensure that the following things are changed:
- The `AssemblyNamespace` and `RootNamespace` attributes of the project _must_ be changed to `Microsoft.Azure.PowerShell.Cmdlets.<SERVICE>`. If these changes are not made, then the assembly produced from this project is not be signed and results in errors when users try to use your module.
- Change the `OutputPath` attribute to `$(ProjectDir)..\..\..\Package\$(Configuration)\ResourceManager\AzureResourceManager\Az.<SERVICE>\`
- Change the particular `<ItemGroup>` containing `<None Include="Az.<SERVICE>.psd1">`

Right click on the project and select `Reload project`, and then build the solution by either right clicking on the solution and selecting `Rebuild Solution` or, from the top of Visual Studio, selecting `Build > Rebuild Solution`. If the build does not succeed, open the `.csproj` file and ensure there are no errors.
Expand Down Expand Up @@ -198,7 +197,7 @@ To import modules automatically when debug has started, follow the below steps:

- In the **Debug** tab mentioned previously, go to **Start Options**
- Import the Profile module, along with the module you are testing, by pasting the following in the **Command line arguments** box (_note_: you have to update the <PATH_TO_REPO> and <SERVICE> values provided below):
- `-NoExit -Command "Import-Module <PATH_TO_REPO>/src/Package/Debug/ResourceManager/AzureResourceManager/Az.Accounts/Az.Accounts.psd1;Import-Module <PATH_TO_REPO>/src/Package/Debug/ResourceManager/AzureResourceManager/Az.<SERVICE>/Az.<SERVICE>.psd1;$VerbosePreference='Continue'"`
- `-NoExit -Command "Import-Module <PATH_TO_REPO>/artifacts/Debug/Az.Accounts/Az.Accounts.psd1;Import-Module <PATH_TO_REPO>/artifacts/Debug/Az.<SERVICE>/Az.<SERVICE>.psd1;$VerbosePreference='Continue'"`
- **Note**: if you do not see all of the changes you made to the cmdlets when importing your module in a PowerShell session (_e.g.,_ a cmdlet you added is not recognized as a cmdlet), you may need to delete any existing Azure PowerShell modules that you have on your machine (installed through the PowerShell Gallery) before you import your module.

## Adding Help Content
Expand Down Expand Up @@ -307,7 +306,7 @@ $subcriptions = $job | Receive-Job

## Argument Completers

PowerShell uses Argument Completers to provide tab completion for users. At the moment, Azure PowerShell has two specific argument completers that should be applied to relevant parameters, and one generic argument completer that can be used to tab complete with a given list of values. To test the completers, run a complete build after you have added the completers (`msbuild build.proj`) and ensure that the psm1 file (`Az.<Service>.psm1`) has been added to the psd1 file found in `src/Package/Debug/ResourceManager/AzureResourceManager/AzureRM.<Service>/AzureRM.<Service>.psd1` under "Root Module".
PowerShell uses Argument Completers to provide tab completion for users. At the moment, Azure PowerShell has two specific argument completers that should be applied to relevant parameters, and one generic argument completer that can be used to tab complete with a given list of values. To test the completers, run a complete build after you have added the completers (`msbuild build.proj`) and ensure that the psm1 file (`Az.<Service>.psm1`) has been added to the psd1 file found in `artifacts/Debug/Az.<Service>/Az.<Service>.psd1` under "Root Module".

### Resource Group Completer

Expand Down
Loading