Skip to content

Conversation

@martincostello
Copy link
Member

Switch to Arcade to build the project.

Addresses #321.

Switch to Arcade to build the project
Addresses aspnet-contrib#321.
@martincostello martincostello added this to the 3.0.0 milestone Aug 17, 2019
Fix Arcade error from non-compliant license text.
Update packages location.
Update version.
Disable PR publish.
Disabe test discovery.
@martincostello
Copy link
Member Author

Almost done.

The only thing missing is that the test results aren't reported in AppVeyor.

Any ideas @PinpointTownes? I can see them in openiddict-core. 🤔

@kevinchalet
Copy link
Member

Any ideas @PinpointTownes?

Honestly no. It's weird: they are correctly executed but not reported 😕

(note: you shouldn't merge it until we solve the versioning issue, otherwise it will be a PITA for nightly builds 😄)

@martincostello martincostello changed the title Use Arcade for build [WIP] Use Arcade for build Aug 17, 2019
@martincostello
Copy link
Member Author

Yeah, I'm just having a dig around in the code and docs now to see if I can work it out.

We might have to add some custom MSBuild overrides somewhere to take the AppVeyor properties and turn them into AzDO ones for Arcade to pick up.

@martincostello
Copy link
Member Author

So from looking at this:

https://github.com/dotnet/arcade/blob/331447d81b1968bed7161c4a6a8d70e4990327e1/src/Microsoft.DotNet.Arcade.Sdk/tools/Version.BeforeCommonTargets.targets#L18-L25

and the AppVeyor docs, I think we can "fix" it by adding this to Directory.Build.props:

<OfficialBuild Condition=" '$(APPVEYOR)' == 'True' AND '$(APPVEYOR_PULL_REQUEST_NUMBER)' == '' ">true</OfficialBuild>

@kevinchalet
Copy link
Member

kevinchalet commented Aug 17, 2019

We can, but it has a downside: in this case, it generates an official build number based on the current date with a fixed ".1" revision, so if we merge more than 1 commit a day, it will end up overwriting existing packages.

We could provide an OfficialBuildId, but the format doesn't allow revisions that have more than 2 digits. Since AppVeyor build numbers are not reset every day, it's super limiting 😢

@martincostello
Copy link
Member Author

Hmm. I'll have a further think about the revision part...

Move the eng folder in the solution to be under Solution Items.
Use the latest stable version of the test SDK.
Add assets to build and run tests in Visual Studio Code.
@martincostello
Copy link
Member Author

OK, I'm not proud of this, but it works*...

*as long as you don't publish to MyGet more than once per quarter of the hour.

If we have to rollover every 24 hours, and we can't have more than 2 digits, what about an auto-incrementing build number that's based on which quarter-hour of the day it is right now?

There's 24 hours in a day, so there's 96 quarter hours a day.

A build between 00:00:00 and 00:14:59 would be revision 1.
A build between 23:45:00 and 23:59:59 would be revision 97.

If I run this command on my laptop at 20:29, I get this:

.\build.cmd -pack /p:APPVEYOR=True

<...lots of build output...>

Successfully created package 'AspNet.Security.OAuth.MailRu.3.0.0-dev.19417.82.symbols.nupkg'.

Code to add to Directory.Build.props below:

<!--
  Arcade only allows the revision to contain up to two characters, and AppVeyor does not roll-over
  build numbers every day like Azure DevOps does. To balance these two requirements, set the official
  build ID to be the same format as the built-in default from Arcade, except with the revision number
  being the number of the quarter hour of the current time of day (24 * 4 = 96, which is less than 100).
  So a build between 00:00 and 00:14 would have a revision of 1, and a build between 23:45 and 23:59:59
  would have a revision of 97.
-->
<PropertyGroup Condition=" '$(APPVEYOR)' == 'True' AND '$(APPVEYOR_PULL_REQUEST_NUMBER)' == '' ">
  <_Hours>$([MSBuild]::Multiply($([System.DateTime]::Now.ToString(HH)), 4))</_Hours>
  <_QuarterHours>$([MSBuild]::Divide($([System.DateTime]::Now.ToString(mm)), 15))</_QuarterHours>
  <_QuarterHours>$([System.Math]::Floor($(_QuarterHours)))</_QuarterHours>
  <_AppVeyorBuildRevision>$([MSBuild]::Add($(_Hours), $(_QuarterHours)))</_AppVeyorBuildRevision>
  <_AppVeyorBuildRevision>$([MSBuild]::Add($(_AppVeyorBuildRevision), 1))</_AppVeyorBuildRevision>
  <OfficialBuild>true</OfficialBuild>
  <OfficialBuildId Condition=" '$(OfficialBuild)' == 'true' ">$([System.DateTime]::Now.ToString(yyyyMMdd)).$(_AppVeyorBuildRevision)</OfficialBuildId>
</PropertyGroup>

@kevinchalet
Copy link
Member

kevinchalet commented Aug 17, 2019

Clever (and certainly better than nothing 😅)

That said, I'll ping the Arcade folks to see what they think about that, just to make sure we're not missing something obvious.

@martincostello
Copy link
Member Author

Sure, this is definitely a hack!

Generate Arcade "official build Ids" in AppVeyor
Collect test results and upload to AppVeyor.
@martincostello
Copy link
Member Author

Thoughts on merging this as-is and opening a new PR if we find a better solution via dotnet/arcade#3706?

@martincostello martincostello changed the title [WIP] Use Arcade for build Use Arcade for build Sep 5, 2019
@martincostello
Copy link
Member Author

I'm going to merge this to the 3.0.0 branch with the current "1/4 hours in a day" versioning approach so I can make a start on the updates for preview 9 with minimal fuss.

@martincostello martincostello merged commit e7024c0 into aspnet-contrib:dev-3.0.0 Sep 5, 2019
@martincostello martincostello deleted the Build-With-Arcade branch September 5, 2019 13:10
martincostello added a commit that referenced this pull request Sep 23, 2019
* Update providers to ASP.NET Core 3.0

Update all providers to ASP.NET Core 3.0, using preview 6.

* Remove KoreBuild

Remove usage of KoreBuild as it is obsolete and no longer supports .NET Core 3.0 after preview 5.
Add code coverage to test project.

* Add shopify provider (#326)

* Add shopify provider

* Revert sln changes

* Apply code review

* Fix second core review

* Fix ChallentAsync param comment

* Fix scope summary

* Done pull request review #3

* Revert whitespace

* Update ShopifyLoopbackRedirectHandler.cs

* Update ShopifyAuthenticationExtensions.cs

* Update ShopifyAuthenticationHandler.cs

* Update ShopifyAuthenticationOptions.cs

* Update ShopifyTests.cs

* Update README.md

* Update README.md

* Update coverlet and ReportGenerator

Update to the latest releases of coverlet and ReportGenerator for code coverage metrics.

* Shopify - Fix TokenEndpoint format (#330)

Fix TokenEndpoint format

* Gitlab (#329)

* Added gitlab oauth

* Fixed some minor typos & restored wildcard include

* Applied suggested changes from code review

* Added missing version var to tests

* Added missing release build config

* Added Gitlab back to solution

* Fix VS auto resolving the references

* Revert weird bundle exclude

* Update GitLab for ASP.NET Core 3.0

Update the GitLab provider to support ASP.NET Core 3.0.

* Update to ASP.NET Core 3.0 preview 7

Update to preview 7 of ASP.NET Core 3.0.
Update NuGet packages to latest versions.
Fix code coverage output path.
Remove premature disposal in the Zalo provider.

* Use latest macOS image

Use the latest macOS image.

* Add UseAuthorization()

Add UseAuthorization() to the README for ASP.NET Core 3.0.

* Update to ASP.NET Core 3.0 preview 8

Update to preview 8 of ASP.NET Core 3.0.

* Update dependencies

Update NuGet packages to their latest versions.

* Use Arcade for build (#335)

* Use Arcade for build

Switch to Arcade to build the project
Addresses #321.

* Update LICENSE

Fix Arcade error from non-compliant license text.

* Add +x to scripts

* Update appveyor.yml

Update packages location.
Update version.
Disable PR publish.
Disabe test discovery.

* Move eng to solution items

Move the eng folder in the solution to be under Solution Items.

* Use newer test SDK

Use the latest stable version of the test SDK.

* Add files for Visual Studio Code

Add assets to build and run tests in Visual Studio Code.

* Generate AppVeyor build numbers

Generate Arcade "official build Ids" in AppVeyor

* Update appveyor.yml

Collect test results and upload to AppVeyor.

* Update to ASP.NET Core 3.0 preview 9

Update to preview 9 of ASP.NET Core 3.0.

* Remove PackageIconUrl

Use PackageIcon instead of PackageIconUrl as described by https://github.com/NuGet/Home/wiki/Packaging-Icon-within-the-nupkg as it is considered obsolete.

* Update .gitignore

Ignore .coverage files from Visual Studio code coverage.

* Merge from dev (#339)

* Add shopify provider (#326)

* Add shopify provider

* Revert sln changes

* Apply code review

* Fix second core review

* Fix ChallentAsync param comment

* Fix scope summary

* Done pull request review #3

* Revert whitespace

* Update ShopifyLoopbackRedirectHandler.cs

* Update ShopifyAuthenticationExtensions.cs

* Update ShopifyAuthenticationHandler.cs

* Update ShopifyAuthenticationOptions.cs

* Update ShopifyTests.cs

* Update README.md

* Update README.md

* Shopify - Fix TokenEndpoint format (#330)

Fix TokenEndpoint format

* Gitlab (#329)

* Added gitlab oauth

* Fixed some minor typos & restored wildcard include

* Applied suggested changes from code review

* Added missing version var to tests

* Added missing release build config

* Added Gitlab back to solution

* Fix VS auto resolving the references

* Revert weird bundle exclude

* incorrect LoginPath

In this startup file, it previously said "login", but in AuthenticationController the route is defined as "signin"

* Add MyGet publish step

Add step to publish packages to MyGet again.

* Change prerelease label

Change the prerelease label to preview 9.

* Fix assembly copyrights

Apply fix to assembly copyright as-per openiddict/openiddict-core#797.

* Update to ASP.NET Core 3.0 RC1

Update to release candidate 1 of ASP.NET Core 3.0.

* Add Sign in with Apple provider (#343)

* Add shopify provider (#326)

* Add shopify provider

* Revert sln changes

* Apply code review

* Fix second core review

* Fix ChallentAsync param comment

* Fix scope summary

* Done pull request review #3

* Revert whitespace

* Update ShopifyLoopbackRedirectHandler.cs

* Update ShopifyAuthenticationExtensions.cs

* Update ShopifyAuthenticationHandler.cs

* Update ShopifyAuthenticationOptions.cs

* Update ShopifyTests.cs

* Update README.md

* Update README.md

* Shopify - Fix TokenEndpoint format (#330)

Fix TokenEndpoint format

* Gitlab (#329)

* Added gitlab oauth

* Fixed some minor typos & restored wildcard include

* Applied suggested changes from code review

* Added missing version var to tests

* Added missing release build config

* Added Gitlab back to solution

* Fix VS auto resolving the references

* Revert weird bundle exclude

* incorrect LoginPath

In this startup file, it previously said "login", but in AuthenticationController the route is defined as "signin"

* Basic Apple provider

Add a very basic Sign In with Apple provider based on currently available information.

* Implement Apple provider

Fully implement the provider for Sign In with Apple based on current available functionality.

* Enable Sign In with Apple

Enable Sign In with Apple in the MVC sample app without hard-coding secrets.

* Update tests

Update the tests for the updated provider implementation.
Fix incorrect test method name.

* Enable token lifetime validation

Enable the validation of token lifetimes.

* Add null annotations

Add [NotNull] attributes to relevant methods.

* Improve exception handling

Pre-validate the ID token has a value.
Change catch clause to improve logging.

* Extend integration tests

Extend the integration tests for additional scenarios such as no validation, invalid tokens and using a configured client secret.

* Move expiry period to options

Move the configured lifetime for generated client secrets to the options class.

* Add ClientSecretExpiresAfter validation

Add validation for the value of ClientSecretExpiresAfter.

* Add tests for options validation

Add unit tests for options validation.
Improve exception type.
Fix incorrect if condition that meant not all values were validated correctly.

* Add unit tests for client secret

Add unit tests for the generated client secret's format.

* Make KeyId required

Make the KeyId option required if GenerateClientSecret is true.

* Fix test

Fix the expiry not being set.

* Fix Linux and macOS secret generation

Work around platform differences between Windows and Linux/macOS by supporting .p12/.pfx certificates for Linux/macOS and using p8 for Windows.
.NET Core 3.0 adds support for .p8 on both platforms.

* Add password option for pfx files

Add an option for specifying a password for PFX files.
Add a test private key that has a password for use on macOS.

* Fix flaky test

Fix flaky test by setting the expiry to 2 seconds to eliminate rounding issues.

* Add UsePrivateKey() method

Add UsePrivateKey() extension method that configures a private key file to use to auto-generate client secrets.

* Bump System.IdentityModel.Tokens.Jwt

Bump System.IdentityModel.Tokens.Jwt to 5.3.0 to ensure that incompatibility with .NET Standard 1.4 doesn't affect consumers.

* Set response_mode to form_post

React to changes Apple have made to the sign-in service, and use form_post as the response mode.
This requires reimplementing HandleRemoteAuthenticateAsync() by using either for Form or Query based on whether it is an HTTP POST.

* Use latest C# version

Fix the build by enabling the latest version of C#.

* Retrieve user details after sign-in

Get the user's name and email address, if available, as claims after signing in with an Apple ID. These details are only available the first time the user signs in; if they are not persisted they cannot currently be obtained again.

* Update branding

Use "Sign in with Apple" instead of "Sign In with Apple".

* Access events via options

Use the same approach as the other OAuth handlers and access the Events property via the Options property.

* Resolve logging TODO

Remove TODO comment.
Check whether Trace logging is enabled before logging the Apple token response.

* Comment out Apple option

Comment out the Apple provider as it causes the application to fail to start if the values aren't set and/or the key file does not exist.

* Update Sign in with Apple provider for ASP.NET Core 3.0

Update the Sign in with Apple provider to support ASP.NET Core 3.0.
Update the .NET Core test SDK version.
Fix-up Startup warnings.

* Add Nextcloud provider (#325)

* Add Nextcloud provider and unit test

* updated according to suggestions

* Change ClaimTypes.Name to Claims.Username

* Update Nextcloud for ASP.NET Core 3.0

Update the Nextcloud provider to support ASP.NET Core 3.0.

* Add missing usings

Add missing usings to request and response in GitLab handler.

* Use LangVersion latest

Stop using preview versions of C# now that C# 8 is the default for the .NET Core 3.0 SDK.

* Update to ASP.NET Core 3.0

Update to ASP.NET Core 3.0 final packages and SDK.

* Remove additional NuGet feeds

Remove extra NuGet feeds not needed now 3.0.0 packages are in NuGet.org.

* Add authorization

Add authorization middleware.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants