From d398b088bf3f8fbbb5abbadfa031e6d28bc04b3e Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Thu, 27 Jan 2022 15:39:27 +0000 Subject: [PATCH 01/88] build multi-arch images --- README.md | 19 +++++++++ build/linux/Makefile | 24 +++++------- kubernetes/linux/Dockerfile | 2 +- kubernetes/linux/Dockerfile.multiarch | 39 +++++++++++++++++++ .../build-and-publish-docker-image.sh | 16 +++++++- kubernetes/linux/main.sh | 20 +++++----- kubernetes/linux/setup.sh | 28 ++++++++----- .../linux/install-build-pre-requisites.sh | 19 +++++++++ source/plugins/go/src/Makefile | 12 +++++- 9 files changed, 143 insertions(+), 36 deletions(-) create mode 100644 kubernetes/linux/Dockerfile.multiarch diff --git a/README.md b/README.md index 7d42c75d6..f0fa40e53 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,25 @@ bash build-and-publish-docker-image.sh --image /: ``` > Note: format of the imagetag will be `ci`. 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 ` +# build and publish using docker buildx +bash build-and-publish-docker-image.sh --image /: --multiarch +``` + +or directly use the docker buildx commands +``` +# multiple platforms +cd ~/Docker-Provider +docker buildx build --platform linux/arm64/v8,linux/amd64 -t /: --build-arg IMAGE_TAG= -f kubernetes/linux/Dockerfile.multiarch --push . + +# single platform +cd ~/Docker-Provider +docker buildx build --platform linux/amd64 -t /: --build-arg IMAGE_TAG= -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 diff --git a/build/linux/Makefile b/build/linux/Makefile index 3f35e1204..9203f1d73 100644 --- a/build/linux/Makefile +++ b/build/linux/Makefile @@ -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 @@ -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) #-------------------------------------------------------------------------------- @@ -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 : @@ -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 diff --git a/kubernetes/linux/Dockerfile b/kubernetes/linux/Dockerfile index f3a9efd7a..b32538799 100644 --- a/kubernetes/linux/Dockerfile +++ b/kubernetes/linux/Dockerfile @@ -23,7 +23,7 @@ ENV AGENT_VERSION ${IMAGE_TAG} WORKDIR ${tmpdir} # copy docker provider shell bundle to use the agent image -COPY ./Linux_ULINUX_1.0_x64_64_Release/docker-cimprov-*.*.*-*.x86_64.sh . +COPY ./Linux_ULINUX_1.0_*_64_Release/docker-cimprov-*.*.*-*.*.*.sh . # Note: If you prefer remote destination, uncomment below line and comment above line # wget https://github.com/microsoft/Docker-Provider/releases/download/10.0.0-1/docker-cimprov-10.0.0-1.universal.x86_64.sh diff --git a/kubernetes/linux/Dockerfile.multiarch b/kubernetes/linux/Dockerfile.multiarch new file mode 100644 index 000000000..9dfeacc4d --- /dev/null +++ b/kubernetes/linux/Dockerfile.multiarch @@ -0,0 +1,39 @@ +FROM --platform=$BUILDPLATFORM golang:1.14 AS builder +ARG TARGETOS TARGETARCH +RUN /usr/bin/apt-get update && /usr/bin/apt-get install git g++ make pkg-config libssl-dev libpam0g-dev rpm librpm-dev uuid-dev libkrb5-dev python sudo gcc-aarch64-linux-gnu -y + +COPY build /src/build +COPY source /src/source +RUN cd /src/build/linux && make arch=${TARGETARCH} + + +FROM ubuntu:18.04 AS base_image +ARG TARGETOS TARGETARCH +MAINTAINER OMSContainers@microsoft.com +LABEL vendor=Microsoft\ Corp \ + com.microsoft.product="Azure Monitor for containers" +ENV tmpdir /opt +ENV APPLICATIONINSIGHTS_AUTH NzAwZGM5OGYtYTdhZC00NThkLWI5NWMtMjA3ZjM3NmM3YmRi +ENV MALLOC_ARENA_MAX 2 +ENV HOST_MOUNT_PREFIX /hostfs +ENV HOST_PROC /hostfs/proc +ENV HOST_SYS /hostfs/sys +ENV HOST_ETC /hostfs/etc +ENV HOST_VAR /hostfs/var +ENV AZMON_COLLECT_ENV False +ENV KUBE_CLIENT_BACKOFF_BASE 1 +ENV KUBE_CLIENT_BACKOFF_DURATION 0 +ENV RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR 0.9 +RUN /usr/bin/apt-get update && /usr/bin/apt-get install -y libc-bin wget openssl curl sudo python python-ctypes init-system-helpers net-tools rsyslog cron vim dmidecode apt-transport-https gnupg make && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /src/kubernetes/linux/Linux_ULINUX_1.0_*_64_Release/docker-cimprov-*.*.*-*.*.sh $tmpdir/ +COPY kubernetes/linux/setup.sh kubernetes/linux/main.sh kubernetes/linux/defaultpromenvvariables kubernetes/linux/defaultpromenvvariables-rs kubernetes/linux/defaultpromenvvariables-sidecar kubernetes/linux/mdsd.xml kubernetes/linux/envmdsd kubernetes/linux/logrotate.conf $tmpdir/ + +ARG IMAGE_TAG=ciprod10132021 +ENV AGENT_VERSION ${IMAGE_TAG} + +WORKDIR ${tmpdir} + +RUN chmod 775 $tmpdir/*.sh; sync; $tmpdir/setup.sh ${TARGETARCH} +CMD [ "/opt/main.sh" ] + diff --git a/kubernetes/linux/dockerbuild/build-and-publish-docker-image.sh b/kubernetes/linux/dockerbuild/build-and-publish-docker-image.sh index 267f15f32..580b158c9 100755 --- a/kubernetes/linux/dockerbuild/build-and-publish-docker-image.sh +++ b/kubernetes/linux/dockerbuild/build-and-publish-docker-image.sh @@ -14,6 +14,7 @@ usage() echo echo "Build and publish docker image:" echo "$basename --image " + echo "$basename --image --multiarch" } parse_args() @@ -30,6 +31,7 @@ for arg in "$@"; do shift case "$arg" in "--image") set -- "$@" "-i" ;; + "--multiarch") set -- "$@" "-m" ;; "--"*) usage ;; *) set -- "$@" "$arg" esac @@ -37,7 +39,7 @@ done local OPTIND opt -while getopts 'hi:' opt; do +while getopts 'hi:m' opt; do case "$opt" in h) usage @@ -48,6 +50,11 @@ while getopts 'hi:' opt; do echo "image is $OPTARG" ;; + m) + multi=1 + echo "using multiarch dockerfile" + ;; + ?) usage exit 1 @@ -131,6 +138,13 @@ echo "source code base directory: $baseDir" echo "build directory for docker provider: $buildDir" echo "docker file directory: $dockerFileDir" +if [ "$multi" -eq "1" ]; then + echo "building multiarch" + cd $baseDir + docker buildx build --platform linux/arm64/v8,linux/amd64 -t $image --build-arg IMAGE_TAG=$imageTag -f $linuxDir/Dockerfile.multiarch --push . + exit 0 +fi + # build docker provider shell bundle build_docker_provider diff --git a/kubernetes/linux/main.sh b/kubernetes/linux/main.sh index 980c15586..b905311aa 100644 --- a/kubernetes/linux/main.sh +++ b/kubernetes/linux/main.sh @@ -311,7 +311,7 @@ source ~/.bashrc if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ]; then #Parse the configmap to set the right environment variables. - /usr/bin/ruby2.6 tomlparser.rb + /usr/bin/ruby2.7 tomlparser.rb cat config_env_var | while read line; do echo $line >> ~/.bashrc @@ -322,7 +322,7 @@ fi #Parse the configmap to set the right environment variables for agent config. #Note > tomlparser-agent-config.rb has to be parsed first before td-agent-bit-conf-customizer.rb for fbit agent settings if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ]; then - /usr/bin/ruby2.6 tomlparser-agent-config.rb + /usr/bin/ruby2.7 tomlparser-agent-config.rb cat agent_config_env_var | while read line; do #echo $line @@ -331,7 +331,7 @@ if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ]; then source agent_config_env_var #Parse the configmap to set the right environment variables for network policy manager (npm) integration. - /usr/bin/ruby2.6 tomlparser-npm-config.rb + /usr/bin/ruby2.7 tomlparser-npm-config.rb cat integration_npm_config_env_var | while read line; do #echo $line @@ -342,11 +342,11 @@ fi #Replace the placeholders in td-agent-bit.conf file for fluentbit with custom/default values in daemonset if [ ! -e "/etc/config/kube.conf" ] && [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ]; then - /usr/bin/ruby2.6 td-agent-bit-conf-customizer.rb + /usr/bin/ruby2.7 td-agent-bit-conf-customizer.rb fi #Parse the prometheus configmap to create a file with new custom settings. -/usr/bin/ruby2.6 tomlparser-prom-customconfig.rb +/usr/bin/ruby2.7 tomlparser-prom-customconfig.rb #Setting default environment variables to be used in any case of failure in the above steps if [ ! -e "/etc/config/kube.conf" ]; then @@ -380,7 +380,7 @@ fi if [ ! -e "/etc/config/kube.conf" ]; then if [ "${CONTAINER_TYPE}" == "PrometheusSidecar" ]; then #Parse the agent configmap to create a file with new custom settings. - /usr/bin/ruby2.6 tomlparser-prom-agent-config.rb + /usr/bin/ruby2.7 tomlparser-prom-agent-config.rb #Sourcing config environment variable file if it exists if [ -e "side_car_fbit_config_env_var" ]; then cat side_car_fbit_config_env_var | while read line; do @@ -394,7 +394,7 @@ fi #Parse the configmap to set the right environment variables for MDM metrics configuration for Alerting. if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ]; then - /usr/bin/ruby2.6 tomlparser-mdm-metrics-config.rb + /usr/bin/ruby2.7 tomlparser-mdm-metrics-config.rb cat config_mdm_metrics_env_var | while read line; do echo $line >> ~/.bashrc @@ -402,7 +402,7 @@ if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ]; then source config_mdm_metrics_env_var #Parse the configmap to set the right environment variables for metric collection settings - /usr/bin/ruby2.6 tomlparser-metric-collection-config.rb + /usr/bin/ruby2.7 tomlparser-metric-collection-config.rb cat config_metric_collection_env_var | while read line; do echo $line >> ~/.bashrc @@ -413,7 +413,7 @@ fi # OSM scraping to be done in replicaset if sidecar car scraping is disabled and always do the scraping from the sidecar (It will always be either one of the two) if [[ ( ( ! -e "/etc/config/kube.conf" ) && ( "${CONTAINER_TYPE}" == "PrometheusSidecar" ) ) || ( ( -e "/etc/config/kube.conf" ) && ( "${SIDECAR_SCRAPING_ENABLED}" == "false" ) ) ]]; then - /usr/bin/ruby2.6 tomlparser-osm-config.rb + /usr/bin/ruby2.7 tomlparser-osm-config.rb if [ -e "integration_osm_config_env_var" ]; then cat integration_osm_config_env_var | while read line; do @@ -500,7 +500,7 @@ if [ "$CONTAINER_RUNTIME" != "docker" ]; then fi echo "set caps for ruby process to read container env from proc" -sudo setcap cap_sys_ptrace,cap_dac_read_search+ep /usr/bin/ruby2.6 +sudo setcap cap_sys_ptrace,cap_dac_read_search+ep /usr/bin/ruby2.7 echo "export KUBELET_RUNTIME_OPERATIONS_METRIC="$KUBELET_RUNTIME_OPERATIONS_METRIC >> ~/.bashrc echo "export KUBELET_RUNTIME_OPERATIONS_ERRORS_METRIC="$KUBELET_RUNTIME_OPERATIONS_ERRORS_METRIC >> ~/.bashrc diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 872ac99cf..a507e1dfc 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -1,6 +1,12 @@ TMPDIR="/opt" cd $TMPDIR +if [ -z $1 ]; then + ARCH="amd64" +else + ARCH=$1 +fi + #Download utf-8 encoding capability on the omsagent container. #upgrade apt to latest version apt-get update && apt-get install -y apt && DEBIAN_FRONTEND=noninteractive apt-get install -y locales @@ -10,13 +16,17 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ update-locale LANG=en_US.UTF-8 #install oneagent - Official bits (10/7/2021) -wget https://github.com/microsoft/Docker-Provider/releases/download/1.14/azure-mdsd_1.14.2-build.master.284_x86_64.deb +if [ "${ARCH}" != "arm64" ]; then + wget "https://adme2epublic.blob.core.windows.net/privatefiles/azure-mdsd_1.16.0-build.dev_x86_64.deb?sp=r&st=2022-01-26T13:42:36Z&se=2022-02-24T21:42:36Z&spr=https&sv=2020-08-04&sr=b&sig=OTJREpVZsMp8WXYGpM7CMHa%2Fp22ztbWmikvmMSjX3xA%3D" -O azure-mdsd.deb +else + wget "https://adme2epublic.blob.core.windows.net/privatefiles/azure-mdsd_1.15.0-build.dev_aarch64_3.deb?sp=r&st=2022-01-26T13:41:51Z&se=2022-02-24T21:41:51Z&spr=https&sv=2020-08-04&sr=b&sig=uW2MnQ%2F8mUtq4gMb78SaY5AnqsRlk6UQEPo469fafGo%3D" -O azure-mdsd.deb +fi /usr/bin/dpkg -i $TMPDIR/azure-mdsd*.deb cp -f $TMPDIR/mdsd.xml /etc/mdsd.d cp -f $TMPDIR/envmdsd /etc/mdsd.d -#log rotate conf for mdsd and can be extended for other log files as well +# log rotate conf for mdsd and can be extended for other log files as well cp -f $TMPDIR/logrotate.conf /etc/logrotate.d/ci-agent #download inotify tools for watching configmap changes @@ -30,27 +40,27 @@ sudo apt-get install jq=1.5+dfsg-2 -y #used to setcaps for ruby process to read /proc/env sudo apt-get install libcap2-bin -y -wget https://dl.influxdata.com/telegraf/releases/telegraf-1.20.3_linux_amd64.tar.gz -tar -zxvf telegraf-1.20.3_linux_amd64.tar.gz +wget https://dl.influxdata.com/telegraf/releases/telegraf-1.20.3_linux_$ARCH.tar.gz +tar -zxvf telegraf-1.20.3_linux_$ARCH.tar.gz mv /opt/telegraf-1.20.3/usr/bin/telegraf /opt/telegraf chmod 777 /opt/telegraf # Use wildcard version so that it doesnt require to touch this file -/$TMPDIR/docker-cimprov-*.*.*-*.x86_64.sh --install +/$TMPDIR/docker-cimprov-*.*.*-*.*.sh --install #download and install fluent-bit(td-agent-bit) wget -qO - https://packages.fluentbit.io/fluentbit.key | sudo apt-key add - -sudo echo "deb https://packages.fluentbit.io/ubuntu/xenial xenial main" >> /etc/apt/sources.list +sudo echo "deb https://packages.fluentbit.io/ubuntu/bionic bionic main" >> /etc/apt/sources.list sudo apt-get update sudo apt-get install td-agent-bit=1.7.8 -y -# install ruby2.6 +# install ruby2.7 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F5DA5F09C3173AA6 sudo echo "deb http://ppa.launchpad.net/brightbox/ruby-ng/ubuntu bionic main" >> /etc/apt/sources.list sudo apt-get update -sudo apt-get install ruby2.6 ruby2.6-dev gcc make -y +sudo apt-get install ruby2.7 ruby2.7-dev gcc make -y # fluentd v1 gem gem install fluentd -v "1.14.2" --no-document fluentd --setup ./fluent @@ -64,7 +74,7 @@ rm -f $TMPDIR/envmdsd rm -f $TMPDIR/telegraf-*.tar.gz # remove build dependencies -sudo apt-get remove ruby2.6-dev gcc make -y +sudo apt-get remove ruby2.7-dev gcc make -y # Remove settings for cron.daily that conflict with the node's cron.daily. Since both are trying to rotate the same files # in /var/log at the same time, the rotation doesn't happen correctly and then the *.1 file is forever logged to. diff --git a/scripts/build/linux/install-build-pre-requisites.sh b/scripts/build/linux/install-build-pre-requisites.sh index 385d6fffc..e1965c153 100644 --- a/scripts/build/linux/install-build-pre-requisites.sh +++ b/scripts/build/linux/install-build-pre-requisites.sh @@ -58,10 +58,26 @@ install_docker() sudo apt-get install docker-ce docker-ce-cli containerd.io -y # Allow your user to access the Docker CLI without needing root access. sudo usermod -aG docker $USER + newgrp docker echo "installing docker completed" fi } +install_docker_buildx() +{ + # install the buildx plugin + sudo curl -O https://github.com/docker/buildx/releases/download/v0.7.1/buildx-v0.7.1.linux-amd64 + sudo mkdir -p $HOME/.docker/cli-plugins + sudo mv buildx-v* $HOME/.docker/cli-plugins + + # install the emulator support + 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 +} + install_python() { echo "installing python ..." @@ -125,6 +141,9 @@ install_build_dependencies # install docker install_docker +# install buildx +install_docker_buildx + # install go install_go_lang diff --git a/source/plugins/go/src/Makefile b/source/plugins/go/src/Makefile index b3b730d79..f9488bc8e 100644 --- a/source/plugins/go/src/Makefile +++ b/source/plugins/go/src/Makefile @@ -1,6 +1,16 @@ BASE_DIR := $(subst /build/linux,,$(PWD)) include $(BASE_DIR)/build/version +ifeq ($(arch),) + PF_ARCH=amd64 +else + PF_ARCH=$(arch) +endif + +ifneq ($(PF_ARCH),amd64) + OPTIONS=CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc GOOS=linux GOARCH=arm64 +endif + fbplugin: @echo "========================= Building out_oms plugin go code =========================" export BUILDVERSION=$(CONTAINER_BUILDVERSION_MAJOR).$(CONTAINER_BUILDVERSION_MINOR).$(CONTAINER_BUILDVERSION_PATCH)-$(CONTAINER_BUILDVERSION_BUILDNR) @@ -12,7 +22,7 @@ fbplugin: @echo "========================= go get =========================" go get @echo "========================= go build =========================" - go build -ldflags "-X 'main.revision=$(BUILDVERSION)' -X 'main.builddate=$(BUILDDATE)'" -buildmode=c-shared -o out_oms.so . + $(OPTIONS) go build -ldflags "-X 'main.revision=$(BUILDVERSION)' -X 'main.builddate=$(BUILDDATE)'" -buildmode=c-shared -o out_oms.so . test: go test -cover -race -coverprofile=coverage.txt -covermode=atomic From 3f147aa9574366218d47001f8197d7cd283c9b33 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Fri, 28 Jan 2022 18:54:11 +0000 Subject: [PATCH 02/88] add test pipeline yaml --- .pipelines/azure_pipeline.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .pipelines/azure_pipeline.yaml diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml new file mode 100644 index 000000000..e1e541565 --- /dev/null +++ b/.pipelines/azure_pipeline.yaml @@ -0,0 +1,19 @@ +# 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: + vmImage: ubuntu-latest + +steps: +- script: echo Hello, world! + displayName: 'Run a one-line script' + +- script: | + echo Add other tasks to build, test, and deploy your project. + echo See https://aka.ms/yaml + displayName: 'Run a multi-line script' From dd18771921e0ad16dcd1cd5e6b5fad103678b671 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Fri, 28 Jan 2022 19:01:31 +0000 Subject: [PATCH 03/88] use 1es pool --- .pipelines/azure_pipeline.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index e1e541565..c3d6aaeec 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -7,7 +7,8 @@ trigger: - ci_dev pool: - vmImage: ubuntu-latest + name: Azure-Pipelines-CI-Test-EO + steps: - script: echo Hello, world! From 57c2d67adf9958e601d4554e81016e73f9741e4a Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Fri, 28 Jan 2022 20:30:23 +0000 Subject: [PATCH 04/88] try to build --- .pipelines/azure_pipeline.yaml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index c3d6aaeec..aa0210aab 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -11,10 +11,20 @@ pool: steps: -- script: echo Hello, world! - displayName: 'Run a one-line script' - - script: | - echo Add other tasks to build, test, and deploy your project. - echo See https://aka.ms/yaml - displayName: 'Run a multi-line script' + pwd + ls -ltr + + commit=$(git rev-parse --short HEAD) + echo "##vso[task.setvariable variable=commitID;isOutput=true;]$commit" + + datetime=$(date +'%Y%m%d%s') + echo "##vso[task.setvariable variable=datetime;isOutput=true;]$datetime" + + 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 + + docker buildx build --platform linux/amd64,linux/arm64 --tag amoltest/test:testtag -f kubernetes/linux/Dockerfile.multiarch . From afd8a3e51cf3633f49d227b3561c5e53bf52dc63 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Mon, 31 Jan 2022 18:17:01 +0000 Subject: [PATCH 05/88] test push --- .pipelines/azure_pipeline.yaml | 36 ++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index aa0210aab..d75ccd78a 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -9,22 +9,34 @@ trigger: pool: name: Azure-Pipelines-CI-Test-EO +variables: + armServiceConnectionName: 'ci-1es-acr-connection' + subscription: '9b96ebbd-c57a-42d1-bbe9-b69296e4c7fb' + containerRegistry: 'amoltest' + repoImageName: '${{ variables.containerRegistry }}.azurecr.io/citest:multiarch' steps: -- script: | - pwd - ls -ltr +- task: AzureCLI@2 + inputs: + azureSubscription: ${{ variables.armServiceConnectionName }} + scriptType: bash + inlineScript: | + pwd + ls -ltr - commit=$(git rev-parse --short HEAD) - echo "##vso[task.setvariable variable=commitID;isOutput=true;]$commit" + az --version + az account show - datetime=$(date +'%Y%m%d%s') - echo "##vso[task.setvariable variable=datetime;isOutput=true;]$datetime" + commit=$(git rev-parse --short HEAD) + echo "##vso[task.setvariable variable=commitID;isOutput=true;]$commit" - 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 + datetime=$(date +'%Y%m%d%s') + echo "##vso[task.setvariable variable=datetime;isOutput=true;]$datetime" - docker buildx create --name testbuilder - docker buildx use testbuilder + 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 build --platform linux/amd64,linux/arm64 --tag amoltest/test:testtag -f kubernetes/linux/Dockerfile.multiarch . + docker buildx create --name testbuilder + docker buildx use testbuilder + + docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }} -f kubernetes/linux/Dockerfile.multiarch --push . From 696a25e8c7feb468c84c18088d7fa7ddc6820908 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Mon, 31 Jan 2022 18:23:08 +0000 Subject: [PATCH 06/88] login to acr --- .pipelines/azure_pipeline.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index d75ccd78a..dd66aa00d 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -24,9 +24,6 @@ steps: pwd ls -ltr - az --version - az account show - commit=$(git rev-parse --short HEAD) echo "##vso[task.setvariable variable=commitID;isOutput=true;]$commit" @@ -39,4 +36,9 @@ steps: 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 }} -f kubernetes/linux/Dockerfile.multiarch --push . From a5f3d8d872eecc41a23640a7f39abd1c9967e0de Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Mon, 31 Jan 2022 18:36:19 +0000 Subject: [PATCH 07/88] add script type --- .pipelines/azure_pipeline.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index dd66aa00d..afa6ab1d1 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -20,6 +20,7 @@ steps: inputs: azureSubscription: ${{ variables.armServiceConnectionName }} scriptType: bash + scriptLocation: inlineScript inlineScript: | pwd ls -ltr From e637545f7dd2dceaca3197ad89c0e875ed664df9 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 12:23:44 +0000 Subject: [PATCH 08/88] try pushing to ame acr --- .pipelines/azure_pipeline.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index afa6ab1d1..e3eb042be 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -7,13 +7,13 @@ trigger: - ci_dev pool: - name: Azure-Pipelines-CI-Test-EO + name: Azure-Pipelines-CI-Prod-EO variables: - armServiceConnectionName: 'ci-1es-acr-connection' - subscription: '9b96ebbd-c57a-42d1-bbe9-b69296e4c7fb' - containerRegistry: 'amoltest' - repoImageName: '${{ variables.containerRegistry }}.azurecr.io/citest:multiarch' + armServiceConnectionName: 'ci-1es-acr-connection-prod' + subscription: '30c56c3a-54da-46ea-b004-06eb33432687' + containerRegistry: 'containerinsightsbuild' + repoImageName: '${{ variables.containerRegistry }}.azurecr.io/official/build' steps: - task: AzureCLI@2 @@ -42,4 +42,4 @@ steps: az account set -s ${{ variables.subscription }} az acr login -n ${{ variables.containerRegistry }} - docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }} -f kubernetes/linux/Dockerfile.multiarch --push . + docker buildx build --platform linux/amd64,linux/arm64 --tag '${{ variables.repoImageName }}:cidev-${{ variables.$datetime }}-${{ variables.commit }}' -f kubernetes/linux/Dockerfile.multiarch --push . From 4008694a0dec98952b505bf8a4e60225fe978934 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 12:26:40 +0000 Subject: [PATCH 09/88] fix variables --- .pipelines/azure_pipeline.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index e3eb042be..e16ffd811 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -26,10 +26,10 @@ steps: ls -ltr commit=$(git rev-parse --short HEAD) - echo "##vso[task.setvariable variable=commitID;isOutput=true;]$commit" + echo "##vso[task.setvariable variable=commitID;]$commit" datetime=$(date +'%Y%m%d%s') - echo "##vso[task.setvariable variable=datetime;isOutput=true;]$datetime" + echo "##vso[task.setvariable variable=datetime;]$datetime" 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 @@ -42,4 +42,5 @@ steps: az account set -s ${{ variables.subscription }} az acr login -n ${{ variables.containerRegistry }} - docker buildx build --platform linux/amd64,linux/arm64 --tag '${{ variables.repoImageName }}:cidev-${{ variables.$datetime }}-${{ variables.commit }}' -f kubernetes/linux/Dockerfile.multiarch --push . + docker buildx build --platform linux/amd64,linux/arm64 --tag '${{ variables.repoImageName }}:cidev-$(datetime)-$(commit)' -f kubernetes/linux/Dockerfile.multiarch --push . + From 368bcb2625779492ba47b158a35cf67ad16af2cd Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 16:34:27 +0000 Subject: [PATCH 10/88] fix tag --- .pipelines/azure_pipeline.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index e16ffd811..366e52129 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -42,5 +42,5 @@ steps: az account set -s ${{ variables.subscription }} az acr login -n ${{ variables.containerRegistry }} - docker buildx build --platform linux/amd64,linux/arm64 --tag '${{ variables.repoImageName }}:cidev-$(datetime)-$(commit)' -f kubernetes/linux/Dockerfile.multiarch --push . + docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:cidev-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --push . From c1e40f97e0b1980f461938f578d026c5c4c2f543 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 16:53:28 +0000 Subject: [PATCH 11/88] fix tag 2 --- .pipelines/azure_pipeline.yaml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index 366e52129..f727cbcc3 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -16,20 +16,19 @@ variables: repoImageName: '${{ variables.containerRegistry }}.azurecr.io/official/build' 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" + - task: AzureCLI@2 inputs: azureSubscription: ${{ variables.armServiceConnectionName }} scriptType: bash scriptLocation: inlineScript inlineScript: | - pwd - ls -ltr - - commit=$(git rev-parse --short HEAD) - echo "##vso[task.setvariable variable=commitID;]$commit" - - datetime=$(date +'%Y%m%d%s') - echo "##vso[task.setvariable variable=datetime;]$datetime" 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 From 9973279b1c7198ecf6a084fc761f26ad27c668c6 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 17:57:08 +0000 Subject: [PATCH 12/88] change pipelines --- .pipelines/azure_pipeline.yaml | 4 +-- .pipelines/azure_pipeline_dev.yaml | 45 +++++++++++++++++++++++++++++ .pipelines/azure_pipeline_prod.yaml | 45 +++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 .pipelines/azure_pipeline_dev.yaml create mode 100644 .pipelines/azure_pipeline_prod.yaml diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index f727cbcc3..77ef1b1da 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -4,7 +4,7 @@ # https://aka.ms/yaml trigger: -- ci_dev +- ci_prod pool: name: Azure-Pipelines-CI-Prod-EO @@ -41,5 +41,5 @@ steps: az account set -s ${{ variables.subscription }} az acr login -n ${{ variables.containerRegistry }} - docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:cidev-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --push . + docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:ciprod-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --push . diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml new file mode 100644 index 000000000..471df955a --- /dev/null +++ b/.pipelines/azure_pipeline_dev.yaml @@ -0,0 +1,45 @@ +# 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" + +- 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 --push . + diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml new file mode 100644 index 000000000..f727cbcc3 --- /dev/null +++ b/.pipelines/azure_pipeline_prod.yaml @@ -0,0 +1,45 @@ +# 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-Prod-EO + +variables: + armServiceConnectionName: 'ci-1es-acr-connection-prod' + subscription: '30c56c3a-54da-46ea-b004-06eb33432687' + containerRegistry: 'containerinsightsbuild' + repoImageName: '${{ variables.containerRegistry }}.azurecr.io/official/build' + +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" + +- 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 }}:cidev-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --push . + From 27e7340e31630b120fedeb33267b3dd88193b4e8 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 17:58:06 +0000 Subject: [PATCH 13/88] remove extra file --- .pipelines/azure_pipeline.yaml | 45 ---------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 .pipelines/azure_pipeline.yaml diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml deleted file mode 100644 index 77ef1b1da..000000000 --- a/.pipelines/azure_pipeline.yaml +++ /dev/null @@ -1,45 +0,0 @@ -# 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/build' - -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" - -- 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 --push . - From 1c91492774f6427a432c748467be48f544cf52ac Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 18:32:48 +0000 Subject: [PATCH 14/88] missing changes --- .pipelines/azure_pipeline_prod.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml index f727cbcc3..77ef1b1da 100644 --- a/.pipelines/azure_pipeline_prod.yaml +++ b/.pipelines/azure_pipeline_prod.yaml @@ -4,7 +4,7 @@ # https://aka.ms/yaml trigger: -- ci_dev +- ci_prod pool: name: Azure-Pipelines-CI-Prod-EO @@ -41,5 +41,5 @@ steps: az account set -s ${{ variables.subscription }} az acr login -n ${{ variables.containerRegistry }} - docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:cidev-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --push . + docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:ciprod-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --push . From c79382a824a7cc326a0d3ffe7aeea73681ff2e3b Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 19:47:48 +0000 Subject: [PATCH 15/88] save metadata --- .pipelines/azure_pipeline_dev.yaml | 6 +++++- .pipelines/azure_pipeline_prod.yaml | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml index 471df955a..e730c9c38 100644 --- a/.pipelines/azure_pipeline_dev.yaml +++ b/.pipelines/azure_pipeline_dev.yaml @@ -41,5 +41,9 @@ steps: 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 --push . + docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --metadata-file $(Build.ArtifactStagingDirectory)/metadata.json --push . +- task: PublishBuildArtifacts@1 + inputs: + pathToPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: drop diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml index 77ef1b1da..d2d5f498c 100644 --- a/.pipelines/azure_pipeline_prod.yaml +++ b/.pipelines/azure_pipeline_prod.yaml @@ -41,5 +41,9 @@ steps: 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 --push . + 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 --push . +- task: PublishBuildArtifacts@1 + inputs: + pathToPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: drop \ No newline at end of file From 565b00b5d3eab50be0da39665c8fe960907c47fe Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Wed, 2 Feb 2022 21:03:54 +0000 Subject: [PATCH 16/88] update pipelines --- .pipelines/azure_pipeline_dev.yaml | 8 ++++++++ .pipelines/azure_pipeline_prod.yaml | 8 ++++++++ source/plugins/ruby/in_kube_nodes.rb | 3 +++ 3 files changed, 19 insertions(+) diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml index e730c9c38..040839756 100644 --- a/.pipelines/azure_pipeline_dev.yaml +++ b/.pipelines/azure_pipeline_dev.yaml @@ -43,6 +43,14 @@ steps: docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --metadata-file $(Build.ArtifactStagingDirectory)/metadata.json --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)' diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml index d2d5f498c..e1c758875 100644 --- a/.pipelines/azure_pipeline_prod.yaml +++ b/.pipelines/azure_pipeline_prod.yaml @@ -43,6 +43,14 @@ steps: 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 --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)' diff --git a/source/plugins/ruby/in_kube_nodes.rb b/source/plugins/ruby/in_kube_nodes.rb index abbfe94a1..5a52a089b 100644 --- a/source/plugins/ruby/in_kube_nodes.rb +++ b/source/plugins/ruby/in_kube_nodes.rb @@ -560,6 +560,9 @@ def getNodeTelemetryProps(item) properties["OperatingSystem"] = nodeInfo["operatingSystem"] properties["KernelVersion"] = nodeInfo["kernelVersion"] properties["OSImage"] = nodeInfo["osImage"] + if nodeInfo["architecture"] == "arm64" + properties["Architecture"] = nodeInfo["architecture"] + end containerRuntimeVersion = nodeInfo["containerRuntimeVersion"] if containerRuntimeVersion.downcase.start_with?("docker://") properties["DockerVersion"] = containerRuntimeVersion.split("//")[1] From 8384005e83a1206a2f600fdf5d03ffc5d2986333 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Thu, 3 Feb 2022 14:00:43 +0000 Subject: [PATCH 17/88] revert official mdsd arm64 build --- kubernetes/linux/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index a507e1dfc..25cb2e9c2 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -17,7 +17,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ #install oneagent - Official bits (10/7/2021) if [ "${ARCH}" != "arm64" ]; then - wget "https://adme2epublic.blob.core.windows.net/privatefiles/azure-mdsd_1.16.0-build.dev_x86_64.deb?sp=r&st=2022-01-26T13:42:36Z&se=2022-02-24T21:42:36Z&spr=https&sv=2020-08-04&sr=b&sig=OTJREpVZsMp8WXYGpM7CMHa%2Fp22ztbWmikvmMSjX3xA%3D" -O azure-mdsd.deb + wget https://github.com/microsoft/Docker-Provider/releases/download/1.14/azure-mdsd_1.14.2-build.master.284_x86_64.deb -O azure-mdsd.deb else wget "https://adme2epublic.blob.core.windows.net/privatefiles/azure-mdsd_1.15.0-build.dev_aarch64_3.deb?sp=r&st=2022-01-26T13:41:51Z&se=2022-02-24T21:41:51Z&spr=https&sv=2020-08-04&sr=b&sig=uW2MnQ%2F8mUtq4gMb78SaY5AnqsRlk6UQEPo469fafGo%3D" -O azure-mdsd.deb fi From 4f22ef6b3f28f950eeab7177532bae2be100f2b2 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Thu, 3 Feb 2022 14:07:58 +0000 Subject: [PATCH 18/88] add build_arg image_tag --- .pipelines/azure_pipeline_dev.yaml | 2 +- .pipelines/azure_pipeline_prod.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml index 040839756..ab740de7f 100644 --- a/.pipelines/azure_pipeline_dev.yaml +++ b/.pipelines/azure_pipeline_dev.yaml @@ -41,7 +41,7 @@ steps: 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 --push . + 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) diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml index e1c758875..fa0fcafc6 100644 --- a/.pipelines/azure_pipeline_prod.yaml +++ b/.pipelines/azure_pipeline_prod.yaml @@ -41,7 +41,7 @@ steps: 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 --push . + 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) From b6d3a8b611917b5756032cd78144ee9c638ba32d Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Fri, 11 Feb 2022 18:17:27 +0000 Subject: [PATCH 19/88] use new arm64 version --- kubernetes/linux/main.sh | 6 ++++++ kubernetes/linux/setup.sh | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/kubernetes/linux/main.sh b/kubernetes/linux/main.sh index b905311aa..9f68b6fdc 100644 --- a/kubernetes/linux/main.sh +++ b/kubernetes/linux/main.sh @@ -563,6 +563,12 @@ else echo "export CIWORKSPACE_keyFile=$CIWORKSPACE_keyFile" >> ~/.bashrc export MDSD_FLUENT_SOCKET_PORT="29230" echo "export MDSD_FLUENT_SOCKET_PORT=$MDSD_FLUENT_SOCKET_PORT" >> ~/.bashrc + export ENABLE_CURL_UPLOAD=true + echo "export ENABLE_CURL_UPLOAD=$ENABLE_CURL_UPLOAD" >> ~/.bashrc + export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt + echo "export CURL_CA_BUNDLE=$CURL_CA_BUNDLE" >> ~/.bashrc + mkdir -p /etc/pki/tls/certs + cp /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt fi source ~/.bashrc diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 25cb2e9c2..58c167f46 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -19,7 +19,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ if [ "${ARCH}" != "arm64" ]; then wget https://github.com/microsoft/Docker-Provider/releases/download/1.14/azure-mdsd_1.14.2-build.master.284_x86_64.deb -O azure-mdsd.deb else - wget "https://adme2epublic.blob.core.windows.net/privatefiles/azure-mdsd_1.15.0-build.dev_aarch64_3.deb?sp=r&st=2022-01-26T13:41:51Z&se=2022-02-24T21:41:51Z&spr=https&sv=2020-08-04&sr=b&sig=uW2MnQ%2F8mUtq4gMb78SaY5AnqsRlk6UQEPo469fafGo%3D" -O azure-mdsd.deb + wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2693_aarch64.deb" -O azure-mdsd.deb fi /usr/bin/dpkg -i $TMPDIR/azure-mdsd*.deb From 220028047223941a0b08cead852ad9354fd75824 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Mon, 14 Feb 2022 12:38:47 +0000 Subject: [PATCH 20/88] update arm build --- kubernetes/linux/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 58c167f46..237535ce0 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -19,7 +19,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ if [ "${ARCH}" != "arm64" ]; then wget https://github.com/microsoft/Docker-Provider/releases/download/1.14/azure-mdsd_1.14.2-build.master.284_x86_64.deb -O azure-mdsd.deb else - wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2693_aarch64.deb" -O azure-mdsd.deb + wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2702_aarch64.deb" -O azure-mdsd.deb fi /usr/bin/dpkg -i $TMPDIR/azure-mdsd*.deb From eb31afdc368e399f63b9fd7a13c6a29717ac81a7 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 15 Feb 2022 12:03:50 +0000 Subject: [PATCH 21/88] update amd build --- kubernetes/linux/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 237535ce0..bcb089b6e 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -17,7 +17,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ #install oneagent - Official bits (10/7/2021) if [ "${ARCH}" != "arm64" ]; then - wget https://github.com/microsoft/Docker-Provider/releases/download/1.14/azure-mdsd_1.14.2-build.master.284_x86_64.deb -O azure-mdsd.deb + wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2706_x86_64.deb" -O azure-mdsd.deb else wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2702_aarch64.deb" -O azure-mdsd.deb fi From e8236797194440895dc4f20c0e872ddce6331451 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 22 Feb 2022 19:09:12 +0000 Subject: [PATCH 22/88] update arm build --- kubernetes/linux/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index bcb089b6e..2ebd8d658 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -19,7 +19,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ if [ "${ARCH}" != "arm64" ]; then wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2706_x86_64.deb" -O azure-mdsd.deb else - wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2702_aarch64.deb" -O azure-mdsd.deb + wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2717_aarch64.deb" -O azure-mdsd.deb fi /usr/bin/dpkg -i $TMPDIR/azure-mdsd*.deb From fb0517134bf9a24c6cf3870911f50f0901c8bad0 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Wed, 23 Feb 2022 18:56:44 +0000 Subject: [PATCH 23/88] use new amd64 master build for mdsd --- kubernetes/linux/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 2ebd8d658..7e8133744 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -17,7 +17,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ #install oneagent - Official bits (10/7/2021) if [ "${ARCH}" != "arm64" ]; then - wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2706_x86_64.deb" -O azure-mdsd.deb + wget "https://github.com/microsoft/Docker-Provider/releases/download/1.17.0/azure-mdsd_1.17.0-build.master.354_x86_64.deb" -O azure-mdsd.deb else wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2717_aarch64.deb" -O azure-mdsd.deb fi From 2d5bf72844c6948dad1c9df60880ca93348d5ad9 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Wed, 23 Feb 2022 19:15:29 +0000 Subject: [PATCH 24/88] update golang to 1.15 in dockerfile --- kubernetes/linux/Dockerfile.multiarch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/Dockerfile.multiarch b/kubernetes/linux/Dockerfile.multiarch index 9dfeacc4d..28c305f3d 100644 --- a/kubernetes/linux/Dockerfile.multiarch +++ b/kubernetes/linux/Dockerfile.multiarch @@ -1,4 +1,4 @@ -FROM --platform=$BUILDPLATFORM golang:1.14 AS builder +FROM --platform=$BUILDPLATFORM golang:1.15 AS builder ARG TARGETOS TARGETARCH RUN /usr/bin/apt-get update && /usr/bin/apt-get install git g++ make pkg-config libssl-dev libpam0g-dev rpm librpm-dev uuid-dev libkrb5-dev python sudo gcc-aarch64-linux-gnu -y From a06ec6cdc32f45af088ecd3549a8be0c60cd1a75 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Mon, 28 Feb 2022 18:17:52 +0000 Subject: [PATCH 25/88] use releases url --- kubernetes/linux/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 7e8133744..9619ea39e 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -19,7 +19,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ if [ "${ARCH}" != "arm64" ]; then wget "https://github.com/microsoft/Docker-Provider/releases/download/1.17.0/azure-mdsd_1.17.0-build.master.354_x86_64.deb" -O azure-mdsd.deb else - wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2717_aarch64.deb" -O azure-mdsd.deb + wget "https://github.com/microsoft/Docker-Provider/releases/download/1.17.0-arm64-dev/azure-mdsd_1.17.0-build.develop.2717_aarch64.deb" -O azure-mdsd.deb fi /usr/bin/dpkg -i $TMPDIR/azure-mdsd*.deb From f0a6564ad01fe24d3be703727e826931b865a5b0 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Thu, 27 Jan 2022 15:39:27 +0000 Subject: [PATCH 26/88] build multi-arch images --- README.md | 19 +++++++++ build/linux/Makefile | 24 +++++------- kubernetes/linux/Dockerfile | 2 +- kubernetes/linux/Dockerfile.multiarch | 39 +++++++++++++++++++ .../build-and-publish-docker-image.sh | 16 +++++++- kubernetes/linux/main.sh | 20 +++++----- kubernetes/linux/setup.sh | 28 ++++++++----- .../linux/install-build-pre-requisites.sh | 19 +++++++++ source/plugins/go/src/Makefile | 12 +++++- 9 files changed, 143 insertions(+), 36 deletions(-) create mode 100644 kubernetes/linux/Dockerfile.multiarch diff --git a/README.md b/README.md index 7d42c75d6..f0fa40e53 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,25 @@ bash build-and-publish-docker-image.sh --image /: ``` > Note: format of the imagetag will be `ci`. 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 ` +# build and publish using docker buildx +bash build-and-publish-docker-image.sh --image /: --multiarch +``` + +or directly use the docker buildx commands +``` +# multiple platforms +cd ~/Docker-Provider +docker buildx build --platform linux/arm64/v8,linux/amd64 -t /: --build-arg IMAGE_TAG= -f kubernetes/linux/Dockerfile.multiarch --push . + +# single platform +cd ~/Docker-Provider +docker buildx build --platform linux/amd64 -t /: --build-arg IMAGE_TAG= -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 diff --git a/build/linux/Makefile b/build/linux/Makefile index 3f35e1204..9203f1d73 100644 --- a/build/linux/Makefile +++ b/build/linux/Makefile @@ -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 @@ -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) #-------------------------------------------------------------------------------- @@ -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 : @@ -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 diff --git a/kubernetes/linux/Dockerfile b/kubernetes/linux/Dockerfile index f3a9efd7a..b32538799 100644 --- a/kubernetes/linux/Dockerfile +++ b/kubernetes/linux/Dockerfile @@ -23,7 +23,7 @@ ENV AGENT_VERSION ${IMAGE_TAG} WORKDIR ${tmpdir} # copy docker provider shell bundle to use the agent image -COPY ./Linux_ULINUX_1.0_x64_64_Release/docker-cimprov-*.*.*-*.x86_64.sh . +COPY ./Linux_ULINUX_1.0_*_64_Release/docker-cimprov-*.*.*-*.*.*.sh . # Note: If you prefer remote destination, uncomment below line and comment above line # wget https://github.com/microsoft/Docker-Provider/releases/download/10.0.0-1/docker-cimprov-10.0.0-1.universal.x86_64.sh diff --git a/kubernetes/linux/Dockerfile.multiarch b/kubernetes/linux/Dockerfile.multiarch new file mode 100644 index 000000000..9dfeacc4d --- /dev/null +++ b/kubernetes/linux/Dockerfile.multiarch @@ -0,0 +1,39 @@ +FROM --platform=$BUILDPLATFORM golang:1.14 AS builder +ARG TARGETOS TARGETARCH +RUN /usr/bin/apt-get update && /usr/bin/apt-get install git g++ make pkg-config libssl-dev libpam0g-dev rpm librpm-dev uuid-dev libkrb5-dev python sudo gcc-aarch64-linux-gnu -y + +COPY build /src/build +COPY source /src/source +RUN cd /src/build/linux && make arch=${TARGETARCH} + + +FROM ubuntu:18.04 AS base_image +ARG TARGETOS TARGETARCH +MAINTAINER OMSContainers@microsoft.com +LABEL vendor=Microsoft\ Corp \ + com.microsoft.product="Azure Monitor for containers" +ENV tmpdir /opt +ENV APPLICATIONINSIGHTS_AUTH NzAwZGM5OGYtYTdhZC00NThkLWI5NWMtMjA3ZjM3NmM3YmRi +ENV MALLOC_ARENA_MAX 2 +ENV HOST_MOUNT_PREFIX /hostfs +ENV HOST_PROC /hostfs/proc +ENV HOST_SYS /hostfs/sys +ENV HOST_ETC /hostfs/etc +ENV HOST_VAR /hostfs/var +ENV AZMON_COLLECT_ENV False +ENV KUBE_CLIENT_BACKOFF_BASE 1 +ENV KUBE_CLIENT_BACKOFF_DURATION 0 +ENV RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR 0.9 +RUN /usr/bin/apt-get update && /usr/bin/apt-get install -y libc-bin wget openssl curl sudo python python-ctypes init-system-helpers net-tools rsyslog cron vim dmidecode apt-transport-https gnupg make && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /src/kubernetes/linux/Linux_ULINUX_1.0_*_64_Release/docker-cimprov-*.*.*-*.*.sh $tmpdir/ +COPY kubernetes/linux/setup.sh kubernetes/linux/main.sh kubernetes/linux/defaultpromenvvariables kubernetes/linux/defaultpromenvvariables-rs kubernetes/linux/defaultpromenvvariables-sidecar kubernetes/linux/mdsd.xml kubernetes/linux/envmdsd kubernetes/linux/logrotate.conf $tmpdir/ + +ARG IMAGE_TAG=ciprod10132021 +ENV AGENT_VERSION ${IMAGE_TAG} + +WORKDIR ${tmpdir} + +RUN chmod 775 $tmpdir/*.sh; sync; $tmpdir/setup.sh ${TARGETARCH} +CMD [ "/opt/main.sh" ] + diff --git a/kubernetes/linux/dockerbuild/build-and-publish-docker-image.sh b/kubernetes/linux/dockerbuild/build-and-publish-docker-image.sh index 267f15f32..580b158c9 100755 --- a/kubernetes/linux/dockerbuild/build-and-publish-docker-image.sh +++ b/kubernetes/linux/dockerbuild/build-and-publish-docker-image.sh @@ -14,6 +14,7 @@ usage() echo echo "Build and publish docker image:" echo "$basename --image " + echo "$basename --image --multiarch" } parse_args() @@ -30,6 +31,7 @@ for arg in "$@"; do shift case "$arg" in "--image") set -- "$@" "-i" ;; + "--multiarch") set -- "$@" "-m" ;; "--"*) usage ;; *) set -- "$@" "$arg" esac @@ -37,7 +39,7 @@ done local OPTIND opt -while getopts 'hi:' opt; do +while getopts 'hi:m' opt; do case "$opt" in h) usage @@ -48,6 +50,11 @@ while getopts 'hi:' opt; do echo "image is $OPTARG" ;; + m) + multi=1 + echo "using multiarch dockerfile" + ;; + ?) usage exit 1 @@ -131,6 +138,13 @@ echo "source code base directory: $baseDir" echo "build directory for docker provider: $buildDir" echo "docker file directory: $dockerFileDir" +if [ "$multi" -eq "1" ]; then + echo "building multiarch" + cd $baseDir + docker buildx build --platform linux/arm64/v8,linux/amd64 -t $image --build-arg IMAGE_TAG=$imageTag -f $linuxDir/Dockerfile.multiarch --push . + exit 0 +fi + # build docker provider shell bundle build_docker_provider diff --git a/kubernetes/linux/main.sh b/kubernetes/linux/main.sh index 980c15586..b905311aa 100644 --- a/kubernetes/linux/main.sh +++ b/kubernetes/linux/main.sh @@ -311,7 +311,7 @@ source ~/.bashrc if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ]; then #Parse the configmap to set the right environment variables. - /usr/bin/ruby2.6 tomlparser.rb + /usr/bin/ruby2.7 tomlparser.rb cat config_env_var | while read line; do echo $line >> ~/.bashrc @@ -322,7 +322,7 @@ fi #Parse the configmap to set the right environment variables for agent config. #Note > tomlparser-agent-config.rb has to be parsed first before td-agent-bit-conf-customizer.rb for fbit agent settings if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ]; then - /usr/bin/ruby2.6 tomlparser-agent-config.rb + /usr/bin/ruby2.7 tomlparser-agent-config.rb cat agent_config_env_var | while read line; do #echo $line @@ -331,7 +331,7 @@ if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ]; then source agent_config_env_var #Parse the configmap to set the right environment variables for network policy manager (npm) integration. - /usr/bin/ruby2.6 tomlparser-npm-config.rb + /usr/bin/ruby2.7 tomlparser-npm-config.rb cat integration_npm_config_env_var | while read line; do #echo $line @@ -342,11 +342,11 @@ fi #Replace the placeholders in td-agent-bit.conf file for fluentbit with custom/default values in daemonset if [ ! -e "/etc/config/kube.conf" ] && [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ]; then - /usr/bin/ruby2.6 td-agent-bit-conf-customizer.rb + /usr/bin/ruby2.7 td-agent-bit-conf-customizer.rb fi #Parse the prometheus configmap to create a file with new custom settings. -/usr/bin/ruby2.6 tomlparser-prom-customconfig.rb +/usr/bin/ruby2.7 tomlparser-prom-customconfig.rb #Setting default environment variables to be used in any case of failure in the above steps if [ ! -e "/etc/config/kube.conf" ]; then @@ -380,7 +380,7 @@ fi if [ ! -e "/etc/config/kube.conf" ]; then if [ "${CONTAINER_TYPE}" == "PrometheusSidecar" ]; then #Parse the agent configmap to create a file with new custom settings. - /usr/bin/ruby2.6 tomlparser-prom-agent-config.rb + /usr/bin/ruby2.7 tomlparser-prom-agent-config.rb #Sourcing config environment variable file if it exists if [ -e "side_car_fbit_config_env_var" ]; then cat side_car_fbit_config_env_var | while read line; do @@ -394,7 +394,7 @@ fi #Parse the configmap to set the right environment variables for MDM metrics configuration for Alerting. if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ]; then - /usr/bin/ruby2.6 tomlparser-mdm-metrics-config.rb + /usr/bin/ruby2.7 tomlparser-mdm-metrics-config.rb cat config_mdm_metrics_env_var | while read line; do echo $line >> ~/.bashrc @@ -402,7 +402,7 @@ if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ]; then source config_mdm_metrics_env_var #Parse the configmap to set the right environment variables for metric collection settings - /usr/bin/ruby2.6 tomlparser-metric-collection-config.rb + /usr/bin/ruby2.7 tomlparser-metric-collection-config.rb cat config_metric_collection_env_var | while read line; do echo $line >> ~/.bashrc @@ -413,7 +413,7 @@ fi # OSM scraping to be done in replicaset if sidecar car scraping is disabled and always do the scraping from the sidecar (It will always be either one of the two) if [[ ( ( ! -e "/etc/config/kube.conf" ) && ( "${CONTAINER_TYPE}" == "PrometheusSidecar" ) ) || ( ( -e "/etc/config/kube.conf" ) && ( "${SIDECAR_SCRAPING_ENABLED}" == "false" ) ) ]]; then - /usr/bin/ruby2.6 tomlparser-osm-config.rb + /usr/bin/ruby2.7 tomlparser-osm-config.rb if [ -e "integration_osm_config_env_var" ]; then cat integration_osm_config_env_var | while read line; do @@ -500,7 +500,7 @@ if [ "$CONTAINER_RUNTIME" != "docker" ]; then fi echo "set caps for ruby process to read container env from proc" -sudo setcap cap_sys_ptrace,cap_dac_read_search+ep /usr/bin/ruby2.6 +sudo setcap cap_sys_ptrace,cap_dac_read_search+ep /usr/bin/ruby2.7 echo "export KUBELET_RUNTIME_OPERATIONS_METRIC="$KUBELET_RUNTIME_OPERATIONS_METRIC >> ~/.bashrc echo "export KUBELET_RUNTIME_OPERATIONS_ERRORS_METRIC="$KUBELET_RUNTIME_OPERATIONS_ERRORS_METRIC >> ~/.bashrc diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 872ac99cf..a507e1dfc 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -1,6 +1,12 @@ TMPDIR="/opt" cd $TMPDIR +if [ -z $1 ]; then + ARCH="amd64" +else + ARCH=$1 +fi + #Download utf-8 encoding capability on the omsagent container. #upgrade apt to latest version apt-get update && apt-get install -y apt && DEBIAN_FRONTEND=noninteractive apt-get install -y locales @@ -10,13 +16,17 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ update-locale LANG=en_US.UTF-8 #install oneagent - Official bits (10/7/2021) -wget https://github.com/microsoft/Docker-Provider/releases/download/1.14/azure-mdsd_1.14.2-build.master.284_x86_64.deb +if [ "${ARCH}" != "arm64" ]; then + wget "https://adme2epublic.blob.core.windows.net/privatefiles/azure-mdsd_1.16.0-build.dev_x86_64.deb?sp=r&st=2022-01-26T13:42:36Z&se=2022-02-24T21:42:36Z&spr=https&sv=2020-08-04&sr=b&sig=OTJREpVZsMp8WXYGpM7CMHa%2Fp22ztbWmikvmMSjX3xA%3D" -O azure-mdsd.deb +else + wget "https://adme2epublic.blob.core.windows.net/privatefiles/azure-mdsd_1.15.0-build.dev_aarch64_3.deb?sp=r&st=2022-01-26T13:41:51Z&se=2022-02-24T21:41:51Z&spr=https&sv=2020-08-04&sr=b&sig=uW2MnQ%2F8mUtq4gMb78SaY5AnqsRlk6UQEPo469fafGo%3D" -O azure-mdsd.deb +fi /usr/bin/dpkg -i $TMPDIR/azure-mdsd*.deb cp -f $TMPDIR/mdsd.xml /etc/mdsd.d cp -f $TMPDIR/envmdsd /etc/mdsd.d -#log rotate conf for mdsd and can be extended for other log files as well +# log rotate conf for mdsd and can be extended for other log files as well cp -f $TMPDIR/logrotate.conf /etc/logrotate.d/ci-agent #download inotify tools for watching configmap changes @@ -30,27 +40,27 @@ sudo apt-get install jq=1.5+dfsg-2 -y #used to setcaps for ruby process to read /proc/env sudo apt-get install libcap2-bin -y -wget https://dl.influxdata.com/telegraf/releases/telegraf-1.20.3_linux_amd64.tar.gz -tar -zxvf telegraf-1.20.3_linux_amd64.tar.gz +wget https://dl.influxdata.com/telegraf/releases/telegraf-1.20.3_linux_$ARCH.tar.gz +tar -zxvf telegraf-1.20.3_linux_$ARCH.tar.gz mv /opt/telegraf-1.20.3/usr/bin/telegraf /opt/telegraf chmod 777 /opt/telegraf # Use wildcard version so that it doesnt require to touch this file -/$TMPDIR/docker-cimprov-*.*.*-*.x86_64.sh --install +/$TMPDIR/docker-cimprov-*.*.*-*.*.sh --install #download and install fluent-bit(td-agent-bit) wget -qO - https://packages.fluentbit.io/fluentbit.key | sudo apt-key add - -sudo echo "deb https://packages.fluentbit.io/ubuntu/xenial xenial main" >> /etc/apt/sources.list +sudo echo "deb https://packages.fluentbit.io/ubuntu/bionic bionic main" >> /etc/apt/sources.list sudo apt-get update sudo apt-get install td-agent-bit=1.7.8 -y -# install ruby2.6 +# install ruby2.7 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F5DA5F09C3173AA6 sudo echo "deb http://ppa.launchpad.net/brightbox/ruby-ng/ubuntu bionic main" >> /etc/apt/sources.list sudo apt-get update -sudo apt-get install ruby2.6 ruby2.6-dev gcc make -y +sudo apt-get install ruby2.7 ruby2.7-dev gcc make -y # fluentd v1 gem gem install fluentd -v "1.14.2" --no-document fluentd --setup ./fluent @@ -64,7 +74,7 @@ rm -f $TMPDIR/envmdsd rm -f $TMPDIR/telegraf-*.tar.gz # remove build dependencies -sudo apt-get remove ruby2.6-dev gcc make -y +sudo apt-get remove ruby2.7-dev gcc make -y # Remove settings for cron.daily that conflict with the node's cron.daily. Since both are trying to rotate the same files # in /var/log at the same time, the rotation doesn't happen correctly and then the *.1 file is forever logged to. diff --git a/scripts/build/linux/install-build-pre-requisites.sh b/scripts/build/linux/install-build-pre-requisites.sh index 385d6fffc..e1965c153 100644 --- a/scripts/build/linux/install-build-pre-requisites.sh +++ b/scripts/build/linux/install-build-pre-requisites.sh @@ -58,10 +58,26 @@ install_docker() sudo apt-get install docker-ce docker-ce-cli containerd.io -y # Allow your user to access the Docker CLI without needing root access. sudo usermod -aG docker $USER + newgrp docker echo "installing docker completed" fi } +install_docker_buildx() +{ + # install the buildx plugin + sudo curl -O https://github.com/docker/buildx/releases/download/v0.7.1/buildx-v0.7.1.linux-amd64 + sudo mkdir -p $HOME/.docker/cli-plugins + sudo mv buildx-v* $HOME/.docker/cli-plugins + + # install the emulator support + 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 +} + install_python() { echo "installing python ..." @@ -125,6 +141,9 @@ install_build_dependencies # install docker install_docker +# install buildx +install_docker_buildx + # install go install_go_lang diff --git a/source/plugins/go/src/Makefile b/source/plugins/go/src/Makefile index b3b730d79..f9488bc8e 100644 --- a/source/plugins/go/src/Makefile +++ b/source/plugins/go/src/Makefile @@ -1,6 +1,16 @@ BASE_DIR := $(subst /build/linux,,$(PWD)) include $(BASE_DIR)/build/version +ifeq ($(arch),) + PF_ARCH=amd64 +else + PF_ARCH=$(arch) +endif + +ifneq ($(PF_ARCH),amd64) + OPTIONS=CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc GOOS=linux GOARCH=arm64 +endif + fbplugin: @echo "========================= Building out_oms plugin go code =========================" export BUILDVERSION=$(CONTAINER_BUILDVERSION_MAJOR).$(CONTAINER_BUILDVERSION_MINOR).$(CONTAINER_BUILDVERSION_PATCH)-$(CONTAINER_BUILDVERSION_BUILDNR) @@ -12,7 +22,7 @@ fbplugin: @echo "========================= go get =========================" go get @echo "========================= go build =========================" - go build -ldflags "-X 'main.revision=$(BUILDVERSION)' -X 'main.builddate=$(BUILDDATE)'" -buildmode=c-shared -o out_oms.so . + $(OPTIONS) go build -ldflags "-X 'main.revision=$(BUILDVERSION)' -X 'main.builddate=$(BUILDDATE)'" -buildmode=c-shared -o out_oms.so . test: go test -cover -race -coverprofile=coverage.txt -covermode=atomic From 808ea625487a47b96028f165eb3f8ee3b734ce86 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Fri, 28 Jan 2022 18:54:11 +0000 Subject: [PATCH 27/88] add test pipeline yaml --- .pipelines/azure_pipeline.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .pipelines/azure_pipeline.yaml diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml new file mode 100644 index 000000000..e1e541565 --- /dev/null +++ b/.pipelines/azure_pipeline.yaml @@ -0,0 +1,19 @@ +# 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: + vmImage: ubuntu-latest + +steps: +- script: echo Hello, world! + displayName: 'Run a one-line script' + +- script: | + echo Add other tasks to build, test, and deploy your project. + echo See https://aka.ms/yaml + displayName: 'Run a multi-line script' From ef5c766c76be8332894411633778724cf72ed5b0 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Fri, 28 Jan 2022 19:01:31 +0000 Subject: [PATCH 28/88] use 1es pool --- .pipelines/azure_pipeline.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index e1e541565..c3d6aaeec 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -7,7 +7,8 @@ trigger: - ci_dev pool: - vmImage: ubuntu-latest + name: Azure-Pipelines-CI-Test-EO + steps: - script: echo Hello, world! From 087f7388d775051c1976d8d4f2bc896f2b578220 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Fri, 28 Jan 2022 20:30:23 +0000 Subject: [PATCH 29/88] try to build --- .pipelines/azure_pipeline.yaml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index c3d6aaeec..aa0210aab 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -11,10 +11,20 @@ pool: steps: -- script: echo Hello, world! - displayName: 'Run a one-line script' - - script: | - echo Add other tasks to build, test, and deploy your project. - echo See https://aka.ms/yaml - displayName: 'Run a multi-line script' + pwd + ls -ltr + + commit=$(git rev-parse --short HEAD) + echo "##vso[task.setvariable variable=commitID;isOutput=true;]$commit" + + datetime=$(date +'%Y%m%d%s') + echo "##vso[task.setvariable variable=datetime;isOutput=true;]$datetime" + + 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 + + docker buildx build --platform linux/amd64,linux/arm64 --tag amoltest/test:testtag -f kubernetes/linux/Dockerfile.multiarch . From 69664827d726ac9bb3ffb7e86ed203ff1e851478 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Mon, 31 Jan 2022 18:17:01 +0000 Subject: [PATCH 30/88] test push --- .pipelines/azure_pipeline.yaml | 36 ++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index aa0210aab..d75ccd78a 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -9,22 +9,34 @@ trigger: pool: name: Azure-Pipelines-CI-Test-EO +variables: + armServiceConnectionName: 'ci-1es-acr-connection' + subscription: '9b96ebbd-c57a-42d1-bbe9-b69296e4c7fb' + containerRegistry: 'amoltest' + repoImageName: '${{ variables.containerRegistry }}.azurecr.io/citest:multiarch' steps: -- script: | - pwd - ls -ltr +- task: AzureCLI@2 + inputs: + azureSubscription: ${{ variables.armServiceConnectionName }} + scriptType: bash + inlineScript: | + pwd + ls -ltr - commit=$(git rev-parse --short HEAD) - echo "##vso[task.setvariable variable=commitID;isOutput=true;]$commit" + az --version + az account show - datetime=$(date +'%Y%m%d%s') - echo "##vso[task.setvariable variable=datetime;isOutput=true;]$datetime" + commit=$(git rev-parse --short HEAD) + echo "##vso[task.setvariable variable=commitID;isOutput=true;]$commit" - 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 + datetime=$(date +'%Y%m%d%s') + echo "##vso[task.setvariable variable=datetime;isOutput=true;]$datetime" - docker buildx create --name testbuilder - docker buildx use testbuilder + 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 build --platform linux/amd64,linux/arm64 --tag amoltest/test:testtag -f kubernetes/linux/Dockerfile.multiarch . + docker buildx create --name testbuilder + docker buildx use testbuilder + + docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }} -f kubernetes/linux/Dockerfile.multiarch --push . From 2fe099826de15b8ef774106f967604553fcffada Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Mon, 31 Jan 2022 18:23:08 +0000 Subject: [PATCH 31/88] login to acr --- .pipelines/azure_pipeline.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index d75ccd78a..dd66aa00d 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -24,9 +24,6 @@ steps: pwd ls -ltr - az --version - az account show - commit=$(git rev-parse --short HEAD) echo "##vso[task.setvariable variable=commitID;isOutput=true;]$commit" @@ -39,4 +36,9 @@ steps: 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 }} -f kubernetes/linux/Dockerfile.multiarch --push . From 129ac87c041ffc6d48f8d5b7541afad13bd6c602 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Mon, 31 Jan 2022 18:36:19 +0000 Subject: [PATCH 32/88] add script type --- .pipelines/azure_pipeline.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index dd66aa00d..afa6ab1d1 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -20,6 +20,7 @@ steps: inputs: azureSubscription: ${{ variables.armServiceConnectionName }} scriptType: bash + scriptLocation: inlineScript inlineScript: | pwd ls -ltr From 50687a99c76374cb817cc145bbd56cd7736cc450 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 12:23:44 +0000 Subject: [PATCH 33/88] try pushing to ame acr --- .pipelines/azure_pipeline.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index afa6ab1d1..e3eb042be 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -7,13 +7,13 @@ trigger: - ci_dev pool: - name: Azure-Pipelines-CI-Test-EO + name: Azure-Pipelines-CI-Prod-EO variables: - armServiceConnectionName: 'ci-1es-acr-connection' - subscription: '9b96ebbd-c57a-42d1-bbe9-b69296e4c7fb' - containerRegistry: 'amoltest' - repoImageName: '${{ variables.containerRegistry }}.azurecr.io/citest:multiarch' + armServiceConnectionName: 'ci-1es-acr-connection-prod' + subscription: '30c56c3a-54da-46ea-b004-06eb33432687' + containerRegistry: 'containerinsightsbuild' + repoImageName: '${{ variables.containerRegistry }}.azurecr.io/official/build' steps: - task: AzureCLI@2 @@ -42,4 +42,4 @@ steps: az account set -s ${{ variables.subscription }} az acr login -n ${{ variables.containerRegistry }} - docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }} -f kubernetes/linux/Dockerfile.multiarch --push . + docker buildx build --platform linux/amd64,linux/arm64 --tag '${{ variables.repoImageName }}:cidev-${{ variables.$datetime }}-${{ variables.commit }}' -f kubernetes/linux/Dockerfile.multiarch --push . From e54222d7dd8fa56ee4199b4951bda55cc47fdaef Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 12:26:40 +0000 Subject: [PATCH 34/88] fix variables --- .pipelines/azure_pipeline.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index e3eb042be..e16ffd811 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -26,10 +26,10 @@ steps: ls -ltr commit=$(git rev-parse --short HEAD) - echo "##vso[task.setvariable variable=commitID;isOutput=true;]$commit" + echo "##vso[task.setvariable variable=commitID;]$commit" datetime=$(date +'%Y%m%d%s') - echo "##vso[task.setvariable variable=datetime;isOutput=true;]$datetime" + echo "##vso[task.setvariable variable=datetime;]$datetime" 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 @@ -42,4 +42,5 @@ steps: az account set -s ${{ variables.subscription }} az acr login -n ${{ variables.containerRegistry }} - docker buildx build --platform linux/amd64,linux/arm64 --tag '${{ variables.repoImageName }}:cidev-${{ variables.$datetime }}-${{ variables.commit }}' -f kubernetes/linux/Dockerfile.multiarch --push . + docker buildx build --platform linux/amd64,linux/arm64 --tag '${{ variables.repoImageName }}:cidev-$(datetime)-$(commit)' -f kubernetes/linux/Dockerfile.multiarch --push . + From 1ceddab800cb1b5dcd9997b353f10525c470f629 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 16:34:27 +0000 Subject: [PATCH 35/88] fix tag --- .pipelines/azure_pipeline.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index e16ffd811..366e52129 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -42,5 +42,5 @@ steps: az account set -s ${{ variables.subscription }} az acr login -n ${{ variables.containerRegistry }} - docker buildx build --platform linux/amd64,linux/arm64 --tag '${{ variables.repoImageName }}:cidev-$(datetime)-$(commit)' -f kubernetes/linux/Dockerfile.multiarch --push . + docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:cidev-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --push . From e9269c4c5627aa22aea7d862d9aac416e53e4344 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 16:53:28 +0000 Subject: [PATCH 36/88] fix tag 2 --- .pipelines/azure_pipeline.yaml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index 366e52129..f727cbcc3 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -16,20 +16,19 @@ variables: repoImageName: '${{ variables.containerRegistry }}.azurecr.io/official/build' 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" + - task: AzureCLI@2 inputs: azureSubscription: ${{ variables.armServiceConnectionName }} scriptType: bash scriptLocation: inlineScript inlineScript: | - pwd - ls -ltr - - commit=$(git rev-parse --short HEAD) - echo "##vso[task.setvariable variable=commitID;]$commit" - - datetime=$(date +'%Y%m%d%s') - echo "##vso[task.setvariable variable=datetime;]$datetime" 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 From 4598d87609c8c47b2a0c8cb224a5a679fb0cabe0 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 17:57:08 +0000 Subject: [PATCH 37/88] change pipelines --- .pipelines/azure_pipeline.yaml | 4 +-- .pipelines/azure_pipeline_dev.yaml | 45 +++++++++++++++++++++++++++++ .pipelines/azure_pipeline_prod.yaml | 45 +++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 .pipelines/azure_pipeline_dev.yaml create mode 100644 .pipelines/azure_pipeline_prod.yaml diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index f727cbcc3..77ef1b1da 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -4,7 +4,7 @@ # https://aka.ms/yaml trigger: -- ci_dev +- ci_prod pool: name: Azure-Pipelines-CI-Prod-EO @@ -41,5 +41,5 @@ steps: az account set -s ${{ variables.subscription }} az acr login -n ${{ variables.containerRegistry }} - docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:cidev-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --push . + docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:ciprod-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --push . diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml new file mode 100644 index 000000000..471df955a --- /dev/null +++ b/.pipelines/azure_pipeline_dev.yaml @@ -0,0 +1,45 @@ +# 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" + +- 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 --push . + diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml new file mode 100644 index 000000000..f727cbcc3 --- /dev/null +++ b/.pipelines/azure_pipeline_prod.yaml @@ -0,0 +1,45 @@ +# 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-Prod-EO + +variables: + armServiceConnectionName: 'ci-1es-acr-connection-prod' + subscription: '30c56c3a-54da-46ea-b004-06eb33432687' + containerRegistry: 'containerinsightsbuild' + repoImageName: '${{ variables.containerRegistry }}.azurecr.io/official/build' + +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" + +- 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 }}:cidev-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --push . + From 26128fa7a9d52042fd647ac0789e8511165d6e63 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 17:58:06 +0000 Subject: [PATCH 38/88] remove extra file --- .pipelines/azure_pipeline.yaml | 45 ---------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 .pipelines/azure_pipeline.yaml diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml deleted file mode 100644 index 77ef1b1da..000000000 --- a/.pipelines/azure_pipeline.yaml +++ /dev/null @@ -1,45 +0,0 @@ -# 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/build' - -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" - -- 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 --push . - From a0e8fa9b085f4a60e1a403b34de05915d9faa916 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 18:32:48 +0000 Subject: [PATCH 39/88] missing changes --- .pipelines/azure_pipeline_prod.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml index f727cbcc3..77ef1b1da 100644 --- a/.pipelines/azure_pipeline_prod.yaml +++ b/.pipelines/azure_pipeline_prod.yaml @@ -4,7 +4,7 @@ # https://aka.ms/yaml trigger: -- ci_dev +- ci_prod pool: name: Azure-Pipelines-CI-Prod-EO @@ -41,5 +41,5 @@ steps: az account set -s ${{ variables.subscription }} az acr login -n ${{ variables.containerRegistry }} - docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:cidev-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --push . + docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:ciprod-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --push . From a741a46c60135477aeb0b4c328fafc1da676cd92 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 19:47:48 +0000 Subject: [PATCH 40/88] save metadata --- .pipelines/azure_pipeline_dev.yaml | 6 +++++- .pipelines/azure_pipeline_prod.yaml | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml index 471df955a..e730c9c38 100644 --- a/.pipelines/azure_pipeline_dev.yaml +++ b/.pipelines/azure_pipeline_dev.yaml @@ -41,5 +41,9 @@ steps: 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 --push . + docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --metadata-file $(Build.ArtifactStagingDirectory)/metadata.json --push . +- task: PublishBuildArtifacts@1 + inputs: + pathToPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: drop diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml index 77ef1b1da..d2d5f498c 100644 --- a/.pipelines/azure_pipeline_prod.yaml +++ b/.pipelines/azure_pipeline_prod.yaml @@ -41,5 +41,9 @@ steps: 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 --push . + 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 --push . +- task: PublishBuildArtifacts@1 + inputs: + pathToPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: drop \ No newline at end of file From d35d5c439afbf49d0e3cb6802b5bedf80b135981 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Wed, 2 Feb 2022 21:03:54 +0000 Subject: [PATCH 41/88] update pipelines --- .pipelines/azure_pipeline_dev.yaml | 8 ++++++++ .pipelines/azure_pipeline_prod.yaml | 8 ++++++++ source/plugins/ruby/in_kube_nodes.rb | 3 +++ 3 files changed, 19 insertions(+) diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml index e730c9c38..040839756 100644 --- a/.pipelines/azure_pipeline_dev.yaml +++ b/.pipelines/azure_pipeline_dev.yaml @@ -43,6 +43,14 @@ steps: docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --metadata-file $(Build.ArtifactStagingDirectory)/metadata.json --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)' diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml index d2d5f498c..e1c758875 100644 --- a/.pipelines/azure_pipeline_prod.yaml +++ b/.pipelines/azure_pipeline_prod.yaml @@ -43,6 +43,14 @@ steps: 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 --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)' diff --git a/source/plugins/ruby/in_kube_nodes.rb b/source/plugins/ruby/in_kube_nodes.rb index abbfe94a1..5a52a089b 100644 --- a/source/plugins/ruby/in_kube_nodes.rb +++ b/source/plugins/ruby/in_kube_nodes.rb @@ -560,6 +560,9 @@ def getNodeTelemetryProps(item) properties["OperatingSystem"] = nodeInfo["operatingSystem"] properties["KernelVersion"] = nodeInfo["kernelVersion"] properties["OSImage"] = nodeInfo["osImage"] + if nodeInfo["architecture"] == "arm64" + properties["Architecture"] = nodeInfo["architecture"] + end containerRuntimeVersion = nodeInfo["containerRuntimeVersion"] if containerRuntimeVersion.downcase.start_with?("docker://") properties["DockerVersion"] = containerRuntimeVersion.split("//")[1] From 27000a67c4fb72ddf00fa4c3c96050e02cd651c6 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Thu, 3 Feb 2022 14:00:43 +0000 Subject: [PATCH 42/88] revert official mdsd arm64 build --- kubernetes/linux/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index a507e1dfc..25cb2e9c2 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -17,7 +17,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ #install oneagent - Official bits (10/7/2021) if [ "${ARCH}" != "arm64" ]; then - wget "https://adme2epublic.blob.core.windows.net/privatefiles/azure-mdsd_1.16.0-build.dev_x86_64.deb?sp=r&st=2022-01-26T13:42:36Z&se=2022-02-24T21:42:36Z&spr=https&sv=2020-08-04&sr=b&sig=OTJREpVZsMp8WXYGpM7CMHa%2Fp22ztbWmikvmMSjX3xA%3D" -O azure-mdsd.deb + wget https://github.com/microsoft/Docker-Provider/releases/download/1.14/azure-mdsd_1.14.2-build.master.284_x86_64.deb -O azure-mdsd.deb else wget "https://adme2epublic.blob.core.windows.net/privatefiles/azure-mdsd_1.15.0-build.dev_aarch64_3.deb?sp=r&st=2022-01-26T13:41:51Z&se=2022-02-24T21:41:51Z&spr=https&sv=2020-08-04&sr=b&sig=uW2MnQ%2F8mUtq4gMb78SaY5AnqsRlk6UQEPo469fafGo%3D" -O azure-mdsd.deb fi From 43fb6a53fd90b26bf5af24cdc244497c85d88cd2 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Thu, 3 Feb 2022 14:07:58 +0000 Subject: [PATCH 43/88] add build_arg image_tag --- .pipelines/azure_pipeline_dev.yaml | 2 +- .pipelines/azure_pipeline_prod.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml index 040839756..ab740de7f 100644 --- a/.pipelines/azure_pipeline_dev.yaml +++ b/.pipelines/azure_pipeline_dev.yaml @@ -41,7 +41,7 @@ steps: 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 --push . + 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) diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml index e1c758875..fa0fcafc6 100644 --- a/.pipelines/azure_pipeline_prod.yaml +++ b/.pipelines/azure_pipeline_prod.yaml @@ -41,7 +41,7 @@ steps: 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 --push . + 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) From b3aee21e9f89601811d35ded54aa5d567a1d1372 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Fri, 11 Feb 2022 18:17:27 +0000 Subject: [PATCH 44/88] use new arm64 version --- kubernetes/linux/main.sh | 6 ++++++ kubernetes/linux/setup.sh | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/kubernetes/linux/main.sh b/kubernetes/linux/main.sh index b905311aa..9f68b6fdc 100644 --- a/kubernetes/linux/main.sh +++ b/kubernetes/linux/main.sh @@ -563,6 +563,12 @@ else echo "export CIWORKSPACE_keyFile=$CIWORKSPACE_keyFile" >> ~/.bashrc export MDSD_FLUENT_SOCKET_PORT="29230" echo "export MDSD_FLUENT_SOCKET_PORT=$MDSD_FLUENT_SOCKET_PORT" >> ~/.bashrc + export ENABLE_CURL_UPLOAD=true + echo "export ENABLE_CURL_UPLOAD=$ENABLE_CURL_UPLOAD" >> ~/.bashrc + export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt + echo "export CURL_CA_BUNDLE=$CURL_CA_BUNDLE" >> ~/.bashrc + mkdir -p /etc/pki/tls/certs + cp /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt fi source ~/.bashrc diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 25cb2e9c2..58c167f46 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -19,7 +19,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ if [ "${ARCH}" != "arm64" ]; then wget https://github.com/microsoft/Docker-Provider/releases/download/1.14/azure-mdsd_1.14.2-build.master.284_x86_64.deb -O azure-mdsd.deb else - wget "https://adme2epublic.blob.core.windows.net/privatefiles/azure-mdsd_1.15.0-build.dev_aarch64_3.deb?sp=r&st=2022-01-26T13:41:51Z&se=2022-02-24T21:41:51Z&spr=https&sv=2020-08-04&sr=b&sig=uW2MnQ%2F8mUtq4gMb78SaY5AnqsRlk6UQEPo469fafGo%3D" -O azure-mdsd.deb + wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2693_aarch64.deb" -O azure-mdsd.deb fi /usr/bin/dpkg -i $TMPDIR/azure-mdsd*.deb From ffee912a50f9198e2894e7efc650e8c64f42b51b Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Mon, 14 Feb 2022 12:38:47 +0000 Subject: [PATCH 45/88] update arm build --- kubernetes/linux/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 58c167f46..237535ce0 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -19,7 +19,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ if [ "${ARCH}" != "arm64" ]; then wget https://github.com/microsoft/Docker-Provider/releases/download/1.14/azure-mdsd_1.14.2-build.master.284_x86_64.deb -O azure-mdsd.deb else - wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2693_aarch64.deb" -O azure-mdsd.deb + wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2702_aarch64.deb" -O azure-mdsd.deb fi /usr/bin/dpkg -i $TMPDIR/azure-mdsd*.deb From 8bf832ab452470b3d36b4fd018888d380dc39849 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 15 Feb 2022 12:03:50 +0000 Subject: [PATCH 46/88] update amd build --- kubernetes/linux/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 237535ce0..bcb089b6e 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -17,7 +17,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ #install oneagent - Official bits (10/7/2021) if [ "${ARCH}" != "arm64" ]; then - wget https://github.com/microsoft/Docker-Provider/releases/download/1.14/azure-mdsd_1.14.2-build.master.284_x86_64.deb -O azure-mdsd.deb + wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2706_x86_64.deb" -O azure-mdsd.deb else wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2702_aarch64.deb" -O azure-mdsd.deb fi From 4449bdaeee775517ed20153fc639e8bab18d9ed0 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 22 Feb 2022 19:09:12 +0000 Subject: [PATCH 47/88] update arm build --- kubernetes/linux/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index bcb089b6e..2ebd8d658 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -19,7 +19,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ if [ "${ARCH}" != "arm64" ]; then wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2706_x86_64.deb" -O azure-mdsd.deb else - wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2702_aarch64.deb" -O azure-mdsd.deb + wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2717_aarch64.deb" -O azure-mdsd.deb fi /usr/bin/dpkg -i $TMPDIR/azure-mdsd*.deb From 4c0bd4c60b4f62dbbf806fc3fed259e5face5103 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Wed, 23 Feb 2022 18:56:44 +0000 Subject: [PATCH 48/88] use new amd64 master build for mdsd --- kubernetes/linux/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 2ebd8d658..7e8133744 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -17,7 +17,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ #install oneagent - Official bits (10/7/2021) if [ "${ARCH}" != "arm64" ]; then - wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2706_x86_64.deb" -O azure-mdsd.deb + wget "https://github.com/microsoft/Docker-Provider/releases/download/1.17.0/azure-mdsd_1.17.0-build.master.354_x86_64.deb" -O azure-mdsd.deb else wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2717_aarch64.deb" -O azure-mdsd.deb fi From 21604adc290b7b08bf2a299bbfb80077281b4bcd Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Wed, 23 Feb 2022 19:15:29 +0000 Subject: [PATCH 49/88] update golang to 1.15 in dockerfile --- kubernetes/linux/Dockerfile.multiarch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/Dockerfile.multiarch b/kubernetes/linux/Dockerfile.multiarch index 9dfeacc4d..28c305f3d 100644 --- a/kubernetes/linux/Dockerfile.multiarch +++ b/kubernetes/linux/Dockerfile.multiarch @@ -1,4 +1,4 @@ -FROM --platform=$BUILDPLATFORM golang:1.14 AS builder +FROM --platform=$BUILDPLATFORM golang:1.15 AS builder ARG TARGETOS TARGETARCH RUN /usr/bin/apt-get update && /usr/bin/apt-get install git g++ make pkg-config libssl-dev libpam0g-dev rpm librpm-dev uuid-dev libkrb5-dev python sudo gcc-aarch64-linux-gnu -y From 748dcf713b9fa712d65bc00cf6a946ce6b72bd5f Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Mon, 28 Feb 2022 18:17:52 +0000 Subject: [PATCH 50/88] use releases url --- kubernetes/linux/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 7e8133744..9619ea39e 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -19,7 +19,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ if [ "${ARCH}" != "arm64" ]; then wget "https://github.com/microsoft/Docker-Provider/releases/download/1.17.0/azure-mdsd_1.17.0-build.master.354_x86_64.deb" -O azure-mdsd.deb else - wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2717_aarch64.deb" -O azure-mdsd.deb + wget "https://github.com/microsoft/Docker-Provider/releases/download/1.17.0-arm64-dev/azure-mdsd_1.17.0-build.develop.2717_aarch64.deb" -O azure-mdsd.deb fi /usr/bin/dpkg -i $TMPDIR/azure-mdsd*.deb From 614d90c3600960a8579aa4d3c66a61ea711001c5 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Thu, 27 Jan 2022 15:39:27 +0000 Subject: [PATCH 51/88] build multi-arch images --- README.md | 19 +++++++++ build/linux/Makefile | 24 +++++------- kubernetes/linux/Dockerfile | 2 +- kubernetes/linux/Dockerfile.multiarch | 39 +++++++++++++++++++ .../build-and-publish-docker-image.sh | 16 +++++++- kubernetes/linux/main.sh | 20 +++++----- kubernetes/linux/setup.sh | 28 ++++++++----- .../linux/install-build-pre-requisites.sh | 19 +++++++++ source/plugins/go/src/Makefile | 12 +++++- 9 files changed, 143 insertions(+), 36 deletions(-) create mode 100644 kubernetes/linux/Dockerfile.multiarch diff --git a/README.md b/README.md index 7d42c75d6..f0fa40e53 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,25 @@ bash build-and-publish-docker-image.sh --image /: ``` > Note: format of the imagetag will be `ci`. 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 ` +# build and publish using docker buildx +bash build-and-publish-docker-image.sh --image /: --multiarch +``` + +or directly use the docker buildx commands +``` +# multiple platforms +cd ~/Docker-Provider +docker buildx build --platform linux/arm64/v8,linux/amd64 -t /: --build-arg IMAGE_TAG= -f kubernetes/linux/Dockerfile.multiarch --push . + +# single platform +cd ~/Docker-Provider +docker buildx build --platform linux/amd64 -t /: --build-arg IMAGE_TAG= -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 diff --git a/build/linux/Makefile b/build/linux/Makefile index 3f35e1204..9203f1d73 100644 --- a/build/linux/Makefile +++ b/build/linux/Makefile @@ -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 @@ -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) #-------------------------------------------------------------------------------- @@ -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 : @@ -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 diff --git a/kubernetes/linux/Dockerfile b/kubernetes/linux/Dockerfile index f3a9efd7a..b32538799 100644 --- a/kubernetes/linux/Dockerfile +++ b/kubernetes/linux/Dockerfile @@ -23,7 +23,7 @@ ENV AGENT_VERSION ${IMAGE_TAG} WORKDIR ${tmpdir} # copy docker provider shell bundle to use the agent image -COPY ./Linux_ULINUX_1.0_x64_64_Release/docker-cimprov-*.*.*-*.x86_64.sh . +COPY ./Linux_ULINUX_1.0_*_64_Release/docker-cimprov-*.*.*-*.*.*.sh . # Note: If you prefer remote destination, uncomment below line and comment above line # wget https://github.com/microsoft/Docker-Provider/releases/download/10.0.0-1/docker-cimprov-10.0.0-1.universal.x86_64.sh diff --git a/kubernetes/linux/Dockerfile.multiarch b/kubernetes/linux/Dockerfile.multiarch new file mode 100644 index 000000000..9dfeacc4d --- /dev/null +++ b/kubernetes/linux/Dockerfile.multiarch @@ -0,0 +1,39 @@ +FROM --platform=$BUILDPLATFORM golang:1.14 AS builder +ARG TARGETOS TARGETARCH +RUN /usr/bin/apt-get update && /usr/bin/apt-get install git g++ make pkg-config libssl-dev libpam0g-dev rpm librpm-dev uuid-dev libkrb5-dev python sudo gcc-aarch64-linux-gnu -y + +COPY build /src/build +COPY source /src/source +RUN cd /src/build/linux && make arch=${TARGETARCH} + + +FROM ubuntu:18.04 AS base_image +ARG TARGETOS TARGETARCH +MAINTAINER OMSContainers@microsoft.com +LABEL vendor=Microsoft\ Corp \ + com.microsoft.product="Azure Monitor for containers" +ENV tmpdir /opt +ENV APPLICATIONINSIGHTS_AUTH NzAwZGM5OGYtYTdhZC00NThkLWI5NWMtMjA3ZjM3NmM3YmRi +ENV MALLOC_ARENA_MAX 2 +ENV HOST_MOUNT_PREFIX /hostfs +ENV HOST_PROC /hostfs/proc +ENV HOST_SYS /hostfs/sys +ENV HOST_ETC /hostfs/etc +ENV HOST_VAR /hostfs/var +ENV AZMON_COLLECT_ENV False +ENV KUBE_CLIENT_BACKOFF_BASE 1 +ENV KUBE_CLIENT_BACKOFF_DURATION 0 +ENV RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR 0.9 +RUN /usr/bin/apt-get update && /usr/bin/apt-get install -y libc-bin wget openssl curl sudo python python-ctypes init-system-helpers net-tools rsyslog cron vim dmidecode apt-transport-https gnupg make && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /src/kubernetes/linux/Linux_ULINUX_1.0_*_64_Release/docker-cimprov-*.*.*-*.*.sh $tmpdir/ +COPY kubernetes/linux/setup.sh kubernetes/linux/main.sh kubernetes/linux/defaultpromenvvariables kubernetes/linux/defaultpromenvvariables-rs kubernetes/linux/defaultpromenvvariables-sidecar kubernetes/linux/mdsd.xml kubernetes/linux/envmdsd kubernetes/linux/logrotate.conf $tmpdir/ + +ARG IMAGE_TAG=ciprod10132021 +ENV AGENT_VERSION ${IMAGE_TAG} + +WORKDIR ${tmpdir} + +RUN chmod 775 $tmpdir/*.sh; sync; $tmpdir/setup.sh ${TARGETARCH} +CMD [ "/opt/main.sh" ] + diff --git a/kubernetes/linux/dockerbuild/build-and-publish-docker-image.sh b/kubernetes/linux/dockerbuild/build-and-publish-docker-image.sh index 267f15f32..580b158c9 100755 --- a/kubernetes/linux/dockerbuild/build-and-publish-docker-image.sh +++ b/kubernetes/linux/dockerbuild/build-and-publish-docker-image.sh @@ -14,6 +14,7 @@ usage() echo echo "Build and publish docker image:" echo "$basename --image " + echo "$basename --image --multiarch" } parse_args() @@ -30,6 +31,7 @@ for arg in "$@"; do shift case "$arg" in "--image") set -- "$@" "-i" ;; + "--multiarch") set -- "$@" "-m" ;; "--"*) usage ;; *) set -- "$@" "$arg" esac @@ -37,7 +39,7 @@ done local OPTIND opt -while getopts 'hi:' opt; do +while getopts 'hi:m' opt; do case "$opt" in h) usage @@ -48,6 +50,11 @@ while getopts 'hi:' opt; do echo "image is $OPTARG" ;; + m) + multi=1 + echo "using multiarch dockerfile" + ;; + ?) usage exit 1 @@ -131,6 +138,13 @@ echo "source code base directory: $baseDir" echo "build directory for docker provider: $buildDir" echo "docker file directory: $dockerFileDir" +if [ "$multi" -eq "1" ]; then + echo "building multiarch" + cd $baseDir + docker buildx build --platform linux/arm64/v8,linux/amd64 -t $image --build-arg IMAGE_TAG=$imageTag -f $linuxDir/Dockerfile.multiarch --push . + exit 0 +fi + # build docker provider shell bundle build_docker_provider diff --git a/kubernetes/linux/main.sh b/kubernetes/linux/main.sh index 980c15586..b905311aa 100644 --- a/kubernetes/linux/main.sh +++ b/kubernetes/linux/main.sh @@ -311,7 +311,7 @@ source ~/.bashrc if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ]; then #Parse the configmap to set the right environment variables. - /usr/bin/ruby2.6 tomlparser.rb + /usr/bin/ruby2.7 tomlparser.rb cat config_env_var | while read line; do echo $line >> ~/.bashrc @@ -322,7 +322,7 @@ fi #Parse the configmap to set the right environment variables for agent config. #Note > tomlparser-agent-config.rb has to be parsed first before td-agent-bit-conf-customizer.rb for fbit agent settings if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ]; then - /usr/bin/ruby2.6 tomlparser-agent-config.rb + /usr/bin/ruby2.7 tomlparser-agent-config.rb cat agent_config_env_var | while read line; do #echo $line @@ -331,7 +331,7 @@ if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ]; then source agent_config_env_var #Parse the configmap to set the right environment variables for network policy manager (npm) integration. - /usr/bin/ruby2.6 tomlparser-npm-config.rb + /usr/bin/ruby2.7 tomlparser-npm-config.rb cat integration_npm_config_env_var | while read line; do #echo $line @@ -342,11 +342,11 @@ fi #Replace the placeholders in td-agent-bit.conf file for fluentbit with custom/default values in daemonset if [ ! -e "/etc/config/kube.conf" ] && [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ]; then - /usr/bin/ruby2.6 td-agent-bit-conf-customizer.rb + /usr/bin/ruby2.7 td-agent-bit-conf-customizer.rb fi #Parse the prometheus configmap to create a file with new custom settings. -/usr/bin/ruby2.6 tomlparser-prom-customconfig.rb +/usr/bin/ruby2.7 tomlparser-prom-customconfig.rb #Setting default environment variables to be used in any case of failure in the above steps if [ ! -e "/etc/config/kube.conf" ]; then @@ -380,7 +380,7 @@ fi if [ ! -e "/etc/config/kube.conf" ]; then if [ "${CONTAINER_TYPE}" == "PrometheusSidecar" ]; then #Parse the agent configmap to create a file with new custom settings. - /usr/bin/ruby2.6 tomlparser-prom-agent-config.rb + /usr/bin/ruby2.7 tomlparser-prom-agent-config.rb #Sourcing config environment variable file if it exists if [ -e "side_car_fbit_config_env_var" ]; then cat side_car_fbit_config_env_var | while read line; do @@ -394,7 +394,7 @@ fi #Parse the configmap to set the right environment variables for MDM metrics configuration for Alerting. if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ]; then - /usr/bin/ruby2.6 tomlparser-mdm-metrics-config.rb + /usr/bin/ruby2.7 tomlparser-mdm-metrics-config.rb cat config_mdm_metrics_env_var | while read line; do echo $line >> ~/.bashrc @@ -402,7 +402,7 @@ if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ]; then source config_mdm_metrics_env_var #Parse the configmap to set the right environment variables for metric collection settings - /usr/bin/ruby2.6 tomlparser-metric-collection-config.rb + /usr/bin/ruby2.7 tomlparser-metric-collection-config.rb cat config_metric_collection_env_var | while read line; do echo $line >> ~/.bashrc @@ -413,7 +413,7 @@ fi # OSM scraping to be done in replicaset if sidecar car scraping is disabled and always do the scraping from the sidecar (It will always be either one of the two) if [[ ( ( ! -e "/etc/config/kube.conf" ) && ( "${CONTAINER_TYPE}" == "PrometheusSidecar" ) ) || ( ( -e "/etc/config/kube.conf" ) && ( "${SIDECAR_SCRAPING_ENABLED}" == "false" ) ) ]]; then - /usr/bin/ruby2.6 tomlparser-osm-config.rb + /usr/bin/ruby2.7 tomlparser-osm-config.rb if [ -e "integration_osm_config_env_var" ]; then cat integration_osm_config_env_var | while read line; do @@ -500,7 +500,7 @@ if [ "$CONTAINER_RUNTIME" != "docker" ]; then fi echo "set caps for ruby process to read container env from proc" -sudo setcap cap_sys_ptrace,cap_dac_read_search+ep /usr/bin/ruby2.6 +sudo setcap cap_sys_ptrace,cap_dac_read_search+ep /usr/bin/ruby2.7 echo "export KUBELET_RUNTIME_OPERATIONS_METRIC="$KUBELET_RUNTIME_OPERATIONS_METRIC >> ~/.bashrc echo "export KUBELET_RUNTIME_OPERATIONS_ERRORS_METRIC="$KUBELET_RUNTIME_OPERATIONS_ERRORS_METRIC >> ~/.bashrc diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index f18e372cd..410f9e421 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -1,6 +1,12 @@ TMPDIR="/opt" cd $TMPDIR +if [ -z $1 ]; then + ARCH="amd64" +else + ARCH=$1 +fi + #Download utf-8 encoding capability on the omsagent container. #upgrade apt to latest version apt-get update && apt-get install -y apt && DEBIAN_FRONTEND=noninteractive apt-get install -y locales @@ -10,13 +16,17 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ update-locale LANG=en_US.UTF-8 #install oneagent - Official bits (10/7/2021) -wget https://github.com/microsoft/Docker-Provider/releases/download/1.14/azure-mdsd_1.14.2-build.master.284_x86_64.deb +if [ "${ARCH}" != "arm64" ]; then + wget "https://adme2epublic.blob.core.windows.net/privatefiles/azure-mdsd_1.16.0-build.dev_x86_64.deb?sp=r&st=2022-01-26T13:42:36Z&se=2022-02-24T21:42:36Z&spr=https&sv=2020-08-04&sr=b&sig=OTJREpVZsMp8WXYGpM7CMHa%2Fp22ztbWmikvmMSjX3xA%3D" -O azure-mdsd.deb +else + wget "https://adme2epublic.blob.core.windows.net/privatefiles/azure-mdsd_1.15.0-build.dev_aarch64_3.deb?sp=r&st=2022-01-26T13:41:51Z&se=2022-02-24T21:41:51Z&spr=https&sv=2020-08-04&sr=b&sig=uW2MnQ%2F8mUtq4gMb78SaY5AnqsRlk6UQEPo469fafGo%3D" -O azure-mdsd.deb +fi /usr/bin/dpkg -i $TMPDIR/azure-mdsd*.deb cp -f $TMPDIR/mdsd.xml /etc/mdsd.d cp -f $TMPDIR/envmdsd /etc/mdsd.d -#log rotate conf for mdsd and can be extended for other log files as well +# log rotate conf for mdsd and can be extended for other log files as well cp -f $TMPDIR/logrotate.conf /etc/logrotate.d/ci-agent #download inotify tools for watching configmap changes @@ -30,27 +40,27 @@ sudo apt-get install jq=1.5+dfsg-2 -y #used to setcaps for ruby process to read /proc/env sudo apt-get install libcap2-bin -y -wget https://dl.influxdata.com/telegraf/releases/telegraf-1.20.3_linux_amd64.tar.gz -tar -zxvf telegraf-1.20.3_linux_amd64.tar.gz +wget https://dl.influxdata.com/telegraf/releases/telegraf-1.20.3_linux_$ARCH.tar.gz +tar -zxvf telegraf-1.20.3_linux_$ARCH.tar.gz mv /opt/telegraf-1.20.3/usr/bin/telegraf /opt/telegraf chmod 544 /opt/telegraf # Use wildcard version so that it doesnt require to touch this file -/$TMPDIR/docker-cimprov-*.*.*-*.x86_64.sh --install +/$TMPDIR/docker-cimprov-*.*.*-*.*.sh --install #download and install fluent-bit(td-agent-bit) wget -qO - https://packages.fluentbit.io/fluentbit.key | sudo apt-key add - -sudo echo "deb https://packages.fluentbit.io/ubuntu/xenial xenial main" >> /etc/apt/sources.list +sudo echo "deb https://packages.fluentbit.io/ubuntu/bionic bionic main" >> /etc/apt/sources.list sudo apt-get update sudo apt-get install td-agent-bit=1.7.8 -y -# install ruby2.6 +# install ruby2.7 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F5DA5F09C3173AA6 sudo echo "deb http://ppa.launchpad.net/brightbox/ruby-ng/ubuntu bionic main" >> /etc/apt/sources.list sudo apt-get update -sudo apt-get install ruby2.6 ruby2.6-dev gcc make -y +sudo apt-get install ruby2.7 ruby2.7-dev gcc make -y # fluentd v1 gem gem install fluentd -v "1.14.2" --no-document fluentd --setup ./fluent @@ -64,7 +74,7 @@ rm -f $TMPDIR/envmdsd rm -f $TMPDIR/telegraf-*.tar.gz # remove build dependencies -sudo apt-get remove ruby2.6-dev gcc make -y +sudo apt-get remove ruby2.7-dev gcc make -y # Remove settings for cron.daily that conflict with the node's cron.daily. Since both are trying to rotate the same files # in /var/log at the same time, the rotation doesn't happen correctly and then the *.1 file is forever logged to. diff --git a/scripts/build/linux/install-build-pre-requisites.sh b/scripts/build/linux/install-build-pre-requisites.sh index 7959b37e8..b85e54fc4 100644 --- a/scripts/build/linux/install-build-pre-requisites.sh +++ b/scripts/build/linux/install-build-pre-requisites.sh @@ -58,10 +58,26 @@ install_docker() sudo apt-get install docker-ce docker-ce-cli containerd.io -y # Allow your user to access the Docker CLI without needing root access. sudo usermod -aG docker $USER + newgrp docker echo "installing docker completed" fi } +install_docker_buildx() +{ + # install the buildx plugin + sudo curl -O https://github.com/docker/buildx/releases/download/v0.7.1/buildx-v0.7.1.linux-amd64 + sudo mkdir -p $HOME/.docker/cli-plugins + sudo mv buildx-v* $HOME/.docker/cli-plugins + + # install the emulator support + 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 +} + install_python() { echo "installing python ..." @@ -125,6 +141,9 @@ install_build_dependencies # install docker install_docker +# install buildx +install_docker_buildx + # install go install_go_lang diff --git a/source/plugins/go/src/Makefile b/source/plugins/go/src/Makefile index b3b730d79..f9488bc8e 100644 --- a/source/plugins/go/src/Makefile +++ b/source/plugins/go/src/Makefile @@ -1,6 +1,16 @@ BASE_DIR := $(subst /build/linux,,$(PWD)) include $(BASE_DIR)/build/version +ifeq ($(arch),) + PF_ARCH=amd64 +else + PF_ARCH=$(arch) +endif + +ifneq ($(PF_ARCH),amd64) + OPTIONS=CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc GOOS=linux GOARCH=arm64 +endif + fbplugin: @echo "========================= Building out_oms plugin go code =========================" export BUILDVERSION=$(CONTAINER_BUILDVERSION_MAJOR).$(CONTAINER_BUILDVERSION_MINOR).$(CONTAINER_BUILDVERSION_PATCH)-$(CONTAINER_BUILDVERSION_BUILDNR) @@ -12,7 +22,7 @@ fbplugin: @echo "========================= go get =========================" go get @echo "========================= go build =========================" - go build -ldflags "-X 'main.revision=$(BUILDVERSION)' -X 'main.builddate=$(BUILDDATE)'" -buildmode=c-shared -o out_oms.so . + $(OPTIONS) go build -ldflags "-X 'main.revision=$(BUILDVERSION)' -X 'main.builddate=$(BUILDDATE)'" -buildmode=c-shared -o out_oms.so . test: go test -cover -race -coverprofile=coverage.txt -covermode=atomic From a1d870aae7c8bd5e607390bbb47217adcce61290 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Fri, 28 Jan 2022 18:54:11 +0000 Subject: [PATCH 52/88] add test pipeline yaml --- .pipelines/azure_pipeline.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .pipelines/azure_pipeline.yaml diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml new file mode 100644 index 000000000..e1e541565 --- /dev/null +++ b/.pipelines/azure_pipeline.yaml @@ -0,0 +1,19 @@ +# 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: + vmImage: ubuntu-latest + +steps: +- script: echo Hello, world! + displayName: 'Run a one-line script' + +- script: | + echo Add other tasks to build, test, and deploy your project. + echo See https://aka.ms/yaml + displayName: 'Run a multi-line script' From 64294229f194c1ef44207916934dadf9ee4b4a6a Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Fri, 28 Jan 2022 19:01:31 +0000 Subject: [PATCH 53/88] use 1es pool --- .pipelines/azure_pipeline.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index e1e541565..c3d6aaeec 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -7,7 +7,8 @@ trigger: - ci_dev pool: - vmImage: ubuntu-latest + name: Azure-Pipelines-CI-Test-EO + steps: - script: echo Hello, world! From a3c758ed263c433a525a96745e9776faeae8b203 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Fri, 28 Jan 2022 20:30:23 +0000 Subject: [PATCH 54/88] try to build --- .pipelines/azure_pipeline.yaml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index c3d6aaeec..aa0210aab 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -11,10 +11,20 @@ pool: steps: -- script: echo Hello, world! - displayName: 'Run a one-line script' - - script: | - echo Add other tasks to build, test, and deploy your project. - echo See https://aka.ms/yaml - displayName: 'Run a multi-line script' + pwd + ls -ltr + + commit=$(git rev-parse --short HEAD) + echo "##vso[task.setvariable variable=commitID;isOutput=true;]$commit" + + datetime=$(date +'%Y%m%d%s') + echo "##vso[task.setvariable variable=datetime;isOutput=true;]$datetime" + + 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 + + docker buildx build --platform linux/amd64,linux/arm64 --tag amoltest/test:testtag -f kubernetes/linux/Dockerfile.multiarch . From 3a9c1b33928de7f789ce16a7449b3e2934643489 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Mon, 31 Jan 2022 18:17:01 +0000 Subject: [PATCH 55/88] test push --- .pipelines/azure_pipeline.yaml | 36 ++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index aa0210aab..d75ccd78a 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -9,22 +9,34 @@ trigger: pool: name: Azure-Pipelines-CI-Test-EO +variables: + armServiceConnectionName: 'ci-1es-acr-connection' + subscription: '9b96ebbd-c57a-42d1-bbe9-b69296e4c7fb' + containerRegistry: 'amoltest' + repoImageName: '${{ variables.containerRegistry }}.azurecr.io/citest:multiarch' steps: -- script: | - pwd - ls -ltr +- task: AzureCLI@2 + inputs: + azureSubscription: ${{ variables.armServiceConnectionName }} + scriptType: bash + inlineScript: | + pwd + ls -ltr - commit=$(git rev-parse --short HEAD) - echo "##vso[task.setvariable variable=commitID;isOutput=true;]$commit" + az --version + az account show - datetime=$(date +'%Y%m%d%s') - echo "##vso[task.setvariable variable=datetime;isOutput=true;]$datetime" + commit=$(git rev-parse --short HEAD) + echo "##vso[task.setvariable variable=commitID;isOutput=true;]$commit" - 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 + datetime=$(date +'%Y%m%d%s') + echo "##vso[task.setvariable variable=datetime;isOutput=true;]$datetime" - docker buildx create --name testbuilder - docker buildx use testbuilder + 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 build --platform linux/amd64,linux/arm64 --tag amoltest/test:testtag -f kubernetes/linux/Dockerfile.multiarch . + docker buildx create --name testbuilder + docker buildx use testbuilder + + docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }} -f kubernetes/linux/Dockerfile.multiarch --push . From 9c115c0636c2926d1314ee5bace436e672666da6 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Mon, 31 Jan 2022 18:23:08 +0000 Subject: [PATCH 56/88] login to acr --- .pipelines/azure_pipeline.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index d75ccd78a..dd66aa00d 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -24,9 +24,6 @@ steps: pwd ls -ltr - az --version - az account show - commit=$(git rev-parse --short HEAD) echo "##vso[task.setvariable variable=commitID;isOutput=true;]$commit" @@ -39,4 +36,9 @@ steps: 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 }} -f kubernetes/linux/Dockerfile.multiarch --push . From 73692e3968ee35c39f6f9222d15de475ddc681aa Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Mon, 31 Jan 2022 18:36:19 +0000 Subject: [PATCH 57/88] add script type --- .pipelines/azure_pipeline.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index dd66aa00d..afa6ab1d1 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -20,6 +20,7 @@ steps: inputs: azureSubscription: ${{ variables.armServiceConnectionName }} scriptType: bash + scriptLocation: inlineScript inlineScript: | pwd ls -ltr From 4d35ddbb2347684eab32ec9342253ed1b21ea898 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 12:23:44 +0000 Subject: [PATCH 58/88] try pushing to ame acr --- .pipelines/azure_pipeline.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index afa6ab1d1..e3eb042be 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -7,13 +7,13 @@ trigger: - ci_dev pool: - name: Azure-Pipelines-CI-Test-EO + name: Azure-Pipelines-CI-Prod-EO variables: - armServiceConnectionName: 'ci-1es-acr-connection' - subscription: '9b96ebbd-c57a-42d1-bbe9-b69296e4c7fb' - containerRegistry: 'amoltest' - repoImageName: '${{ variables.containerRegistry }}.azurecr.io/citest:multiarch' + armServiceConnectionName: 'ci-1es-acr-connection-prod' + subscription: '30c56c3a-54da-46ea-b004-06eb33432687' + containerRegistry: 'containerinsightsbuild' + repoImageName: '${{ variables.containerRegistry }}.azurecr.io/official/build' steps: - task: AzureCLI@2 @@ -42,4 +42,4 @@ steps: az account set -s ${{ variables.subscription }} az acr login -n ${{ variables.containerRegistry }} - docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }} -f kubernetes/linux/Dockerfile.multiarch --push . + docker buildx build --platform linux/amd64,linux/arm64 --tag '${{ variables.repoImageName }}:cidev-${{ variables.$datetime }}-${{ variables.commit }}' -f kubernetes/linux/Dockerfile.multiarch --push . From 28517c0237e0acd3d6bd244e4d1243f5031c875e Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 12:26:40 +0000 Subject: [PATCH 59/88] fix variables --- .pipelines/azure_pipeline.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index e3eb042be..e16ffd811 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -26,10 +26,10 @@ steps: ls -ltr commit=$(git rev-parse --short HEAD) - echo "##vso[task.setvariable variable=commitID;isOutput=true;]$commit" + echo "##vso[task.setvariable variable=commitID;]$commit" datetime=$(date +'%Y%m%d%s') - echo "##vso[task.setvariable variable=datetime;isOutput=true;]$datetime" + echo "##vso[task.setvariable variable=datetime;]$datetime" 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 @@ -42,4 +42,5 @@ steps: az account set -s ${{ variables.subscription }} az acr login -n ${{ variables.containerRegistry }} - docker buildx build --platform linux/amd64,linux/arm64 --tag '${{ variables.repoImageName }}:cidev-${{ variables.$datetime }}-${{ variables.commit }}' -f kubernetes/linux/Dockerfile.multiarch --push . + docker buildx build --platform linux/amd64,linux/arm64 --tag '${{ variables.repoImageName }}:cidev-$(datetime)-$(commit)' -f kubernetes/linux/Dockerfile.multiarch --push . + From 4d4d3c17d62aa026b09b3f23ddc86aeda489a10a Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 16:34:27 +0000 Subject: [PATCH 60/88] fix tag --- .pipelines/azure_pipeline.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index e16ffd811..366e52129 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -42,5 +42,5 @@ steps: az account set -s ${{ variables.subscription }} az acr login -n ${{ variables.containerRegistry }} - docker buildx build --platform linux/amd64,linux/arm64 --tag '${{ variables.repoImageName }}:cidev-$(datetime)-$(commit)' -f kubernetes/linux/Dockerfile.multiarch --push . + docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:cidev-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --push . From abfee42c53476778c4fe377ae05b61b0d20cc23e Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 16:53:28 +0000 Subject: [PATCH 61/88] fix tag 2 --- .pipelines/azure_pipeline.yaml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index 366e52129..f727cbcc3 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -16,20 +16,19 @@ variables: repoImageName: '${{ variables.containerRegistry }}.azurecr.io/official/build' 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" + - task: AzureCLI@2 inputs: azureSubscription: ${{ variables.armServiceConnectionName }} scriptType: bash scriptLocation: inlineScript inlineScript: | - pwd - ls -ltr - - commit=$(git rev-parse --short HEAD) - echo "##vso[task.setvariable variable=commitID;]$commit" - - datetime=$(date +'%Y%m%d%s') - echo "##vso[task.setvariable variable=datetime;]$datetime" 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 From 98abd5d6df89afb0ab4a6e0eaaa73e429c5a0355 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 17:57:08 +0000 Subject: [PATCH 62/88] change pipelines --- .pipelines/azure_pipeline.yaml | 4 +-- .pipelines/azure_pipeline_dev.yaml | 45 +++++++++++++++++++++++++++++ .pipelines/azure_pipeline_prod.yaml | 45 +++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 .pipelines/azure_pipeline_dev.yaml create mode 100644 .pipelines/azure_pipeline_prod.yaml diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml index f727cbcc3..77ef1b1da 100644 --- a/.pipelines/azure_pipeline.yaml +++ b/.pipelines/azure_pipeline.yaml @@ -4,7 +4,7 @@ # https://aka.ms/yaml trigger: -- ci_dev +- ci_prod pool: name: Azure-Pipelines-CI-Prod-EO @@ -41,5 +41,5 @@ steps: az account set -s ${{ variables.subscription }} az acr login -n ${{ variables.containerRegistry }} - docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:cidev-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --push . + docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:ciprod-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --push . diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml new file mode 100644 index 000000000..471df955a --- /dev/null +++ b/.pipelines/azure_pipeline_dev.yaml @@ -0,0 +1,45 @@ +# 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" + +- 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 --push . + diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml new file mode 100644 index 000000000..f727cbcc3 --- /dev/null +++ b/.pipelines/azure_pipeline_prod.yaml @@ -0,0 +1,45 @@ +# 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-Prod-EO + +variables: + armServiceConnectionName: 'ci-1es-acr-connection-prod' + subscription: '30c56c3a-54da-46ea-b004-06eb33432687' + containerRegistry: 'containerinsightsbuild' + repoImageName: '${{ variables.containerRegistry }}.azurecr.io/official/build' + +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" + +- 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 }}:cidev-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --push . + From 606523ee1ce27e72257d5e4b52b9dd9edd19e6d5 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 17:58:06 +0000 Subject: [PATCH 63/88] remove extra file --- .pipelines/azure_pipeline.yaml | 45 ---------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 .pipelines/azure_pipeline.yaml diff --git a/.pipelines/azure_pipeline.yaml b/.pipelines/azure_pipeline.yaml deleted file mode 100644 index 77ef1b1da..000000000 --- a/.pipelines/azure_pipeline.yaml +++ /dev/null @@ -1,45 +0,0 @@ -# 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/build' - -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" - -- 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 --push . - From 37479740cf86b1c391c114c8c4866af0fb413763 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 18:32:48 +0000 Subject: [PATCH 64/88] missing changes --- .pipelines/azure_pipeline_prod.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml index f727cbcc3..77ef1b1da 100644 --- a/.pipelines/azure_pipeline_prod.yaml +++ b/.pipelines/azure_pipeline_prod.yaml @@ -4,7 +4,7 @@ # https://aka.ms/yaml trigger: -- ci_dev +- ci_prod pool: name: Azure-Pipelines-CI-Prod-EO @@ -41,5 +41,5 @@ steps: az account set -s ${{ variables.subscription }} az acr login -n ${{ variables.containerRegistry }} - docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:cidev-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --push . + docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:ciprod-$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --push . From ab986f16bbe8bebcd813a620196d542c58d90a45 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Feb 2022 19:47:48 +0000 Subject: [PATCH 65/88] save metadata --- .pipelines/azure_pipeline_dev.yaml | 6 +++++- .pipelines/azure_pipeline_prod.yaml | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml index 471df955a..e730c9c38 100644 --- a/.pipelines/azure_pipeline_dev.yaml +++ b/.pipelines/azure_pipeline_dev.yaml @@ -41,5 +41,9 @@ steps: 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 --push . + docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --metadata-file $(Build.ArtifactStagingDirectory)/metadata.json --push . +- task: PublishBuildArtifacts@1 + inputs: + pathToPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: drop diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml index 77ef1b1da..d2d5f498c 100644 --- a/.pipelines/azure_pipeline_prod.yaml +++ b/.pipelines/azure_pipeline_prod.yaml @@ -41,5 +41,9 @@ steps: 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 --push . + 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 --push . +- task: PublishBuildArtifacts@1 + inputs: + pathToPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: drop \ No newline at end of file From e866fdc5dc69687958729daede8087fe9120f977 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Wed, 2 Feb 2022 21:03:54 +0000 Subject: [PATCH 66/88] update pipelines --- .pipelines/azure_pipeline_dev.yaml | 8 ++++++++ .pipelines/azure_pipeline_prod.yaml | 8 ++++++++ source/plugins/ruby/in_kube_nodes.rb | 3 +++ 3 files changed, 19 insertions(+) diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml index e730c9c38..040839756 100644 --- a/.pipelines/azure_pipeline_dev.yaml +++ b/.pipelines/azure_pipeline_dev.yaml @@ -43,6 +43,14 @@ steps: docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:$(datetime)-$(commit) -f kubernetes/linux/Dockerfile.multiarch --metadata-file $(Build.ArtifactStagingDirectory)/metadata.json --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)' diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml index d2d5f498c..e1c758875 100644 --- a/.pipelines/azure_pipeline_prod.yaml +++ b/.pipelines/azure_pipeline_prod.yaml @@ -43,6 +43,14 @@ steps: 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 --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)' diff --git a/source/plugins/ruby/in_kube_nodes.rb b/source/plugins/ruby/in_kube_nodes.rb index abbfe94a1..5a52a089b 100644 --- a/source/plugins/ruby/in_kube_nodes.rb +++ b/source/plugins/ruby/in_kube_nodes.rb @@ -560,6 +560,9 @@ def getNodeTelemetryProps(item) properties["OperatingSystem"] = nodeInfo["operatingSystem"] properties["KernelVersion"] = nodeInfo["kernelVersion"] properties["OSImage"] = nodeInfo["osImage"] + if nodeInfo["architecture"] == "arm64" + properties["Architecture"] = nodeInfo["architecture"] + end containerRuntimeVersion = nodeInfo["containerRuntimeVersion"] if containerRuntimeVersion.downcase.start_with?("docker://") properties["DockerVersion"] = containerRuntimeVersion.split("//")[1] From 6378122f23cdc556cba9901655e8de5be084e05a Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Thu, 3 Feb 2022 14:00:43 +0000 Subject: [PATCH 67/88] revert official mdsd arm64 build --- kubernetes/linux/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 410f9e421..2a1ab0a61 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -17,7 +17,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ #install oneagent - Official bits (10/7/2021) if [ "${ARCH}" != "arm64" ]; then - wget "https://adme2epublic.blob.core.windows.net/privatefiles/azure-mdsd_1.16.0-build.dev_x86_64.deb?sp=r&st=2022-01-26T13:42:36Z&se=2022-02-24T21:42:36Z&spr=https&sv=2020-08-04&sr=b&sig=OTJREpVZsMp8WXYGpM7CMHa%2Fp22ztbWmikvmMSjX3xA%3D" -O azure-mdsd.deb + wget https://github.com/microsoft/Docker-Provider/releases/download/1.14/azure-mdsd_1.14.2-build.master.284_x86_64.deb -O azure-mdsd.deb else wget "https://adme2epublic.blob.core.windows.net/privatefiles/azure-mdsd_1.15.0-build.dev_aarch64_3.deb?sp=r&st=2022-01-26T13:41:51Z&se=2022-02-24T21:41:51Z&spr=https&sv=2020-08-04&sr=b&sig=uW2MnQ%2F8mUtq4gMb78SaY5AnqsRlk6UQEPo469fafGo%3D" -O azure-mdsd.deb fi From 880becb8c863196b5b52da7a5f6c89250a50c821 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Thu, 3 Feb 2022 14:07:58 +0000 Subject: [PATCH 68/88] add build_arg image_tag --- .pipelines/azure_pipeline_dev.yaml | 2 +- .pipelines/azure_pipeline_prod.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml index 040839756..ab740de7f 100644 --- a/.pipelines/azure_pipeline_dev.yaml +++ b/.pipelines/azure_pipeline_dev.yaml @@ -41,7 +41,7 @@ steps: 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 --push . + 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) diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml index e1c758875..fa0fcafc6 100644 --- a/.pipelines/azure_pipeline_prod.yaml +++ b/.pipelines/azure_pipeline_prod.yaml @@ -41,7 +41,7 @@ steps: 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 --push . + 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) From 3d64a2b5975a361b0888a3ef0ea15a6c7cadebb5 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Fri, 11 Feb 2022 18:17:27 +0000 Subject: [PATCH 69/88] use new arm64 version --- kubernetes/linux/main.sh | 6 ++++++ kubernetes/linux/setup.sh | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/kubernetes/linux/main.sh b/kubernetes/linux/main.sh index b905311aa..9f68b6fdc 100644 --- a/kubernetes/linux/main.sh +++ b/kubernetes/linux/main.sh @@ -563,6 +563,12 @@ else echo "export CIWORKSPACE_keyFile=$CIWORKSPACE_keyFile" >> ~/.bashrc export MDSD_FLUENT_SOCKET_PORT="29230" echo "export MDSD_FLUENT_SOCKET_PORT=$MDSD_FLUENT_SOCKET_PORT" >> ~/.bashrc + export ENABLE_CURL_UPLOAD=true + echo "export ENABLE_CURL_UPLOAD=$ENABLE_CURL_UPLOAD" >> ~/.bashrc + export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt + echo "export CURL_CA_BUNDLE=$CURL_CA_BUNDLE" >> ~/.bashrc + mkdir -p /etc/pki/tls/certs + cp /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt fi source ~/.bashrc diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 2a1ab0a61..980ecccd9 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -19,7 +19,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ if [ "${ARCH}" != "arm64" ]; then wget https://github.com/microsoft/Docker-Provider/releases/download/1.14/azure-mdsd_1.14.2-build.master.284_x86_64.deb -O azure-mdsd.deb else - wget "https://adme2epublic.blob.core.windows.net/privatefiles/azure-mdsd_1.15.0-build.dev_aarch64_3.deb?sp=r&st=2022-01-26T13:41:51Z&se=2022-02-24T21:41:51Z&spr=https&sv=2020-08-04&sr=b&sig=uW2MnQ%2F8mUtq4gMb78SaY5AnqsRlk6UQEPo469fafGo%3D" -O azure-mdsd.deb + wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2693_aarch64.deb" -O azure-mdsd.deb fi /usr/bin/dpkg -i $TMPDIR/azure-mdsd*.deb From 82d7e52b8e13e185f6b778232df3b98ef65169ba Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Mon, 14 Feb 2022 12:38:47 +0000 Subject: [PATCH 70/88] update arm build --- kubernetes/linux/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 980ecccd9..de026efb1 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -19,7 +19,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ if [ "${ARCH}" != "arm64" ]; then wget https://github.com/microsoft/Docker-Provider/releases/download/1.14/azure-mdsd_1.14.2-build.master.284_x86_64.deb -O azure-mdsd.deb else - wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2693_aarch64.deb" -O azure-mdsd.deb + wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2702_aarch64.deb" -O azure-mdsd.deb fi /usr/bin/dpkg -i $TMPDIR/azure-mdsd*.deb From c585b6012d000023aab678d4617929426dee5c20 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 15 Feb 2022 12:03:50 +0000 Subject: [PATCH 71/88] update amd build --- kubernetes/linux/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index de026efb1..6bb089f17 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -17,7 +17,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ #install oneagent - Official bits (10/7/2021) if [ "${ARCH}" != "arm64" ]; then - wget https://github.com/microsoft/Docker-Provider/releases/download/1.14/azure-mdsd_1.14.2-build.master.284_x86_64.deb -O azure-mdsd.deb + wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2706_x86_64.deb" -O azure-mdsd.deb else wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2702_aarch64.deb" -O azure-mdsd.deb fi From 433be78f672f81675d191bebe7b8368ef790a8f4 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 22 Feb 2022 19:09:12 +0000 Subject: [PATCH 72/88] update arm build --- kubernetes/linux/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 6bb089f17..1a16e8e2e 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -19,7 +19,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ if [ "${ARCH}" != "arm64" ]; then wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2706_x86_64.deb" -O azure-mdsd.deb else - wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2702_aarch64.deb" -O azure-mdsd.deb + wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2717_aarch64.deb" -O azure-mdsd.deb fi /usr/bin/dpkg -i $TMPDIR/azure-mdsd*.deb From 0e635acd1b7cbebc8c3710d39fbc8e8965be2f91 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Wed, 23 Feb 2022 18:56:44 +0000 Subject: [PATCH 73/88] use new amd64 master build for mdsd --- kubernetes/linux/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 1a16e8e2e..27ce65ed7 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -17,7 +17,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ #install oneagent - Official bits (10/7/2021) if [ "${ARCH}" != "arm64" ]; then - wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2706_x86_64.deb" -O azure-mdsd.deb + wget "https://github.com/microsoft/Docker-Provider/releases/download/1.17.0/azure-mdsd_1.17.0-build.master.354_x86_64.deb" -O azure-mdsd.deb else wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2717_aarch64.deb" -O azure-mdsd.deb fi From 39abea768a72361959bf8a670134be57eb581699 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Wed, 23 Feb 2022 19:15:29 +0000 Subject: [PATCH 74/88] update golang to 1.15 in dockerfile --- kubernetes/linux/Dockerfile.multiarch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/Dockerfile.multiarch b/kubernetes/linux/Dockerfile.multiarch index 9dfeacc4d..28c305f3d 100644 --- a/kubernetes/linux/Dockerfile.multiarch +++ b/kubernetes/linux/Dockerfile.multiarch @@ -1,4 +1,4 @@ -FROM --platform=$BUILDPLATFORM golang:1.14 AS builder +FROM --platform=$BUILDPLATFORM golang:1.15 AS builder ARG TARGETOS TARGETARCH RUN /usr/bin/apt-get update && /usr/bin/apt-get install git g++ make pkg-config libssl-dev libpam0g-dev rpm librpm-dev uuid-dev libkrb5-dev python sudo gcc-aarch64-linux-gnu -y From ce9d404b0e0de979f7ca8e2921540621a61d9f59 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Mon, 28 Feb 2022 18:17:52 +0000 Subject: [PATCH 75/88] use releases url --- kubernetes/linux/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 27ce65ed7..1fa56d9e3 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -19,7 +19,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ if [ "${ARCH}" != "arm64" ]; then wget "https://github.com/microsoft/Docker-Provider/releases/download/1.17.0/azure-mdsd_1.17.0-build.master.354_x86_64.deb" -O azure-mdsd.deb else - wget "https://adme2epublic.blob.core.windows.net/publicfiles/azure-mdsd_1.17.0-build.develop.2717_aarch64.deb" -O azure-mdsd.deb + wget "https://github.com/microsoft/Docker-Provider/releases/download/1.17.0-arm64-dev/azure-mdsd_1.17.0-build.develop.2717_aarch64.deb" -O azure-mdsd.deb fi /usr/bin/dpkg -i $TMPDIR/azure-mdsd*.deb From 2c29e1c7b2a428439119645f76f147220b5c039a Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Mar 2022 12:48:30 +0000 Subject: [PATCH 76/88] files for ev2 release --- .pipelines/azure_pipeline_dev.yaml | 7 ++ .pipelines/azure_pipeline_prod.yaml | 7 ++ .../ContainerInsights.Linux.Parameters.json | 68 ++++++++++++++++++ .../RolloutSpecs/RolloutSpecs.json | 29 ++++++++ .../ScopeBindings/Public.ScopeBindings.json | 51 +++++++++++++ .../Scripts/pushAgentToAcr.sh | 72 +++++++++++++++++++ .../ServiceModels/Public.ServiceModel.json | 51 +++++++++++++ .../ServiceGroupRoot/buildver.txt | 1 + 8 files changed, 286 insertions(+) create mode 100644 deployment/multiarch-agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json create mode 100644 deployment/multiarch-agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json create mode 100644 deployment/multiarch-agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json create mode 100644 deployment/multiarch-agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh create mode 100644 deployment/multiarch-agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json create mode 100644 deployment/multiarch-agent-deployment/ServiceGroupRoot/buildver.txt diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml index ab740de7f..a143facd6 100644 --- a/.pipelines/azure_pipeline_dev.yaml +++ b/.pipelines/azure_pipeline_dev.yaml @@ -23,6 +23,13 @@ steps: datetime=$(date +'%Y%m%d%s') echo "##vso[task.setvariable variable=datetime;]$datetime" +- task: CopyFiles@2 + inputs: + Contents: | + deployment/** + .pipelines/*.sh + TargetFolder: '$(Build.ArtifactStagingDirectory)/build' + - task: AzureCLI@2 inputs: azureSubscription: ${{ variables.armServiceConnectionName }} diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml index fa0fcafc6..57c3cacf1 100644 --- a/.pipelines/azure_pipeline_prod.yaml +++ b/.pipelines/azure_pipeline_prod.yaml @@ -23,6 +23,13 @@ steps: datetime=$(date +'%Y%m%d%s') echo "##vso[task.setvariable variable=datetime;]$datetime" +- task: CopyFiles@2 + inputs: + Contents: | + deployment/** + .pipelines/*.sh + TargetFolder: '$(Build.ArtifactStagingDirectory)/build' + - task: AzureCLI@2 inputs: azureSubscription: ${{ variables.armServiceConnectionName }} diff --git a/deployment/multiarch-agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json b/deployment/multiarch-agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json new file mode 100644 index 000000000..70d0950a2 --- /dev/null +++ b/deployment/multiarch-agent-deployment/ServiceGroupRoot/Parameters/ContainerInsights.Linux.Parameters.json @@ -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__" + ] + } + } + } + ] + } \ No newline at end of file diff --git a/deployment/multiarch-agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json b/deployment/multiarch-agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json new file mode 100644 index 000000000..250878590 --- /dev/null +++ b/deployment/multiarch-agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json @@ -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": [ ] + } + ] + } \ No newline at end of file diff --git a/deployment/multiarch-agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json b/deployment/multiarch-agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json new file mode 100644 index 000000000..cbc6db8b3 --- /dev/null +++ b/deployment/multiarch-agent-deployment/ServiceGroupRoot/ScopeBindings/Public.ScopeBindings.json @@ -0,0 +1,51 @@ +{ + "$schema": "https://ev2schema.azure.net/schemas/2020-01-01/scopeBindings.json", + "contentVersion": "0.0.0.1", + "scopeBindings": [ + { + "scopeTagName": "Global", + "bindings": [ + { + "find": "__ACR_NAME__", + "replaceWith": "$(ACRName)" + }, + { + "find": "__AGENT_RELEASE__", + "replaceWith": "$(AgentRelease)" + }, + { + "find": "__AGENT_IMAGE_TAG_SUFFIX__", + "replaceWith": "$(AgentImageTagSuffix)" + }, + { + "find": "__MANAGED_IDENTITY__", + "replaceWith": "$(ManagedIdentity)" + }, + { + "find": "__CDPX_LINUX_REGISTRY__", + "replaceWith": "$(CDPXLinuxRegistry)" + }, + { + "find": "__CDPX_WINDOWS_REGISTRY__", + "replaceWith": "$(CDPXWindowsRegistry)" + }, + { + "find": "__CDPX_LINUX_TAG__", + "replaceWith": "$(CDPXLinuxTag)" + }, + { + "find": "__CDPX_WINDOWS_TAG__", + "replaceWith": "$(CDPXWindowsTag)" + }, + { + "find": "__CDPX_LINUX_REPO_NAME__", + "replaceWith": "$(CDPXLinuxRepoName)" + }, + { + "find": "__CDPX_WINDOWS_REPO_NAME__", + "replaceWith": "$(CDPXWindowsRepoName)" + } + ] + } + ] +} \ No newline at end of file diff --git a/deployment/multiarch-agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh b/deployment/multiarch-agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh new file mode 100644 index 000000000..d39cedde0 --- /dev/null +++ b/deployment/multiarch-agent-deployment/ServiceGroupRoot/Scripts/pushAgentToAcr.sh @@ -0,0 +1,72 @@ +#!/bin/bash +set -e + +# Note - This script used in the pipeline as inline script + +if [ -z $AGENT_IMAGE_TAG_SUFFIX ]; then + echo "-e error value of AGENT_IMAGE_TAG_SUFFIX variable shouldnt be empty. check release variables" + exit 1 +fi + +if [ -z $AGENT_RELEASE ]; then + echo "-e error AGENT_RELEASE shouldnt be empty. check release variables" + exit 1 +fi + +#Make sure that tag being pushed will not overwrite an existing tag in mcr +MCR_TAG_RESULT="`wget -qO- https://mcr.microsoft.com/v2/azuremonitor/containerinsights/ciprod/tags/list`" +if [ $? -ne 0 ]; then + echo "-e error unable to get list of mcr tags for azuremonitor/containerinsights/ciprod repository" + exit 1 +fi +TAG_EXISTS=$(echo $MCR_TAG_RESULT | jq '.tags | contains(["'"$AGENT_RELEASE$AGENT_IMAGE_TAG_SUFFIX"'"])') + +if $TAG_EXISTS; then + echo "-e error ${AGENT_IMAGE_TAG_SUFFIX} already exists in mcr. make sure the image tag is unique" + exit 1 +fi + +if [ -z $AGENT_IMAGE_FULL_PATH ]; then + echo "-e error AGENT_IMAGE_FULL_PATH shouldnt be empty. check release variables" + exit 1 +fi + +if [ -z $CDPX_TAG ]; then + echo "-e error value of CDPX_TAG shouldn't be empty. check release variables" + exit 1 +fi + +if [ -z $CDPX_REGISTRY ]; then + echo "-e error value of CDPX_REGISTRY shouldn't be empty. check release variables" + exit 1 +fi + +if [ -z $CDPX_REPO_NAME ]; then + echo "-e error value of CDPX_REPO_NAME shouldn't be empty. check release variables" + exit 1 +fi + +if [ -z $ACR_NAME ]; then + echo "-e error value of ACR_NAME shouldn't be empty. check release variables" + exit 1 +fi + + +#Login to az cli and authenticate to acr +echo "Login cli using managed identity" +az login --identity +if [ $? -eq 0 ]; then + echo "Logged in successfully" +else + echo "-e error failed to login to az with managed identity credentials" + exit 1 +fi + +echo "Pushing ${AGENT_IMAGE_FULL_PATH} to ${ACR_NAME}" +az acr import --name $ACR_NAME --registry $CDPX_REGISTRY --source official/${CDPX_REPO_NAME}:${CDPX_TAG} --image $AGENT_IMAGE_FULL_PATH +if [ $? -eq 0 ]; then + echo "Retagged and pushed image successfully" +else + echo "-e error failed to retag and push image to destination ACR" + exit 1 +fi \ No newline at end of file diff --git a/deployment/multiarch-agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json b/deployment/multiarch-agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json new file mode 100644 index 000000000..c3b00340a --- /dev/null +++ b/deployment/multiarch-agent-deployment/ServiceGroupRoot/ServiceModels/Public.ServiceModel.json @@ -0,0 +1,51 @@ +{ + "$schema": "https://ev2schema.azure.net/schemas/2020-01-01/serviceModel.json", + "contentVersion": "1.0.0.2", + "ServiceMetadata": { + "ServiceGroup": "ContainerInsightsAgent", + "Environment": "Prod" + }, + "ServiceResourceGroupDefinitions": [ + { + "Name": "CI-Agent-ServiceResourceGroupDefinition", + "ServiceResourceDefinitions": [ + { + "Name": "ShellExtension", + "ComposedOf": { + "Extension": { + "Shell": [ + { + "type": "ShellExtensionType", + "properties": { + "imageName": "adm-ubuntu-1804-l", + "imageVersion": "v18" + } + } + ] + } + } + } + ] + } + ], + "ServiceResourceGroups": [ + { + "AzureResourceGroupName": "ContainerInsights-MultiArch-Agent-Release", + "Location": "eastus2", + "InstanceOf": "CI-Agent-ServiceResourceGroupDefinition", + "AzureSubscriptionId": "30c56c3a-54da-46ea-b004-06eb33432687", + "ScopeTags": [ + { + "Name": "Global" + } + ], + "ServiceResources": [ + { + "Name": "PushLinuxAgent", + "InstanceOf": "ShellExtension", + "RolloutParametersPath": "Parameters\\ContainerInsights.Linux.Parameters.json" + } + ] + } + ] + } \ No newline at end of file diff --git a/deployment/multiarch-agent-deployment/ServiceGroupRoot/buildver.txt b/deployment/multiarch-agent-deployment/ServiceGroupRoot/buildver.txt new file mode 100644 index 000000000..bd2666abb --- /dev/null +++ b/deployment/multiarch-agent-deployment/ServiceGroupRoot/buildver.txt @@ -0,0 +1 @@ +1.0.0.0 \ No newline at end of file From 5bad5d8d98520bf51ba3960c921c3c0bd159c880 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Mar 2022 13:31:50 +0000 Subject: [PATCH 77/88] change copy file paths --- .pipelines/azure_pipeline_dev.yaml | 13 +++++++++++-- .pipelines/azure_pipeline_prod.yaml | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml index a143facd6..e8dd26a3d 100644 --- a/.pipelines/azure_pipeline_dev.yaml +++ b/.pipelines/azure_pipeline_dev.yaml @@ -24,10 +24,19 @@ steps: echo "##vso[task.setvariable variable=datetime;]$datetime" - task: CopyFiles@2 + displayName: "Copy ev2 deployment artifacts" inputs: + SourceFolder: "$(Build.SourcesDirectory)/deployment" Contents: | - deployment/** - .pipelines/*.sh + **/* + TargetFolder: '$(Build.ArtifactStagingDirectory)/build' + +- task: CopyFiles@2 + displayName: "Copy ev2 deployment scripts" + inputs: + SourceFolder: "$(Build.SourcesDirectory)/.pipelines" + Contents: | + **/*.sh TargetFolder: '$(Build.ArtifactStagingDirectory)/build' - task: AzureCLI@2 diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml index 57c3cacf1..27d6944a8 100644 --- a/.pipelines/azure_pipeline_prod.yaml +++ b/.pipelines/azure_pipeline_prod.yaml @@ -24,10 +24,19 @@ steps: echo "##vso[task.setvariable variable=datetime;]$datetime" - task: CopyFiles@2 + displayName: "Copy ev2 deployment artifacts" inputs: + SourceFolder: "$(Build.SourcesDirectory)/deployment" Contents: | - deployment/** - .pipelines/*.sh + **/* + TargetFolder: '$(Build.ArtifactStagingDirectory)/build' + +- task: CopyFiles@2 + displayName: "Copy ev2 deployment scripts" + inputs: + SourceFolder: "$(Build.SourcesDirectory)/.pipelines" + Contents: | + **/*.sh TargetFolder: '$(Build.ArtifactStagingDirectory)/build' - task: AzureCLI@2 From e78f71ba56c2ad18b09d155a2cce4448fdc12a02 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Mar 2022 14:23:57 +0000 Subject: [PATCH 78/88] change prod repo name --- .pipelines/azure_pipeline_prod.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml index 27d6944a8..b2bd0be22 100644 --- a/.pipelines/azure_pipeline_prod.yaml +++ b/.pipelines/azure_pipeline_prod.yaml @@ -13,7 +13,7 @@ variables: armServiceConnectionName: 'ci-1es-acr-connection-prod' subscription: '30c56c3a-54da-46ea-b004-06eb33432687' containerRegistry: 'containerinsightsbuild' - repoImageName: '${{ variables.containerRegistry }}.azurecr.io/official/build' + repoImageName: '${{ variables.containerRegistry }}.azurecr.io/official/linux' steps: - bash: | From 4d28ee24e1cad45728e7bf48a12b528a972f727d Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Mar 2022 15:15:20 +0000 Subject: [PATCH 79/88] capture artifacts.tar.gz --- .pipelines/azure_pipeline_dev.yaml | 3 +++ .pipelines/azure_pipeline_prod.yaml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml index e8dd26a3d..38339a277 100644 --- a/.pipelines/azure_pipeline_dev.yaml +++ b/.pipelines/azure_pipeline_dev.yaml @@ -23,6 +23,9 @@ steps: 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: diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml index b2bd0be22..d53f9a713 100644 --- a/.pipelines/azure_pipeline_prod.yaml +++ b/.pipelines/azure_pipeline_prod.yaml @@ -23,6 +23,9 @@ steps: 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: From 804e6518545fd845e70ee7c932eba13d43cd0e2d Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Tue, 1 Mar 2022 18:02:40 +0000 Subject: [PATCH 80/88] avoid unnecessary alerts while testing --- .../ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/multiarch-agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json b/deployment/multiarch-agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json index 250878590..b95532fae 100644 --- a/deployment/multiarch-agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json +++ b/deployment/multiarch-agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json @@ -13,7 +13,7 @@ }, "Notification": { "Email": { - "To": "omscontainers@microsoft.com" + "To": "amagraw@microsoft.com" } } }, From bffc30dedd60361be7977061c4f9b76df282133e Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Wed, 9 Mar 2022 17:39:41 +0000 Subject: [PATCH 81/88] update tag --- kubernetes/linux/Dockerfile.multiarch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/linux/Dockerfile.multiarch b/kubernetes/linux/Dockerfile.multiarch index 28c305f3d..2d92ef566 100644 --- a/kubernetes/linux/Dockerfile.multiarch +++ b/kubernetes/linux/Dockerfile.multiarch @@ -29,7 +29,7 @@ RUN /usr/bin/apt-get update && /usr/bin/apt-get install -y libc-bin wget openssl COPY --from=builder /src/kubernetes/linux/Linux_ULINUX_1.0_*_64_Release/docker-cimprov-*.*.*-*.*.sh $tmpdir/ COPY kubernetes/linux/setup.sh kubernetes/linux/main.sh kubernetes/linux/defaultpromenvvariables kubernetes/linux/defaultpromenvvariables-rs kubernetes/linux/defaultpromenvvariables-sidecar kubernetes/linux/mdsd.xml kubernetes/linux/envmdsd kubernetes/linux/logrotate.conf $tmpdir/ -ARG IMAGE_TAG=ciprod10132021 +ARG IMAGE_TAG=ciprodpreview-multiarch-20220309 ENV AGENT_VERSION ${IMAGE_TAG} WORKDIR ${tmpdir} From 2c6053f0ef0dd1d290ec388895bc6dafda2da5c3 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Fri, 11 Mar 2022 21:22:45 +0000 Subject: [PATCH 82/88] use mdsd arm64 master build --- kubernetes/linux/Dockerfile.multiarch | 2 +- kubernetes/linux/setup.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kubernetes/linux/Dockerfile.multiarch b/kubernetes/linux/Dockerfile.multiarch index 2d92ef566..c65af4734 100644 --- a/kubernetes/linux/Dockerfile.multiarch +++ b/kubernetes/linux/Dockerfile.multiarch @@ -29,7 +29,7 @@ RUN /usr/bin/apt-get update && /usr/bin/apt-get install -y libc-bin wget openssl COPY --from=builder /src/kubernetes/linux/Linux_ULINUX_1.0_*_64_Release/docker-cimprov-*.*.*-*.*.sh $tmpdir/ COPY kubernetes/linux/setup.sh kubernetes/linux/main.sh kubernetes/linux/defaultpromenvvariables kubernetes/linux/defaultpromenvvariables-rs kubernetes/linux/defaultpromenvvariables-sidecar kubernetes/linux/mdsd.xml kubernetes/linux/envmdsd kubernetes/linux/logrotate.conf $tmpdir/ -ARG IMAGE_TAG=ciprodpreview-multiarch-20220309 +ARG IMAGE_TAG=ciprodpreview-multiarch-20220311 ENV AGENT_VERSION ${IMAGE_TAG} WORKDIR ${tmpdir} diff --git a/kubernetes/linux/setup.sh b/kubernetes/linux/setup.sh index 1fa56d9e3..5ff29fe68 100644 --- a/kubernetes/linux/setup.sh +++ b/kubernetes/linux/setup.sh @@ -19,7 +19,7 @@ sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ if [ "${ARCH}" != "arm64" ]; then wget "https://github.com/microsoft/Docker-Provider/releases/download/1.17.0/azure-mdsd_1.17.0-build.master.354_x86_64.deb" -O azure-mdsd.deb else - wget "https://github.com/microsoft/Docker-Provider/releases/download/1.17.0-arm64-dev/azure-mdsd_1.17.0-build.develop.2717_aarch64.deb" -O azure-mdsd.deb + wget "https://github.com/microsoft/Docker-Provider/releases/download/1.17.1-arm64-master/azure-mdsd_1.17.1-build.master.366_aarch64.deb" -O azure-mdsd.deb fi /usr/bin/dpkg -i $TMPDIR/azure-mdsd*.deb From f12ffe0bda945a3a59bcda96cfceca26ac0ae188 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Fri, 11 Mar 2022 22:23:01 +0000 Subject: [PATCH 83/88] address PR comments --- .../ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json | 2 +- kubernetes/linux/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment/multiarch-agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json b/deployment/multiarch-agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json index b95532fae..250878590 100644 --- a/deployment/multiarch-agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json +++ b/deployment/multiarch-agent-deployment/ServiceGroupRoot/RolloutSpecs/RolloutSpecs.json @@ -13,7 +13,7 @@ }, "Notification": { "Email": { - "To": "amagraw@microsoft.com" + "To": "omscontainers@microsoft.com" } } }, diff --git a/kubernetes/linux/Dockerfile b/kubernetes/linux/Dockerfile index b32538799..280829eeb 100644 --- a/kubernetes/linux/Dockerfile +++ b/kubernetes/linux/Dockerfile @@ -17,7 +17,7 @@ ENV RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR 0.9 RUN /usr/bin/apt-get update && /usr/bin/apt-get install -y libc-bin wget openssl curl sudo python-ctypes init-system-helpers net-tools rsyslog cron vim dmidecode apt-transport-https gnupg && rm -rf /var/lib/apt/lists/* COPY setup.sh main.sh defaultpromenvvariables defaultpromenvvariables-rs defaultpromenvvariables-sidecar mdsd.xml envmdsd logrotate.conf $tmpdir/ -ARG IMAGE_TAG=ciprod01312022 +ARG IMAGE_TAG=ciprodpreview-multiarch-20220311 ENV AGENT_VERSION ${IMAGE_TAG} WORKDIR ${tmpdir} From 96a6386bf4d7c3379ef15ad73cba947e65fde46a Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Sat, 12 Mar 2022 00:01:52 +0000 Subject: [PATCH 84/88] copy additional files --- .pipelines/azure_pipeline_dev.yaml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml index 38339a277..dc1bbbb77 100644 --- a/.pipelines/azure_pipeline_dev.yaml +++ b/.pipelines/azure_pipeline_dev.yaml @@ -31,15 +31,11 @@ steps: 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 + $(Build.SourcesDirectory)/deployment/**/* + $(Build.SourcesDirectory)/.pipelines/**/*.sh + $(Build.SourcesDirectory)/kubernetes/*.yaml + $(Build.SourcesDirectory)/charts/**/* + $(Build.SourcesDirectory)/test/e2e/*.yaml TargetFolder: '$(Build.ArtifactStagingDirectory)/build' - task: AzureCLI@2 From 5d3f7a26ea8afb7a33edbada46c01893ce5bca5e Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Sat, 12 Mar 2022 00:07:40 +0000 Subject: [PATCH 85/88] remove sources folder --- .pipelines/azure_pipeline_dev.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml index dc1bbbb77..3b49162f3 100644 --- a/.pipelines/azure_pipeline_dev.yaml +++ b/.pipelines/azure_pipeline_dev.yaml @@ -29,7 +29,6 @@ steps: - task: CopyFiles@2 displayName: "Copy ev2 deployment artifacts" inputs: - SourceFolder: "$(Build.SourcesDirectory)/deployment" Contents: | $(Build.SourcesDirectory)/deployment/**/* $(Build.SourcesDirectory)/.pipelines/**/*.sh From 6e7cfd4167385c32548ca9084ad65bb481e69fc0 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Sat, 12 Mar 2022 00:24:57 +0000 Subject: [PATCH 86/88] update globs --- .pipelines/azure_pipeline_dev.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml index 3b49162f3..26e01aa80 100644 --- a/.pipelines/azure_pipeline_dev.yaml +++ b/.pipelines/azure_pipeline_dev.yaml @@ -30,10 +30,10 @@ steps: displayName: "Copy ev2 deployment artifacts" inputs: Contents: | - $(Build.SourcesDirectory)/deployment/**/* - $(Build.SourcesDirectory)/.pipelines/**/*.sh + $(Build.SourcesDirectory)/deployment/** + $(Build.SourcesDirectory)/.pipelines/*.sh $(Build.SourcesDirectory)/kubernetes/*.yaml - $(Build.SourcesDirectory)/charts/**/* + $(Build.SourcesDirectory)/charts/** $(Build.SourcesDirectory)/test/e2e/*.yaml TargetFolder: '$(Build.ArtifactStagingDirectory)/build' From 97a4661689c5df3f4afe1314bcfca2efd41b3841 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Sat, 12 Mar 2022 00:36:40 +0000 Subject: [PATCH 87/88] use multiple copy tasks --- .pipelines/azure_pipeline_dev.yaml | 39 ++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml index 26e01aa80..c2a159e47 100644 --- a/.pipelines/azure_pipeline_dev.yaml +++ b/.pipelines/azure_pipeline_dev.yaml @@ -29,12 +29,41 @@ steps: - task: CopyFiles@2 displayName: "Copy ev2 deployment artifacts" inputs: + SourceFolder: "$(Build.SourcesDirectory)/deployment" Contents: | - $(Build.SourcesDirectory)/deployment/** - $(Build.SourcesDirectory)/.pipelines/*.sh - $(Build.SourcesDirectory)/kubernetes/*.yaml - $(Build.SourcesDirectory)/charts/** - $(Build.SourcesDirectory)/test/e2e/*.yaml + **/* + 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/ete" + Contents: | + *.yaml TargetFolder: '$(Build.ArtifactStagingDirectory)/build' - task: AzureCLI@2 From cb8445f6bbf3da731e0e0e455c1f122056728934 Mon Sep 17 00:00:00 2001 From: Amol Agrawal Date: Sat, 12 Mar 2022 00:41:53 +0000 Subject: [PATCH 88/88] fix typo --- .pipelines/azure_pipeline_dev.yaml | 2 +- .pipelines/azure_pipeline_prod.yaml | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.pipelines/azure_pipeline_dev.yaml b/.pipelines/azure_pipeline_dev.yaml index c2a159e47..6d50e5788 100644 --- a/.pipelines/azure_pipeline_dev.yaml +++ b/.pipelines/azure_pipeline_dev.yaml @@ -61,7 +61,7 @@ steps: - task: CopyFiles@2 displayName: "Copy ev2 deployment scripts" inputs: - SourceFolder: "$(Build.SourcesDirectory)/test/ete" + SourceFolder: "$(Build.SourcesDirectory)/test/e2e" Contents: | *.yaml TargetFolder: '$(Build.ArtifactStagingDirectory)/build' diff --git a/.pipelines/azure_pipeline_prod.yaml b/.pipelines/azure_pipeline_prod.yaml index d53f9a713..046d41910 100644 --- a/.pipelines/azure_pipeline_prod.yaml +++ b/.pipelines/azure_pipeline_prod.yaml @@ -42,6 +42,30 @@ steps: **/*.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 }}