Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
d398b08
build multi-arch images
Jan 27, 2022
3f147aa
add test pipeline yaml
Jan 28, 2022
dd18771
use 1es pool
Jan 28, 2022
57c2d67
try to build
Jan 28, 2022
afd8a3e
test push
Jan 31, 2022
696a25e
login to acr
Jan 31, 2022
a5f3d8d
add script type
Jan 31, 2022
e637545
try pushing to ame acr
Feb 1, 2022
4008694
fix variables
Feb 1, 2022
368bcb2
fix tag
Feb 1, 2022
c1e40f9
fix tag 2
Feb 1, 2022
9973279
change pipelines
Feb 1, 2022
27e7340
remove extra file
Feb 1, 2022
1c91492
missing changes
Feb 1, 2022
c79382a
save metadata
Feb 1, 2022
565b00b
update pipelines
Feb 2, 2022
8384005
revert official mdsd arm64 build
Feb 3, 2022
4f22ef6
add build_arg image_tag
Feb 3, 2022
b6d3a8b
use new arm64 version
Feb 11, 2022
2200280
update arm build
Feb 14, 2022
eb31afd
update amd build
Feb 15, 2022
e823679
update arm build
Feb 22, 2022
fb05171
use new amd64 master build for mdsd
Feb 23, 2022
2d5bf72
update golang to 1.15 in dockerfile
Feb 23, 2022
a06ec6c
use releases url
Feb 28, 2022
f0a6564
build multi-arch images
Jan 27, 2022
808ea62
add test pipeline yaml
Jan 28, 2022
ef5c766
use 1es pool
Jan 28, 2022
087f738
try to build
Jan 28, 2022
6966482
test push
Jan 31, 2022
2fe0998
login to acr
Jan 31, 2022
129ac87
add script type
Jan 31, 2022
50687a9
try pushing to ame acr
Feb 1, 2022
e54222d
fix variables
Feb 1, 2022
1ceddab
fix tag
Feb 1, 2022
e9269c4
fix tag 2
Feb 1, 2022
4598d87
change pipelines
Feb 1, 2022
26128fa
remove extra file
Feb 1, 2022
a0e8fa9
missing changes
Feb 1, 2022
a741a46
save metadata
Feb 1, 2022
d35d5c4
update pipelines
Feb 2, 2022
27000a6
revert official mdsd arm64 build
Feb 3, 2022
43fb6a5
add build_arg image_tag
Feb 3, 2022
b3aee21
use new arm64 version
Feb 11, 2022
ffee912
update arm build
Feb 14, 2022
8bf832a
update amd build
Feb 15, 2022
4449bda
update arm build
Feb 22, 2022
4c0bd4c
use new amd64 master build for mdsd
Feb 23, 2022
21604ad
update golang to 1.15 in dockerfile
Feb 23, 2022
748dcf7
use releases url
Feb 28, 2022
614d90c
build multi-arch images
Jan 27, 2022
a1d870a
add test pipeline yaml
Jan 28, 2022
6429422
use 1es pool
Jan 28, 2022
a3c758e
try to build
Jan 28, 2022
3a9c1b3
test push
Jan 31, 2022
9c115c0
login to acr
Jan 31, 2022
73692e3
add script type
Jan 31, 2022
4d35ddb
try pushing to ame acr
Feb 1, 2022
28517c0
fix variables
Feb 1, 2022
4d4d3c1
fix tag
Feb 1, 2022
abfee42
fix tag 2
Feb 1, 2022
98abd5d
change pipelines
Feb 1, 2022
606523e
remove extra file
Feb 1, 2022
3747974
missing changes
Feb 1, 2022
ab986f1
save metadata
Feb 1, 2022
e866fdc
update pipelines
Feb 2, 2022
6378122
revert official mdsd arm64 build
Feb 3, 2022
880becb
add build_arg image_tag
Feb 3, 2022
3d64a2b
use new arm64 version
Feb 11, 2022
82d7e52
update arm build
Feb 14, 2022
c585b60
update amd build
Feb 15, 2022
433be78
update arm build
Feb 22, 2022
0e635ac
use new amd64 master build for mdsd
Feb 23, 2022
39abea7
update golang to 1.15 in dockerfile
Feb 23, 2022
ce9d404
use releases url
Feb 28, 2022
2c29e1c
files for ev2 release
Mar 1, 2022
5bad5d8
change copy file paths
Mar 1, 2022
e78f71b
change prod repo name
Mar 1, 2022
4d28ee2
capture artifacts.tar.gz
Mar 1, 2022
804e651
avoid unnecessary alerts while testing
Mar 1, 2022
bffc30d
update tag
Mar 9, 2022
2c6053f
use mdsd arm64 master build
Mar 11, 2022
c469eba
Merge branch 'user/amagraw/test-arm64' of github.com:microsoft/Docker…
Mar 11, 2022
61869b6
Merge branch 'user/amagraw/test-arm64-release' into user/amagraw/test…
Mar 11, 2022
f12ffe0
address PR comments
Mar 11, 2022
96a6386
copy additional files
Mar 12, 2022
5d3f7a2
remove sources folder
Mar 12, 2022
6e7cfd4
update globs
Mar 12, 2022
97a4661
use multiple copy tasks
Mar 12, 2022
cb8445f
fix typo
Mar 12, 2022
e8bd368
Merge branch 'ci_dev' into user/amagraw/test-arm64
Mar 14, 2022
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
100 changes: 100 additions & 0 deletions .pipelines/azure_pipeline_dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger:
- ci_dev

pool:
name: Azure-Pipelines-CI-Test-EO

variables:
armServiceConnectionName: 'ci-1es-acr-connection'
subscription: '9b96ebbd-c57a-42d1-bbe9-b69296e4c7fb'
containerRegistry: 'containerinsightsprod'
repoImageName: '${{ variables.containerRegistry }}.azurecr.io/public/azuremonitor/containerinsights/cidev'

steps:
- bash: |
commit=$(git rev-parse --short HEAD)
echo "##vso[task.setvariable variable=commit;]$commit"

datetime=$(date +'%Y%m%d%s')
echo "##vso[task.setvariable variable=datetime;]$datetime"

cd deployment/multiarch-agent-deployment/ServiceGroupRoot/Scripts
tar -czvf ../artifacts.tar.gz pushAgentToAcr.sh

- task: CopyFiles@2
displayName: "Copy ev2 deployment artifacts"
inputs:
SourceFolder: "$(Build.SourcesDirectory)/deployment"
Contents: |
**/*
TargetFolder: '$(Build.ArtifactStagingDirectory)/build'

- task: CopyFiles@2
displayName: "Copy ev2 deployment scripts"
inputs:
SourceFolder: "$(Build.SourcesDirectory)/.pipelines"
Contents: |
*.sh
TargetFolder: '$(Build.ArtifactStagingDirectory)/build'

- task: CopyFiles@2
displayName: "Copy ev2 deployment scripts"
inputs:
SourceFolder: "$(Build.SourcesDirectory)/kubernetes"
Contents: |
*.yaml
TargetFolder: '$(Build.ArtifactStagingDirectory)/build'

- task: CopyFiles@2
displayName: "Copy ev2 deployment scripts"
inputs:
SourceFolder: "$(Build.SourcesDirectory)/charts"
Contents: |
**/*
TargetFolder: '$(Build.ArtifactStagingDirectory)/build'

- task: CopyFiles@2
displayName: "Copy ev2 deployment scripts"
inputs:
SourceFolder: "$(Build.SourcesDirectory)/test/e2e"
Contents: |
*.yaml
TargetFolder: '$(Build.ArtifactStagingDirectory)/build'

- task: AzureCLI@2
inputs:
azureSubscription: ${{ variables.armServiceConnectionName }}
scriptType: bash
scriptLocation: inlineScript
inlineScript: |

sudo apt-get update && sudo apt-get -y install qemu binfmt-support qemu-user-static
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

docker buildx create --name testbuilder
docker buildx use testbuilder

az --version
az account show
az account set -s ${{ variables.subscription }}
az acr login -n ${{ variables.containerRegistry }}

docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --metadata-file $(Build.ArtifactStagingDirectory)/metadata.json --build-arg IMAGE_TAG=$(datetime)-$(commit) --push .

docker pull ${{ variables.repoImageName }}:$(datetime)-$(commit)

- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'Generation Task'
inputs:
BuildDropPath: '$(Build.ArtifactStagingDirectory)'
DockerImagesToScan: 'golang:1.14, ubuntu:18.04, ${{ variables.repoImageName }}:$(datetime)-$(commit)'

- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop
100 changes: 100 additions & 0 deletions .pipelines/azure_pipeline_prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger:
- ci_prod

pool:
name: Azure-Pipelines-CI-Prod-EO

variables:
armServiceConnectionName: 'ci-1es-acr-connection-prod'
subscription: '30c56c3a-54da-46ea-b004-06eb33432687'
containerRegistry: 'containerinsightsbuild'
repoImageName: '${{ variables.containerRegistry }}.azurecr.io/official/linux'

steps:
- bash: |
commit=$(git rev-parse --short HEAD)
echo "##vso[task.setvariable variable=commit;]$commit"

datetime=$(date +'%Y%m%d%s')
echo "##vso[task.setvariable variable=datetime;]$datetime"

cd deployment/multiarch-agent-deployment/ServiceGroupRoot/Scripts
tar -czvf ../artifacts.tar.gz pushAgentToAcr.sh

- task: CopyFiles@2
displayName: "Copy ev2 deployment artifacts"
inputs:
SourceFolder: "$(Build.SourcesDirectory)/deployment"
Contents: |
**/*
TargetFolder: '$(Build.ArtifactStagingDirectory)/build'

- task: CopyFiles@2
displayName: "Copy ev2 deployment scripts"
inputs:
SourceFolder: "$(Build.SourcesDirectory)/.pipelines"
Contents: |
**/*.sh
TargetFolder: '$(Build.ArtifactStagingDirectory)/build'

- task: CopyFiles@2
displayName: "Copy ev2 deployment scripts"
inputs:
SourceFolder: "$(Build.SourcesDirectory)/kubernetes"
Contents: |
*.yaml
TargetFolder: '$(Build.ArtifactStagingDirectory)/build'

- task: CopyFiles@2
displayName: "Copy ev2 deployment scripts"
inputs:
SourceFolder: "$(Build.SourcesDirectory)/charts"
Contents: |
**/*
TargetFolder: '$(Build.ArtifactStagingDirectory)/build'

- task: CopyFiles@2
displayName: "Copy ev2 deployment scripts"
inputs:
SourceFolder: "$(Build.SourcesDirectory)/test/e2e"
Contents: |
*.yaml
TargetFolder: '$(Build.ArtifactStagingDirectory)/build'

- task: AzureCLI@2
inputs:
azureSubscription: ${{ variables.armServiceConnectionName }}
scriptType: bash
scriptLocation: inlineScript
inlineScript: |

sudo apt-get update && sudo apt-get -y install qemu binfmt-support qemu-user-static
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

docker buildx create --name testbuilder
docker buildx use testbuilder

az --version
az account show
az account set -s ${{ variables.subscription }}
az acr login -n ${{ variables.containerRegistry }}

docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:ciprod-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --metadata-file $(Build.ArtifactStagingDirectory)/metadata.json --build-arg IMAGE_TAG=ciprod-$(datetime)-$(commit) --push .

docker pull ${{ variables.repoImageName }}:ciprod-$(datetime)-$(commit)

- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'Generation Task'
inputs:
BuildDropPath: '$(Build.ArtifactStagingDirectory)'
DockerImagesToScan: 'golang:1.14, ubuntu:18.04, ${{ variables.repoImageName }}:ciprod-$(datetime)-$(commit)'

- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,25 @@ bash build-and-publish-docker-image.sh --image <repo>/<imagename>:<imagetag>
```
> Note: format of the imagetag will be `ci<release><MMDDYYYY>`. possible values for release are test, dev, preview, dogfood, prod etc.

You can also build and push images for multiple architectures. This is powered by docker buildx
```
cd ~/Docker-Provider/kubernetes/linux/dockerbuild
sudo docker login # if you want to publish the image to acr then login to acr via `docker login <acr-name>`
# build and publish using docker buildx
bash build-and-publish-docker-image.sh --image <repo>/<imagename>:<imagetag> --multiarch
```

or directly use the docker buildx commands
```
# multiple platforms
cd ~/Docker-Provider
docker buildx build --platform linux/arm64/v8,linux/amd64 -t <repo>/<imagename>:<imagetag> --build-arg IMAGE_TAG=<imagetag> -f kubernetes/linux/Dockerfile.multiarch --push .

# single platform
cd ~/Docker-Provider
docker buildx build --platform linux/amd64 -t <repo>/<imagename>:<imagetag> --build-arg IMAGE_TAG=<imagetag> -f kubernetes/linux/Dockerfile.multiarch --push .
```

If you prefer to build docker provider shell bundle and image separately, then you can follow below instructions

##### Build Docker Provider shell bundle
Expand Down
24 changes: 10 additions & 14 deletions build/linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ BUILD_TYPE=Release
PF=Linux
PF_MAJOR=1
PF_MINOR=0
PF_ARCH=x64
PF_WIDTH=64
PF_DISTRO=ULINUX
BUILD_CONFIGURATION=Linux_ULINUX_1.0_x64_64_Release

ifeq ($(arch),)
PF_ARCH=amd64
else
PF_ARCH=$(arch)
endif

BUILD_CONFIGURATION=Linux_ULINUX_1.0_$(PF_ARCH)_64_Release

# RM - Remove a file
# RMDIR - Remove a directory
Expand Down Expand Up @@ -90,16 +96,7 @@ endif

STAGING_DIR := $(INTERMEDIATE_DIR)/staging

# For consistency, the architecture should be i686 (for x86) and x86_64 (for x64)
DOCKER_ARCH := $(shell echo $(PF_ARCH) | sed -e 's/x86$$/i686/' -e 's/x64$$/x86_64/')
OUTPUT_PACKAGE_PREFIX=docker-cimprov-$(CONTAINER_BUILDVERSION_MAJOR).$(CONTAINER_BUILDVERSION_MINOR).$(CONTAINER_BUILDVERSION_PATCH)-$(CONTAINER_BUILDVERSION_BUILDNR).universal.$(DOCKER_ARCH)


ifeq ("$(wildcard /usr/bin/dpkg-deb)","")
DPKG_LOCATION="--DPKG_LOCATION=$(BASE_DIR)/build/linux/installer/InstallBuilder/tools/bin/dpkg-deb-$(PF_ARCH)"
else
DPKG_LOCATION=
endif
OUTPUT_PACKAGE_PREFIX=docker-cimprov-$(CONTAINER_BUILDVERSION_MAJOR).$(CONTAINER_BUILDVERSION_MINOR).$(CONTAINER_BUILDVERSION_PATCH)-$(CONTAINER_BUILDVERSION_BUILDNR).universal.$(PF_ARCH)


#--------------------------------------------------------------------------------
Expand Down Expand Up @@ -130,7 +127,7 @@ KIT_STATUS:
fluentbitplugin :
@echo "========================= Building fluentbit out_oms go plugin for logs"
$(MKPATH) $(INTERMEDIATE_DIR)
make -C $(GO_SOURCE_DIR) fbplugin
make -C $(GO_SOURCE_DIR) fbplugin arch=$(PF_ARCH)
$(COPY) $(GO_SOURCE_DIR)/out_oms.so $(INTERMEDIATE_DIR)

rubypluginstests :
Expand Down Expand Up @@ -192,7 +189,6 @@ kit : fluentbitplugin
--VERSION=$(CONTAINER_BUILDVERSION_MAJOR).$(CONTAINER_BUILDVERSION_MINOR).$(CONTAINER_BUILDVERSION_PATCH) \
--RELEASE=$(CONTAINER_BUILDVERSION_BUILDNR) \
--CONTAINER_BUILD_LIBRARY=$(CONTAINERLIB_FILENAME) \
$(DPKG_LOCATION) \
--OUTPUTFILE=$(OUTPUT_PACKAGE_PREFIX) \
--DATAFILE_PATH=$(BASE_DIR)/build/linux/installer/datafiles \
base_container.data linux.data linux_dpkg.data
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"$schema": "http://schema.express.azure.com/schemas/2015-01-01-alpha/RolloutParameters.json",
"contentVersion": "1.0.0.0",
"wait": [
{
"name": "waitSdpBakeTime",
"properties": {
"duration": "PT24H"
}
}
],
"shellExtensions": [
{
"name": "PushAgentToACR",
"type": "ShellExtensionType",
"properties": {
"maxexecutiontime": "PT1H"
},
"package": {
"reference": {
"path": "artifacts.tar.gz"
}
},
"launch": {
"command": [
"/bin/bash",
"pushAgentToAcr.sh"
],
"environmentVariables": [
{
"name": "ACR_NAME",
"value": "__ACR_NAME__"
},
{
"name": "AGENT_RELEASE",
"value": "__AGENT_RELEASE__"
},
{
"name": "AGENT_IMAGE_TAG_SUFFIX",
"value": "__AGENT_IMAGE_TAG_SUFFIX__"
},
{
"name": "AGENT_IMAGE_FULL_PATH",
"value": "public/azuremonitor/containerinsights/__AGENT_RELEASE__:__AGENT_RELEASE____AGENT_IMAGE_TAG_SUFFIX__"
},
{
"name": "CDPX_REGISTRY",
"value": "__CDPX_LINUX_REGISTRY__"
},
{
"name": "CDPX_REPO_NAME",
"value": "__CDPX_LINUX_REPO_NAME__"
},
{
"name": "CDPX_TAG",
"value": "__CDPX_LINUX_TAG__"
}
],
"identity": {
"type": "userAssigned",
"userAssignedIdentities": [
"__MANAGED_IDENTITY__"
]
}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://ev2schema.azure.net/schemas/2020-01-01/rolloutSpecification.json",
"ContentVersion": "1.0.0.0",
"RolloutMetadata": {
"ServiceModelPath": "ServiceModels//Public.ServiceModel.json",
"ScopeBindingsPath": "ScopeBindings//Public.ScopeBindings.json",
"Name": "ContainerInsightsAgent",
"RolloutType": "Major",
"BuildSource": {
"Parameters": {
"VersionFile": "buildver.txt"
}
},
"Notification": {
"Email": {
"To": "omscontainers@microsoft.com"
}
}
},
"OrchestratedSteps": [
{
"name": "PushLinuxAgent",
"targetType": "ServiceResource",
"targetName": "PushLinuxAgent",
"actions": [ "Shell/PushAgentToACR" ],
"dependsOn": [ ]
}
]
}
Loading