This repository has been archived by the owner on Apr 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
52 changed files
with
879 additions
and
498 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# These owners will be the default owners for everything in the repo and | ||
# will be requested for review when someone opens a pull request. | ||
* @pascalberger @christianbumann @x-jokay @silanosa @georgesgoetz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,102 @@ | ||
#!/usr/bin/env bash | ||
############################################################### | ||
# This is the Cake bootstrapper script that is responsible for | ||
# downloading Cake and all specified tools from NuGet. | ||
############################################################### | ||
########################################################################## | ||
# This is the Cake bootstrapper script for Linux and OS X. | ||
# This file was downloaded from https://github.com/cake-build/resources | ||
# Feel free to change this file to fit your needs. | ||
########################################################################## | ||
|
||
# Define directories. | ||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
TOOLS_DIR=$SCRIPT_DIR/tools | ||
NUGET_EXE=$TOOLS_DIR/nuget.exe | ||
CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe | ||
NUGET_URL=https://dist.nuget.org/win-x86-commandline/latest/nuget.exe | ||
CAKE_VERSION=0.32.1 | ||
CAKE_EXE=$TOOLS_DIR/Cake.$CAKE_VERSION/Cake.exe | ||
|
||
# Temporarily skip verification of addins. | ||
export CAKE_SETTINGS_SKIPVERIFICATION='true' | ||
|
||
# Define default arguments. | ||
SCRIPT="setup.cake" | ||
TARGET="Default" | ||
CONFIGURATION="Release" | ||
VERBOSITY="verbose" | ||
DRYRUN= | ||
SHOW_VERSION=false | ||
SCRIPT_ARGUMENTS=() | ||
|
||
# Parse arguments. | ||
for i in "$@"; do | ||
case $1 in | ||
-s|--script) SCRIPT="$2"; shift ;; | ||
-t|--target) TARGET="$2"; shift ;; | ||
-c|--configuration) CONFIGURATION="$2"; shift ;; | ||
-v|--verbosity) VERBOSITY="$2"; shift ;; | ||
-d|--dryrun) DRYRUN="-dryrun" ;; | ||
--version) SHOW_VERSION=true ;; | ||
--) shift; SCRIPT_ARGUMENTS+=("$@"); break ;; | ||
*) SCRIPT_ARGUMENTS+=("$1") ;; | ||
esac | ||
shift | ||
done | ||
|
||
# Make sure the tools folder exist. | ||
if [ ! -d $TOOLS_DIR ]; then | ||
mkdir $TOOLS_DIR | ||
if [ ! -d "$TOOLS_DIR" ]; then | ||
mkdir "$TOOLS_DIR" | ||
fi | ||
|
||
# Make sure that packages.config exist. | ||
if [ ! -f $TOOLS_DIR/packages.config ]; then | ||
echo "Downloading packages.config..." | ||
curl -Lsfo $TOOLS_DIR/packages.config http://cakebuild.net/bootstrapper/packages | ||
if [ $? -ne 0 ]; then | ||
echo "An error occured while downloading packages.config." | ||
exit 1 | ||
fi | ||
# Print Mono version. | ||
echo "Mono version:" | ||
mono --version | ||
echo "" | ||
|
||
########################################################################### | ||
# INSTALL .NET CORE CLI | ||
########################################################################### | ||
|
||
echo "Installing .NET CLI..." | ||
if [ ! -d "$SCRIPT_DIR/.dotnet" ]; then | ||
mkdir "$SCRIPT_DIR/.dotnet" | ||
fi | ||
curl -Lsfo "$SCRIPT_DIR/.dotnet/dotnet-install.sh" https://dot.net/v1/dotnet-install.sh | ||
sudo bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --version 2.1.400 --install-dir .dotnet --no-path | ||
export PATH="$SCRIPT_DIR/.dotnet":$PATH | ||
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 | ||
export DOTNET_CLI_TELEMETRY_OPTOUT=1 | ||
export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0 | ||
"$SCRIPT_DIR/.dotnet/dotnet" --info | ||
|
||
########################################################################### | ||
# INSTALL NUGET | ||
########################################################################### | ||
|
||
# Download NuGet if it does not exist. | ||
if [ ! -f $NUGET_EXE ]; then | ||
if [ ! -f "$NUGET_EXE" ]; then | ||
echo "Downloading NuGet..." | ||
curl -Lsfo $NUGET_EXE https://dist.nuget.org/win-x86-commandline/latest/nuget.exe | ||
curl -Lsfo "$NUGET_EXE" $NUGET_URL | ||
if [ $? -ne 0 ]; then | ||
echo "An error occured while downloading nuget.exe." | ||
echo "An error occurred while downloading nuget.exe." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Restore tools from NuGet. | ||
pushd $TOOLS_DIR >/dev/null | ||
mono $NUGET_EXE install -ExcludeVersion -PreRelease -Source https://www.myget.org/F/cake/api/v3/index.json | ||
if [ $? -ne 0 ]; then | ||
echo "Could not restore NuGet packages." | ||
exit 1 | ||
########################################################################### | ||
# INSTALL CAKE | ||
########################################################################### | ||
|
||
if [ ! -f "$CAKE_EXE" ]; then | ||
mono "$NUGET_EXE" install Cake -Version $CAKE_VERSION -OutputDirectory "$TOOLS_DIR" | ||
if [ $? -ne 0 ]; then | ||
echo "An error occurred while installing Cake." | ||
exit 1 | ||
fi | ||
fi | ||
popd >/dev/null | ||
|
||
# Make sure that Cake has been installed. | ||
if [ ! -f $CAKE_EXE ]; then | ||
if [ ! -f "$CAKE_EXE" ]; then | ||
echo "Could not find Cake.exe at '$CAKE_EXE'." | ||
exit 1 | ||
fi | ||
|
||
########################################################################### | ||
# RUN BUILD SCRIPT | ||
########################################################################### | ||
|
||
# Start Cake | ||
if $SHOW_VERSION; then | ||
exec mono $CAKE_EXE -version | ||
else | ||
exec mono $CAKE_EXE $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}" | ||
fi | ||
exec mono "$CAKE_EXE" recipe.cake --verbosity=$VERBOSITY --configuration=$CONFIGURATION --target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
--- | ||
Order: 30 | ||
Title: Using with Azure Pipelines | ||
Description: Example how to use the Cake.Issues.PullRequests.AzureDevOps addin from an Azure Pipelines build. | ||
--- | ||
This example shows how to write issues as comments to an Azure DevOps pull request from an Azure Pipelines build. | ||
|
||
To write issues as comments to Azure DevOps pull requests you need to import the core addin, | ||
the core pull request addin, the Azure DevOps support including the Cake.AzureDevOps addin, and one or more issue providers, | ||
in this example for JetBrains InspectCode: | ||
|
||
```csharp | ||
#addin "Cake.Issues" | ||
#addin "Cake.Issues.InspectCode" | ||
#addin "Cake.Issues.PullRequests" | ||
#addin "Cake.Issues.PullRequests.AzureDevOps" | ||
#addin "Cake.AzureDevOps" | ||
``` | ||
|
||
:::{.alert .alert-warning} | ||
Please note that you always should pin addins to a specific version to make sure your builds are deterministic and | ||
won't break due to updates to one of the addins. | ||
|
||
See [pinning addin versions](https://cakebuild.net/docs/tutorials/pinning-cake-version#pinning-addin-version) for details. | ||
::: | ||
|
||
In the following task we'll first determine if the build is running on Azure DevOps and for a pull request, | ||
then read the remote repository URL and pull request id from environment variables set by the Azure Pipelines build | ||
and finally call the [AzureDevOpsPullRequests] alias using the OAuth token provided by the Azure Pipeline build. | ||
|
||
:::{.alert .alert-info} | ||
Please note that you'll need to setup your Azure Pipelines build to allow scripts to | ||
access the OAuth token and need to setup proper permissions. | ||
|
||
See [OAuth authentication from Azure Pipelines] for details. | ||
::: | ||
|
||
```csharp | ||
Task("ReportIssuesToPullRequest").Does(() => | ||
{ | ||
var isRunningOnAzureDevOps = | ||
!string.IsNullOrWhiteSpace(context.EnvironmentVariable("TF_BUILD")) && | ||
!string.IsNullOrWhiteSpace(context.EnvironmentVariable("SYSTEM_COLLECTIONURI")) && | ||
( | ||
new Uri(context.EnvironmentVariable("SYSTEM_COLLECTIONURI")).Host == "dev.azure.com" || | ||
new Uri(context.EnvironmentVariable("SYSTEM_COLLECTIONURI")).Host.EndsWith("visualstudio.com") | ||
); | ||
|
||
var isPullRequestBuild = | ||
!string.IsNullOrWhiteSpace(context.EnvironmentVariable("SYSTEM_PULLREQUEST_PULLREQUESTID")); | ||
|
||
if (isRunningOnAzureDevOps) | ||
{ | ||
var repositoryUrl = new Uri(context.EnvironmentVariable("BUILD_REPOSITORY_URI")); | ||
|
||
if (isPullRequestBuild) | ||
{ | ||
var pullRequestIdVariable = context.EnvironmentVariable("SYSTEM_PULLREQUEST_PULLREQUESTID"); | ||
if (!Int32.TryParse(pullRequestIdVariable, out var pullRequestId)) | ||
{ | ||
throw new Exception($"Invalid pull request ID: {pullRequestIdVariable}"); | ||
} | ||
else | ||
{ | ||
var repoRootFolder = MakeAbsolute(Directory("./")); | ||
|
||
ReportIssuesToPullRequest( | ||
InspectCodeIssuesFromFilePath( | ||
@"C:\build\inspectcode.log"), | ||
AzureDevOpsPullRequests( | ||
repositoryUrl, | ||
pullRequestId, | ||
AzureDevOpsAuthenticationOAuth(EnvironmentVariable("SYSTEM_ACCESSTOKEN"))), | ||
repoRootFolder); | ||
} | ||
} | ||
} | ||
}); | ||
``` | ||
|
||
[AzureDevOpsPullRequests]: ../../../../api/Cake.Issues.PullRequests.AzureDevOps/AzureDevOpsPullRequestSystemAliases/64912B0A | ||
[Allow scripts to access the OAuth token]: https://docs.microsoft.com/en-us/azure/devops/pipelines/build/options#allow-scripts-to-access-the-oauth-token | ||
[OAuth authentication from Azure Pipelines]: ../setup#oauth-authentication-from-azure-pipelines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
Title: Examples | ||
Description: Examples for using the Cake.Issues.PullRequests.AzureDevOps addin. | ||
--- | ||
<p>@Html.Raw(Model.String(DocsKeys.Description))</p> | ||
|
||
<div class="alert alert-info"> | ||
There's a <a href="https://dev.azure.com/pberger/Cake.Issues-Demo" target="_blank">demo repository</a> | ||
available which you can fork and to which you can create pull requests to test the integration functionality. | ||
</div> | ||
|
||
@Html.Partial("_ChildPages") |
Oops, something went wrong.