-
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Azure DevOps builds to /build/azure-devops (#630)
* Move Azure DevOps builds to /build/azure-devops Signed-off-by: Tom Kerkhove <[email protected]> * Don't delete old ones yet Signed-off-by: Tom Kerkhove <[email protected]> * Code styling fix
- Loading branch information
1 parent
8101a38
commit 41c6c60
Showing
5 changed files
with
504 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
name: $(Image.Version) | ||
resources: | ||
- repo: self | ||
trigger: none | ||
pr: none | ||
variables: | ||
DotNet.SDK.Version: '2.2.301' | ||
Image.Name: 'tomkerkhove/promitor-agent-scraper' | ||
Image.TaggedName: '$(Image.Name):$(Image.Version)' | ||
Release.TagName: '$(Build.BuildNumber)' | ||
Helm.App.Version: '$(Image.Version)' | ||
# Release.Title is configured in the build definition as settable at queue time | ||
# Image.Version is configured in the build definition as settable at queue time | ||
# Helm.Chart.Version is configured in the build definition as settable at queue time | ||
stages: | ||
- stage: Build | ||
displayName: Build and Push Docker image | ||
jobs: | ||
- job: Build | ||
pool: | ||
vmImage: ubuntu-16.04 | ||
steps: | ||
- task: DotNetCoreInstaller@0 | ||
displayName: 'Install .NET SDK' | ||
inputs: | ||
version: '$(DotNet.SDK.Version)' | ||
- powershell: | | ||
Write-Host "Determining '{major}.{minor}' for '$(Image.Version)'" | ||
$index = "$(Image.Version)".IndexOf(".", 2); | ||
$majorMinorVersion = "$(Image.Version)".Substring(0, $index); | ||
Write-Host "Found version '$majorMinorVersion'" | ||
Write-Output ("##vso[task.setvariable variable=Image.MajorMinorVersion;]$majorMinorVersion") | ||
displayName: 'Determine ''{major}.{minor}'' version' | ||
- task: DotNetCoreCLI@2 | ||
displayName: 'Run Unit Tests' | ||
inputs: | ||
command: test | ||
projects: src/Promitor.Scraper.Tests.Unit/Promitor.Scraper.Tests.Unit.csproj | ||
- task: Docker@1 | ||
displayName: 'Build Docker image' | ||
inputs: | ||
dockerFile: ./src/Promitor.Scraper.Host/Dockerfile | ||
arguments: '-t $(Image.Name):$(Image.MajorMinorVersion)' | ||
imageName: '$(Image.TaggedName)' | ||
includeLatestTag: true | ||
useDefaultContext: false | ||
buildContext: ./src/ | ||
- task: Docker@1 | ||
displayName: 'Push ''{major}.{minor}.{patch}'' to Docker Hub' | ||
inputs: | ||
containerregistrytype: 'Container Registry' | ||
dockerRegistryEndpoint: 'Docker Hub' | ||
command: 'Push an image' | ||
imageName: '$(Image.TaggedName)' | ||
- task: Docker@1 | ||
displayName: 'Push ''{major}.{minor}'' to Docker Hub' | ||
inputs: | ||
containerregistrytype: 'Container Registry' | ||
dockerRegistryEndpoint: 'Docker Hub' | ||
command: 'Push an image' | ||
imageName: '$(Image.Name):$(Image.MajorMinorVersion)' | ||
- task: Docker@1 | ||
displayName: 'Push ''latest'' to Docker Hub' | ||
inputs: | ||
containerregistrytype: 'Container Registry' | ||
dockerRegistryEndpoint: 'Docker Hub' | ||
command: 'Push an image' | ||
imageName: '$(Image.Name):latest' | ||
- stage: ReleaseGitHub | ||
displayName: Release on GitHub | ||
dependsOn: Build | ||
jobs: | ||
- job: CreateRelease | ||
displayName: Create Release | ||
pool: | ||
vmImage: ubuntu-16.04 | ||
steps: | ||
- task: GitHubRelease@0 | ||
displayName: 'Create GitHub Release' | ||
inputs: | ||
gitHubConnection: 'Tom Kerkhove (GitHub - OAuth)' | ||
repositoryName: tomkerkhove/promitor | ||
action: Create | ||
tagSource: manual | ||
tag: '$(Release.TagName)' | ||
title: '$(Release.Title)' | ||
releaseNotesSource: input | ||
isDraft: true | ||
releaseNotes: | | ||
### Breaking Changes | ||
Here are a list of breaking changes and how to mitigate them: | ||
- TBW (#) - _Use new approach documented here_ | ||
### Getting started | ||
Running Promitor Scraper is super easy: | ||
``` | ||
docker run -d -p 8999:80 --name promitor-agent-scraper | ||
--env PROMITOR_AUTH_APPID='<azure-ad-app-id>' \ | ||
--env-file C:/Promitor/az-mon-auth.creds \ | ||
--volume C:/Promitor/metrics-declaration.yaml:/config/metrics-declaration.yaml \ | ||
tomkerkhove/promitor-agent-scraper:$(Image.Version) | ||
``` | ||
### Docker Image information | ||
New Docker image tags are available: | ||
- `latest` | ||
- `$(Image.Version)` | ||
- `$(Image.MajorMinorVersion)` | ||
Docker image is available on [Docker Hub](https://hub.docker.com/r/tomkerkhove/promitor-agent-scraper/).<br /> | ||
For more information about our tagging strategy, feel free to read our [documentation](https://promitor.io/deployment/#image-tagging-strategy). | ||
- stage: ReleaseHelm | ||
displayName: Release Helm Chart | ||
dependsOn: Build | ||
jobs: | ||
- job: PushHelmChart | ||
displayName: Push Helm Chart to ACR | ||
pool: | ||
vmImage: ubuntu-16.04 | ||
steps: | ||
- task: HelmInstaller@0 | ||
inputs: | ||
helmVersion: '2.9.1' | ||
- powershell: | | ||
mkdir output/ | ||
helm package promitor-agent-scraper/ --app-version $(Helm.App.Version) --version $(Helm.Chart.Version) --destination output/ | ||
workingDirectory: charts | ||
displayName: 'Package Helm Chart' | ||
- task: AzureCLI@1 | ||
displayName: 'Push Helm Chart to Azure Container Registry' | ||
inputs: | ||
azureSubscription: 'Visual Studio Enterprise (0f9d7fea-99e8-4768-8672-06a28514f77e)' | ||
scriptLocation: inlineScript | ||
inlineScript: | | ||
az configure --defaults acr=promitor | ||
az acr helm push --name promitor charts/output/promitor-agent-scraper-$(Helm.Chart.Version).tgz --force |
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 @@ | ||
name: $(Image.Version) | ||
resources: | ||
- repo: self | ||
trigger: none | ||
pr: none | ||
variables: | ||
DotNet.SDK.Version: '2.2.301' | ||
Image.Name: 'tomkerkhove/promitor-agent-scraper' | ||
Image.TaggedName: '$(Image.Name):$(Image.Version)' | ||
Release.TagName: '$(Build.BuildNumber)' | ||
# Release.Title is configured in the build definition as settable at queue time | ||
# Image.Version is configured in the build definition as settable at queue time | ||
stages: | ||
- stage: Build | ||
displayName: Build and Push Docker image | ||
jobs: | ||
- job: Build | ||
pool: | ||
vmImage: ubuntu-16.04 | ||
steps: | ||
- task: DotNetCoreInstaller@0 | ||
displayName: 'Install .NET SDK' | ||
inputs: | ||
version: '$(DotNet.SDK.Version)' | ||
- task: DotNetCoreCLI@2 | ||
displayName: 'Run Unit Tests' | ||
inputs: | ||
command: test | ||
projects: src/Promitor.Scraper.Tests.Unit/Promitor.Scraper.Tests.Unit.csproj | ||
- task: Docker@1 | ||
displayName: 'Build Docker image' | ||
inputs: | ||
dockerFile: ./src/Promitor.Scraper.Host/Dockerfile | ||
imageName: '$(Image.TaggedName)' | ||
includeLatestTag: true | ||
useDefaultContext: false | ||
buildContext: ./src/ | ||
- task: Docker@1 | ||
displayName: 'Push preview to Docker Hub' | ||
inputs: | ||
containerregistrytype: 'Container Registry' | ||
dockerRegistryEndpoint: 'Docker Hub' | ||
command: 'Push an image' | ||
imageName: '$(Image.TaggedName)' | ||
- stage: ReleaseGitHub | ||
displayName: Release on GitHub | ||
dependsOn: Build | ||
jobs: | ||
- job: CreateRelease | ||
displayName: Create Preview Release | ||
pool: | ||
vmImage: ubuntu-16.04 | ||
steps: | ||
- task: GitHubRelease@0 | ||
displayName: 'Create GitHub Release' | ||
inputs: | ||
gitHubConnection: 'Tom Kerkhove (GitHub - OAuth)' | ||
repositoryName: tomkerkhove/promitor | ||
action: Create | ||
tagSource: manual | ||
tag: '$(Release.TagName)' | ||
title: '$(Release.Title)' | ||
releaseNotesSource: input | ||
isDraft: true | ||
isPreRelease: true | ||
releaseNotes: | | ||
### Breaking Changes | ||
Here are a list of breaking changes and how to mitigate them: | ||
- TBW (#) - _Use new approach documented here_ | ||
### Getting started | ||
Running Promitor Scraper Agent is super easy: | ||
``` | ||
docker run -d -p 8999:80 --name promitor-agent-scraper | ||
--env PROMITOR_AUTH_APPID='<azure-ad-app-id>' \ | ||
--env-file C:/Promitor/az-mon-auth.creds \ | ||
--volume C:/Promitor/metrics-declaration.yaml:/config/metrics-declaration.yaml \ | ||
tomkerkhove/promitor-agent-scraper:$(Image.Version) | ||
``` | ||
### Docker Image information | ||
New Docker image tag is available: `$(Image.Version)` on [Docker Hub](https://hub.docker.com/r/tomkerkhove/promitor-agent-scraper).<br/> | ||
For more information about our tagging strategy, feel free to read our [documentation](https://promitor.io/deployment/#image-tagging-strategy). | ||
## Features | ||
- TBW (#) |
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,38 @@ | ||
name: $(Date:yyyyMMdd)$(Rev:.r) | ||
trigger: none | ||
pr: | ||
branches: | ||
include: | ||
- master | ||
paths: | ||
include: | ||
- deploy/automation/docker-hub/ci/* | ||
- .azure-devops/docker-hub-bot-for-prs-ci.yml | ||
stages: | ||
- stage: Build | ||
displayName: Verify Tooling | ||
jobs: | ||
- job: Tooling | ||
displayName: Verify ARM Template | ||
pool: | ||
vmImage: ubuntu-16.04 | ||
steps: | ||
- powershell: | | ||
$prNumber = '$(System.PullRequest.PullRequestNumber)' | ||
$buildNumber = '$(Build.BuildNumber)' | ||
Write-Host "Initial build number: '$buildNumber'" | ||
Write-Host "PR Number '$prNumber'" | ||
$buildNumber = 'PR$(System.PullRequest.PullRequestNumber)' | ||
Write-Host "##vso[build.updatebuildnumber]$buildNumber" | ||
Write-Host "Build number is '$buildNumber'" | ||
displayName: 'Change Build Number to PR format' | ||
condition: eq(variables['Build.Reason'], 'PullRequest') | ||
- task: AzureResourceGroupDeployment@2 | ||
displayName: 'Validate Docker Hub Bot ARM Template' | ||
inputs: | ||
azureSubscription: 'Visual Studio Enterprise (0f9d7fea-99e8-4768-8672-06a28514f77e)' | ||
resourceGroupName: 'promitor' | ||
location: 'West Europe' | ||
csmFile: 'deploy/automation/docker-hub/ci/azuredeploy.json' | ||
csmParametersFile: 'deploy/automation/docker-hub/ci/azuredeploy.parameters.json' | ||
deploymentMode: Validation |
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,40 @@ | ||
name: $(Date:yyyyMMdd)$(Rev:.r) | ||
resources: | ||
- repo: self | ||
trigger: | ||
batch: true | ||
branches: | ||
include: | ||
- master | ||
paths: | ||
include: | ||
- deploy/automation/docker-hub/ci/* | ||
pr: none | ||
variables: | ||
LogicApp.Name: 'promitor-automation-github-ci-scraper' | ||
GitHub.Repo.Owner: 'tomkerkhove' | ||
GitHub.Repo.Name: 'promitor' | ||
GitHub.Bot.Name: 'promitor-bot' | ||
stages: | ||
- stage: Deploy | ||
jobs: | ||
- job: DeployToAzure | ||
displayName: Deploy to Azure (ARM) | ||
pool: | ||
vmImage: ubuntu-16.04 | ||
steps: | ||
- task: qetza.replacetokens.replacetokens-task.replacetokens@3 | ||
displayName: 'Replace tokens in tooling' | ||
inputs: | ||
rootDirectory: 'deploy/automation/docker-hub/ci/' | ||
targetFiles: azuredeploy.parameters.json | ||
verbosity: detailed | ||
actionOnMissing: fail | ||
- task: AzureResourceGroupDeployment@2 | ||
displayName: 'Deploy CI bot for Docker Hub updates' | ||
inputs: | ||
azureSubscription: 'Visual Studio Enterprise (0f9d7fea-99e8-4768-8672-06a28514f77e)' | ||
resourceGroupName: promitor | ||
location: 'West Europe' | ||
csmFile: 'deploy/automation/docker-hub/ci/azuredeploy.json' | ||
csmParametersFile: 'deploy/automation/docker-hub/ci/azuredeploy.parameters.json' |
Oops, something went wrong.