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

Provide support for Windows containers #857

Merged
merged 92 commits into from
Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
2943971
Rename Dockerfile
tomkerkhove Jan 28, 2020
5512f4c
Introduce Windows image
tomkerkhove Jan 28, 2020
10dd3dc
Change label of Windows stage
tomkerkhove Jan 28, 2020
2168c0a
Use correct Dockerfile
tomkerkhove Jan 28, 2020
c27295f
Use nanoserver 1903
tomkerkhove Jan 29, 2020
5398062
Let's see what happens if we don't specify OS
tomkerkhove Jan 29, 2020
fd7840b
Switch back to one Dockerfile
tomkerkhove Jan 29, 2020
378f72e
Code quality
tomkerkhove Jan 29, 2020
d8c2ef4
Fix volume?
tomkerkhove Jan 29, 2020
5b3bde3
Fix volume mount
tomkerkhove Jan 29, 2020
680fdba
Move to template
tomkerkhove Jan 29, 2020
9e6c995
Run Docker image
tomkerkhove Jan 29, 2020
44082c0
Merge branch 'master' into multi-platform-support
tomkerkhove Feb 2, 2020
ab51650
Update changelog
tomkerkhove Feb 2, 2020
3b2a0bf
Update FAQ
tomkerkhove Feb 2, 2020
bf30556
Update landing page
tomkerkhove Feb 2, 2020
f479067
Update runtime config
tomkerkhove Feb 2, 2020
ce9df74
Update deployment docs
tomkerkhove Feb 2, 2020
c3d6ae9
Further improve
tomkerkhove Feb 2, 2020
adb1aab
Remove template for now
tomkerkhove Feb 2, 2020
19296c1
Merge branch 'master' into multi-platform-support
tomkerkhove Feb 3, 2020
c5acbcc
Merge branch 'master' of https://github.com/tomkerkhove/promitor into…
tomkerkhove Feb 3, 2020
8d0b07c
Remove file names
tomkerkhove Feb 3, 2020
9f274a3
Merge branch 'multi-platform-support' of https://github.com/tomkerkho…
tomkerkhove Feb 3, 2020
cdcaed0
Remove file names
tomkerkhove Feb 3, 2020
e91f850
Improve tags
tomkerkhove Feb 3, 2020
44d7409
Download variable
tomkerkhove Feb 3, 2020
d810959
List folders before reading
tomkerkhove Feb 3, 2020
cd730b1
Let's see
tomkerkhove Feb 3, 2020
c1ae352
Update scraper-ci.yml for Azure Pipelines
tomkerkhove Feb 3, 2020
e66b60b
Fix formatting
tomkerkhove Feb 3, 2020
95715b8
Merge
tomkerkhove Feb 3, 2020
1d1b51e
Fix bad copy
tomkerkhove Feb 3, 2020
a7a7605
Fix path
tomkerkhove Feb 3, 2020
27cbd7b
Get-Content
tomkerkhove Feb 3, 2020
77dc8fe
Use powershell
tomkerkhove Feb 3, 2020
2bd7ad2
Cleanup
tomkerkhove Feb 3, 2020
542231d
Determine PR version old way
tomkerkhove Feb 3, 2020
81425f0
Fix default image name
tomkerkhove Feb 3, 2020
3f67cfc
Remove GitHub Package Registry for Windows
tomkerkhove Feb 3, 2020
abd2bb7
Last Windows push
tomkerkhove Feb 3, 2020
de0a5bb
Stamp folder for config based on OS in build
tomkerkhove Feb 5, 2020
9b38277
Read configuration folder from ENV
tomkerkhove Feb 5, 2020
08d88cc
Run Docker image with template (Windows)
tomkerkhove Feb 6, 2020
b4f0cb6
Run image via template only
tomkerkhove Feb 6, 2020
22e2668
Revert local commit
tomkerkhove Feb 6, 2020
3d1043a
Use build Docker image template
tomkerkhove Feb 6, 2020
8127037
Let's see if this is valid
tomkerkhove Feb 6, 2020
f4fb7d0
Remove -
tomkerkhove Feb 6, 2020
99ea689
Only build once
tomkerkhove Feb 6, 2020
2f186cc
Fix bad tag
tomkerkhove Feb 7, 2020
73cbb5c
Remove trailing spaces
tomkerkhove Feb 7, 2020
3938b2d
Use conditions
tomkerkhove Feb 7, 2020
d32ce49
Refactor all the pipelines
tomkerkhove Feb 7, 2020
61e5a06
Update tags
tomkerkhove Feb 8, 2020
01c7335
Provide test release build for Linux
tomkerkhove Feb 8, 2020
2d84292
Update agents-scraper-release-official-test.yml for Azure Pipelines
tomkerkhove Feb 8, 2020
3c94d9c
Add latest tag
tomkerkhove Feb 8, 2020
57e49ae
Merge branch 'multi-platform-support' of https://github.com/tomkerkho…
tomkerkhove Feb 8, 2020
06c2274
Change build job info for Linux
tomkerkhove Feb 8, 2020
b9a606b
Use YAML templates
tomkerkhove Feb 8, 2020
eaa16b2
Use OS name variable to avoid duplication
tomkerkhove Feb 8, 2020
0a2b835
Add Windows
tomkerkhove Feb 8, 2020
4c6f588
Use script for determining version
tomkerkhove Feb 8, 2020
291b582
Add Windows stage
tomkerkhove Feb 8, 2020
6138a81
Remove latest for windows
tomkerkhove Feb 8, 2020
47c5779
Only comment for linux builds
tomkerkhove Feb 8, 2020
7aaf4b3
Reduce tags for Windows to OS-specific only
tomkerkhove Feb 9, 2020
6b41c72
Remove test build
tomkerkhove Feb 9, 2020
9929bf8
Push PR image without OS
tomkerkhove Feb 9, 2020
9f6aef2
Don't comment for images with "-" in the tag
tomkerkhove Feb 9, 2020
aeb12b2
Let's test other steps first
tomkerkhove Feb 9, 2020
c1f6fa8
Does this work?
tomkerkhove Feb 9, 2020
5277b83
Update tagging strategy
tomkerkhove Feb 9, 2020
d513342
Let's see if casing is the issue
tomkerkhove Feb 9, 2020
c5ae998
Fix Markdown linting
tomkerkhove Feb 9, 2020
09bddaa
Cleanup, we're done!
tomkerkhove Feb 9, 2020
d737cb2
Emphasize multi-OS in image tagging strategy
tomkerkhove Feb 9, 2020
2848388
Merge branch 'master' into multi-platform-support
tomkerkhove Feb 12, 2020
1bab59b
Add commented section for Windows
tomkerkhove Feb 12, 2020
3257e1e
Use latest .NET SDK
tomkerkhove Feb 19, 2020
a7cfec9
Merge branch 'master' into multi-platform-support
tomkerkhove Feb 20, 2020
54ec857
Merge branch 'master' into multi-platform-support
tomkerkhove Mar 17, 2020
e69d1ef
Merge branch 'master' into multi-platform-support
tomkerkhove Mar 19, 2020
db8385a
Parameters
tomkerkhove Mar 20, 2020
2ad7b2c
Let's try default value
tomkerkhove Mar 20, 2020
a590aa2
Let's see if this works
tomkerkhove Mar 20, 2020
046bdf3
Fix bad template
tomkerkhove Mar 20, 2020
24d1dae
Fix checking parameters
tomkerkhove Mar 20, 2020
39243f4
Assign to same variable
tomkerkhove Mar 20, 2020
bd85341
Fix task display name
tomkerkhove Mar 20, 2020
85ee1f8
Simplify again
tomkerkhove Mar 20, 2020
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
2 changes: 1 addition & 1 deletion build/azure-devops/agents-scraper-release-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ stages:
- task: Docker@1
displayName: 'Build Docker image'
inputs:
dockerFile: ./src/Promitor.Scraper.Host/Dockerfile
dockerFile: ./src/Promitor.Scraper.Host/Dockerfile.linux
arguments: '-t $(Image.Name):$(Image.MajorMinorVersion)'
imageName: '$(Image.TaggedName)'
includeLatestTag: true
Expand Down
2 changes: 1 addition & 1 deletion build/azure-devops/agents-scraper-release-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ stages:
- task: Docker@1
displayName: 'Build Docker image'
inputs:
dockerFile: ./src/Promitor.Scraper.Host/Dockerfile
dockerFile: ./src/Promitor.Scraper.Host/Dockerfile.linux
imageName: '$(Image.TaggedName)'
includeLatestTag: true
useDefaultContext: false
Expand Down
90 changes: 86 additions & 4 deletions build/azure-devops/scraper-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ stages:
displayName: Docker Image
tomkerkhove marked this conversation as resolved.
Show resolved Hide resolved
dependsOn: []
jobs:
- job: DockerBuild
displayName: Build Docker Image Tests
- job: DockerBuildLinux
displayName: Build Docker Image (Linux)
condition: succeeded()
pool:
vmImage: ubuntu-16.04
Expand All @@ -136,7 +136,7 @@ stages:
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: 'Docker Hub'
dockerFile: ./src/Promitor.Scraper.Host/Dockerfile
dockerFile: ./src/Promitor.Scraper.Host/Dockerfile.linux
arguments: '--tag promitor-agent-scraper-ci --no-cache'
useDefaultContext: false
buildContext: ./src/
Expand All @@ -148,7 +148,89 @@ stages:
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: 'Docker Hub'
dockerFile: ./src/Promitor.Scraper.Host/Dockerfile
dockerFile: ./src/Promitor.Scraper.Host/Dockerfile.linux
arguments: '--tag promitor-agent-scraper-ci --tag docker.pkg.github.com/tomkerkhove/promitor/promitor-agent-scraper-pr:$(System.PullRequest.PullRequestNumber) --no-cache'
useDefaultContext: false
buildContext: ./src/
imageName: '$(Image.TaggedName)'
addDefaultLabels: false
condition: eq(variables['Build.Reason'], 'PullRequest')
- task: Docker@1
displayName: 'Run an image'
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: 'Docker Hub'
command: 'Run an image'
imageName: '$(Image.TaggedName)'
containerName: 'promitor-ci'
ports: '8999:80'
volumes: '/src/metric-config.yaml:/config/metrics-declaration.yaml promitor-agent-scraper-ci'
envVars: |
PROMITOR_AUTH_APPID='$(Container.Env.AzureMonitor.Id)'
PROMITOR_AUTH_APPKEY='$(Container.Env.AzureMonitor.Key)'
- task: Docker@1
displayName: 'Push ''$(Image.Name)'' image to Docker Hub'
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: 'Docker Hub'
command: 'Push an image'
imageName: '$(Image.TaggedName)'
condition: eq(variables['Build.Reason'], 'PullRequest')
- task: Docker@1
displayName: 'Push PR image to GitHub Package Registry'
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: 'GitHub Package Registry - Docker (tomkerkhove)'
command: 'Push an image'
imageName: 'docker.pkg.github.com/tomkerkhove/promitor/promitor-agent-scraper-pr:$(System.PullRequest.PullRequestNumber)'
condition: eq(variables['Build.Reason'], 'PullRequest')
- powershell: |
docker tag $(Image.TaggedName) docker.pkg.github.com/tomkerkhove/promitor/promitor-agent-scraper-ci:experimental
displayName: 'Tag image as experimental'
condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
- task: Docker@1
displayName: 'Push experimental image to GitHub Package Registry'
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: 'GitHub Package Registry - Docker (tomkerkhove)'
command: 'Push an image'
imageName: 'docker.pkg.github.com/tomkerkhove/promitor/promitor-agent-scraper-ci:experimental'
condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))

- job: DockerBuildLinux
displayName: Build Docker Image (Linux)
condition: succeeded()
pool:
vmImage: windows-2019
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: Docker@1
displayName: 'Build an image'
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: 'Docker Hub'
dockerFile: ./src/Promitor.Scraper.Host/Dockerfile.linux
arguments: '--tag promitor-agent-scraper-ci --no-cache'
useDefaultContext: false
buildContext: ./src/
imageName: '$(Image.TaggedName)'
addDefaultLabels: false
condition: not(eq(variables['Build.Reason'], 'PullRequest'))
- task: Docker@1
displayName: 'Build an image'
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: 'Docker Hub'
dockerFile: ./src/Promitor.Scraper.Host/Dockerfile.linux
arguments: '--tag promitor-agent-scraper-ci --tag docker.pkg.github.com/tomkerkhove/promitor/promitor-agent-scraper-pr:$(System.PullRequest.PullRequestNumber) --no-cache'
useDefaultContext: false
buildContext: ./src/
Expand Down
2 changes: 1 addition & 1 deletion development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,5 @@ by accident.
To build the Docker image, run the following command from the `/src` directory:

```shell
docker build . --file .\Promitor.Scraper.Host\Dockerfile --tag promitor --no-cache
docker build . --file .\Promitor.Scraper.Host\Dockerfile.linux --tag promitor --no-cache
```
17 changes: 17 additions & 0 deletions src/Promitor.Scraper.Host/Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM mcr.microsoft.com/dotnet/core/sdk:3.1.101-nanoserver-1909 AS build
WORKDIR /src
COPY Promitor.Core/* Promitor.Core/
COPY Promitor.Core.Configuration/* Promitor.Core.Configuration/
COPY Promitor.Core.Scraping/* Promitor.Core.Scraping/
COPY Promitor.Core.Telemetry/* Promitor.Core.Telemetry/
COPY Promitor.Core.Telemetry.Metrics/* Promitor.Core.Telemetry.Metrics/
COPY Promitor.Integrations.AzureMonitor/* Promitor.Integrations.AzureMonitor/
COPY Promitor.Integrations.AzureStorage/* Promitor.Integrations.AzureStorage/
COPY Promitor.Scraper.Host/* Promitor.Scraper.Host/
RUN dotnet publish Promitor.Scraper.Host/Promitor.Scraper.Host.csproj --configuration release --output app

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.1-nanoserver-1909 as runtime
WORKDIR /app
COPY --from=build /src/app .

ENTRYPOINT ["dotnet", "Promitor.Scraper.Host.dll"]
2 changes: 1 addition & 1 deletion src/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
image: tomkerkhove/promitor-agent-scraper
build:
context: .
dockerfile: Promitor.Scraper.Host/Dockerfile
dockerfile: Promitor.Scraper.Host/Dockerfile.linux
volumes:
- "./metric-config.yaml:/config/metrics-declaration.yaml"
- "./runtime-config.yaml:/config/runtime.yaml"