-
Notifications
You must be signed in to change notification settings - Fork 115
Windows build optimization #582
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
83f5ce0
opt
rashmichandrashekar 7f2401f
doc update
rashmichandrashekar 6e3b5aa
changes
rashmichandrashekar 2ee3da1
change
rashmichandrashekar 14819ca
Merge branch 'ci_dev' into rashmi/windows-build-opt
rashmichandrashekar e864d22
update doc
rashmichandrashekar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,43 @@ | ||
| FROM mcr.microsoft.com/windows/servercore:ltsc2019 | ||
| MAINTAINER OMSContainers@microsoft.com | ||
| LABEL vendor=Microsoft\ Corp \ | ||
| com.microsoft.product="Azure Monitor for containers" | ||
|
|
||
| # Do not split this into multiple RUN! | ||
| # Docker creates a layer for every RUN-Statement | ||
| RUN powershell -Command "Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" | ||
| # Fluentd depends on cool.io whose fat gem is only available for Ruby < 2.5, so need to specify --platform ruby when install Ruby > 2.5 and install msys2 to get dev tools | ||
| RUN choco install -y ruby --version 2.6.5.1 --params "'/InstallDir:C:\ruby26'" \ | ||
| && choco install -y msys2 --version 20200903.0.0 --params "'/NoPath /NoUpdate /InstallDir:C:\ruby26\msys64'" \ | ||
| && choco install -y vim | ||
|
|
||
| # gangams - optional MSYS2 update via ridk failing in merged docker file so skipping that since we dont need optional update | ||
| RUN refreshenv \ | ||
| && ridk install 3 \ | ||
| && echo gem: --no-document >> C:\ProgramData\gemrc \ | ||
| && gem install cool.io -v 1.5.4 --platform ruby \ | ||
| && gem install oj -v 3.3.10 \ | ||
| && gem install json -v 2.2.0 \ | ||
| && gem install fluentd -v 1.12.2 \ | ||
| && gem install win32-service -v 1.0.1 \ | ||
| && gem install win32-ipc -v 0.7.0 \ | ||
| && gem install win32-event -v 0.6.3 \ | ||
| && gem install windows-pr -v 1.2.6 \ | ||
| && gem install tomlrb -v 1.3.0 \ | ||
| && gem install gyoku -v 1.3.1 \ | ||
| && gem sources --clear-all | ||
|
|
||
| # Remove gem cache and chocolatey | ||
| RUN powershell -Command "Remove-Item -Force C:\ruby26\lib\ruby\gems\2.6.0\cache\*.gem; Remove-Item -Recurse -Force 'C:\ProgramData\chocolatey'" | ||
|
|
||
| SHELL ["powershell"] | ||
|
|
||
| ENV tmpdir /opt/omsagentwindows/scripts/powershell | ||
|
|
||
| WORKDIR /opt/omsagentwindows/scripts/powershell | ||
|
|
||
| # copy certificate generator binaries zip | ||
| COPY ./omsagentwindows/*.zip /opt/omsagentwindows/ | ||
|
|
||
| COPY setup.ps1 /opt/omsagentwindows/scripts/powershell | ||
| RUN ./setup.ps1 | ||
This file contains hidden or 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,45 @@ | ||
| FROM omsagent-win-base | ||
| MAINTAINER OMSContainers@microsoft.com | ||
| LABEL vendor=Microsoft\ Corp \ | ||
| com.microsoft.product="Azure Monitor for containers" | ||
|
|
||
| #Uncomment below to test setup.ps1 changes | ||
| #COPY setup.ps1 /opt/omsagentwindows/scripts/powershell | ||
| #RUN ./setup.ps1 | ||
| COPY main.ps1 /opt/omsagentwindows/scripts/powershell | ||
| COPY ./omsagentwindows/installer/scripts/filesystemwatcher.ps1 /opt/omsagentwindows/scripts/powershell | ||
| COPY ./omsagentwindows/installer/scripts/livenessprobe.cmd /opt/omsagentwindows/scripts/cmd/ | ||
| COPY setdefaulttelegrafenvvariables.ps1 /opt/omsagentwindows/scripts/powershell | ||
|
|
||
| # copy ruby scripts to /opt folder | ||
| COPY ./omsagentwindows/installer/scripts/*.rb /opt/omsagentwindows/scripts/ruby/ | ||
|
|
||
| # copy out_oms.so file | ||
| COPY ./omsagentwindows/out_oms.so /opt/omsagentwindows/out_oms.so | ||
|
|
||
| # copy fluent, fluent-bit and out_oms conf files | ||
| COPY ./omsagentwindows/installer/conf/fluent.conf /etc/fluent/ | ||
| # copy fluent docker and cri parser conf files | ||
| COPY ./omsagentwindows/installer/conf/fluent-cri-parser.conf /etc/fluent/ | ||
| COPY ./omsagentwindows/installer/conf/fluent-docker-parser.conf /etc/fluent/ | ||
| COPY ./omsagentwindows/installer/conf/fluent-bit.conf /etc/fluent-bit | ||
| COPY ./omsagentwindows/installer/conf/out_oms.conf /etc/omsagentwindows | ||
|
|
||
| # copy telegraf conf file | ||
| COPY ./omsagentwindows/installer/conf/telegraf.conf /etc/telegraf/ | ||
|
|
||
| # copy keepcert alive ruby scripts | ||
| COPY ./omsagentwindows/installer/scripts/rubyKeepCertificateAlive/*.rb /etc/fluent/plugin/ | ||
|
|
||
| #Copy fluentd ruby plugins | ||
| COPY ./omsagentwindows/ruby/ /etc/fluent/plugin/ | ||
| COPY ./omsagentwindows/utils/*.rb /etc/fluent/plugin/ | ||
|
|
||
| ENV AGENT_VERSION ${IMAGE_TAG} | ||
| ENV OS_TYPE "windows" | ||
| ENV APPLICATIONINSIGHTS_AUTH "NzAwZGM5OGYtYTdhZC00NThkLWI5NWMtMjA3ZjM3NmM3YmRi" | ||
| ENV AZMON_COLLECT_ENV False | ||
| ENV CI_CERT_LOCATION "C://oms.crt" | ||
| ENV CI_KEY_LOCATION "C://oms.key" | ||
|
|
||
| ENTRYPOINT ["powershell", "C:\\opt\\omsagentwindows\\scripts\\powershell\\main.ps1"] |
64 changes: 64 additions & 0 deletions
64
kubernetes/windows/dockerbuild/build-and-publish-dev-docker-image.ps1
This file contains hidden or 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,64 @@ | ||
| <# | ||
| .DESCRIPTION | ||
| Builds the Windows Agent code and Docker Image and pushes the docker image to specified repo | ||
|
|
||
| .PARAMETER image | ||
| docker image. format should be <repo>/<image-name>:<tag> | ||
| #> | ||
| param( | ||
| [Parameter(mandatory = $true)] | ||
| [string]$image | ||
| ) | ||
|
|
||
| $currentdir = $PSScriptRoot | ||
| Write-Host("current script dir : " + $currentdir + " ") | ||
|
|
||
| if ($false -eq (Test-Path -Path $currentdir)) { | ||
| Write-Host("Invalid current dir : " + $currentdir + " ") -ForegroundColor Red | ||
| exit | ||
| } | ||
|
|
||
| if ([string]::IsNullOrEmpty($image)) { | ||
| Write-Host "Image parameter shouldnt be null or empty" -ForegroundColor Red | ||
| exit | ||
| } | ||
|
|
||
| $imageparts = $image.split(":") | ||
| if (($imageparts.Length -ne 2)){ | ||
| Write-Host "Image not in valid format. Expected format should be <repo>/<image>:<imagetag>" -ForegroundColor Red | ||
| exit | ||
| } | ||
|
|
||
| $imagetag = $imageparts[1].ToLower() | ||
| $imagerepo = $imageparts[0] | ||
|
|
||
| if ($imagetag.StartsWith("win-") -eq $false) | ||
| { | ||
| Write-Host "adding win- prefix image tag since its not provided" | ||
| $imagetag = "win-$imagetag" | ||
| } | ||
|
|
||
| Write-Host "image tag used is :$imagetag" | ||
|
|
||
| Write-Host "start:Building the cert generator and out oms code via Makefile.ps1" | ||
| ..\..\..\build\windows\Makefile.ps1 | ||
| Write-Host "end:Building the cert generator and out oms code via Makefile.ps1" | ||
|
|
||
| $dockerFileDir = Split-Path -Path $currentdir | ||
| Write-Host("builddir dir : " + $dockerFileDir + " ") | ||
| if ($false -eq (Test-Path -Path $dockerFileDir)) { | ||
| Write-Host("Invalid dockerFile Dir : " + $dockerFileDir + " ") -ForegroundColor Red | ||
| exit | ||
| } | ||
|
|
||
| Write-Host "changing directory to DockerFile dir: $dockerFileDir" | ||
| Set-Location -Path $dockerFileDir | ||
|
|
||
| $updateImage = ${imagerepo} + ":" + ${imageTag} | ||
| Write-Host "STAT:Triggering docker image build: $image" | ||
| docker build -t $updateImage --build-arg IMAGE_TAG=$imageTag -f Dockerfile-dev-image . | ||
| Write-Host "END:Triggering docker image build: $updateImage" | ||
|
|
||
| Write-Host "STAT:pushing docker image : $updateImage" | ||
| docker push $updateImage | ||
| Write-Host "EnD:pushing docker image : $updateImage" |
This file contains hidden or 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,32 @@ | ||
| <# | ||
| .DESCRIPTION | ||
| Builds the Docker Image locally for the server core ltsc base and installs dependencies | ||
|
|
||
| #> | ||
|
|
||
| $currentdir = $PSScriptRoot | ||
| Write-Host("current script dir : " + $currentdir + " ") | ||
|
|
||
| if ($false -eq (Test-Path -Path $currentdir)) { | ||
| Write-Host("Invalid current dir : " + $currentdir + " ") -ForegroundColor Red | ||
| exit | ||
| } | ||
|
|
||
| Write-Host "start:Building the cert generator and out oms code via Makefile.ps1" | ||
| ..\..\..\build\windows\Makefile.ps1 | ||
| Write-Host "end:Building the cert generator and out oms code via Makefile.ps1" | ||
|
|
||
| $dockerFileDir = Split-Path -Path $currentdir | ||
| Write-Host("builddir dir : " + $dockerFileDir + " ") | ||
| if ($false -eq (Test-Path -Path $dockerFileDir)) { | ||
| Write-Host("Invalid dockerFile Dir : " + $dockerFileDir + " ") -ForegroundColor Red | ||
| exit | ||
| } | ||
|
|
||
| Write-Host "changing directory to DockerFile dir: $dockerFileDir" | ||
| Set-Location -Path $dockerFileDir | ||
|
|
||
| $updateImage = "omsagent-win-base" | ||
| Write-Host "STAT:Triggering base docker image build: $updateImage" | ||
| docker build -t $updateImage -f Dockerfile-dev-base-image . | ||
| Write-Host "END:Triggering docker image build: $updateImage" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.