Skip to content

Commit

Permalink
User/andretoyama msft/support ubuntu2204 (#172)
Browse files Browse the repository at this point in the history
* Add pipeline suport ubuntu 22.04
* Add Dockerfiles to build ubuntu 22.04 images
* fix gtest release
* fix gsl include for ubuntu 22.04
* update pip install for ubuntu 22.04
* install file utility dep for CPackDeb
  • Loading branch information
andretoyama-msft authored Jun 15, 2023
1 parent c86438f commit d0e7d7f
Show file tree
Hide file tree
Showing 10 changed files with 137 additions and 9 deletions.
11 changes: 11 additions & 0 deletions azure-pipelines/build/linux/du/docker/doclient-lite-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,14 @@ jobs:
imageVersion: ${{variables.containerImageVersion}}
stepsTemplate: 'doclient-lite-docker-steps.yml'

- template: ../templates/do-docker-jobs.yml
parameters:
targetOsArch: 'ubuntu2204_arm64' # azure pipelines does not support '.' in display names
imageVersion: ${{variables.containerImageVersion}}
stepsTemplate: 'doclient-lite-docker-steps.yml'

- template: ../templates/do-docker-jobs.yml
parameters:
targetOsArch: 'ubuntu2204_x64' # azure pipelines does not support '.' in display names
imageVersion: ${{variables.containerImageVersion}}
stepsTemplate: 'doclient-lite-docker-steps.yml'
11 changes: 11 additions & 0 deletions azure-pipelines/build/linux/du/docker/dopapt-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,14 @@ jobs:
imageVersion: ${{variables.containerImageVersion}}
stepsTemplate: 'dopapt-docker-steps.yml'

- template: ../templates/do-docker-jobs.yml
parameters:
targetOsArch: 'ubuntu2204_arm64'
imageVersion: ${{variables.containerImageVersion}}
stepsTemplate: 'dopapt-docker-steps.yml'

- template: ../templates/do-docker-jobs.yml
parameters:
targetOsArch: 'ubuntu2204_x64'
imageVersion: ${{variables.containerImageVersion}}
stepsTemplate: 'dopapt-docker-steps.yml'
12 changes: 12 additions & 0 deletions azure-pipelines/build/linux/du/docker/dosdkcpp-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,15 @@ jobs:
targetOsArch: 'ubuntu2004_x64'
imageVersion: ${{variables.containerImageVersion}}
stepsTemplate: 'dosdkcpp-docker-steps.yml'

- template: ../templates/do-docker-jobs.yml
parameters:
targetOsArch: 'ubuntu2204_arm64'
imageVersion: ${{variables.containerImageVersion}}
stepsTemplate: 'dosdkcpp-docker-steps.yml'

- template: ../templates/do-docker-jobs.yml
parameters:
targetOsArch: 'ubuntu2204_x64'
imageVersion: ${{variables.containerImageVersion}}
stepsTemplate: 'dosdkcpp-docker-steps.yml'
8 changes: 8 additions & 0 deletions azure-pipelines/publishing/github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ stages:
parameters:
targetOsArch: 'ubuntu2004_arm64'
imageVersion: ${{variables.containerImageVersion}}
- template: templates/release-docker-build-steps.yml
parameters:
targetOsArch: 'ubuntu2204_x64'
imageVersion: ${{variables.containerImageVersion}}
- template: templates/release-docker-build-steps.yml
parameters:
targetOsArch: 'ubuntu2204_arm64'
imageVersion: ${{variables.containerImageVersion}}
- template: templates/release-docker-build-steps.yml
parameters:
targetOsArch: 'debian10_arm32'
Expand Down
36 changes: 36 additions & 0 deletions build/docker/ubuntu2204/amd64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Dockerfile for building DO client components for Ubuntu 22.04 amd64
# First, install the docker extension for VSCode. Then you can right-click on this file
# and choose Build Image. Give it a name and it will build the image.
#
# Open interactive terminal into the image in a container:
# docker run -ti --rm --entrypoint=/bin/bash -v <project root dir>:/code -v <build root dir>:/build <image_name>
# Example:
# docker run -ti --rm --entrypoint=/bin/bash -v D:\do-client-lite:/code -v D:\temp\build_client_lite\arm-linux-debug:/build custom-ubuntu2204-arm64

FROM mcr.microsoft.com/mirror/docker/library/ubuntu:22.04@sha256:2fdb1cf4995abb74c035e5f520c0f3a46f12b3377a59e86ecca66d8606ad64f9

SHELL [ "/bin/bash", "-c"]

# You can build the image by running in the current dockerfile directory
# sudo docker build -t <your image name> . --no-cache --network=host

# Ubuntu 22.04 requires user prompt for apt-get update command, docker has issues handling this input
# ENV DEBIAN_FRONTEND=noninteractive

COPY bootstrap.sh /tmp/bootstrap.sh

WORKDIR /tmp/
RUN chmod +x bootstrap.sh
RUN ./bootstrap.sh --install build

VOLUME /code
WORKDIR /code

ENTRYPOINT [ "/bin/bash", "-c"]

# We specify an empty command so that we can pass options to the ENTRYPOINT command.
# This is a bit of a Dockerfile quirk where if the ENTRYPOINT value is defined,
# then CMD becomes the default options passed to ENTRYPOINT.
# In this case we don't have any desired default arguments.
# However, we have to specify CMD to enable passing of command line parameters to ENTRYPOINT in the first place.
CMD [ ]
47 changes: 47 additions & 0 deletions build/docker/ubuntu2204/arm64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Dockerfile for building DO client components for Ubuntu 22.04 arm64
# First, install the docker extension for VSCode. Then you can right-click on this file
# and choose Build Image. Give it a name and it will build the image.
#
# Open interactive terminal into the image in a container:
# docker run -ti --rm --entrypoint=/bin/bash -v <project root dir>:/code -v <build root dir>:/build <image_name>
# Example:
# docker run -ti --rm --entrypoint=/bin/bash -v D:\do-client-lite:/code -v D:\temp\build_client_lite\arm-linux-debug:/build custom-ubuntu2204-arm64

FROM mcr.microsoft.com/mirror/docker/library/ubuntu:22.04@sha256:77bdd217935d10f0e753ed84118e9b11d3ab0a66a82bdf322087354ccd833733
SHELL [ "/bin/bash", "-c"]

# QEMU is a Linux emulator which enables cross-arch support in docker
# In order to build this image on a Linux host, need to install QEMU:
#
# sudo apt-get install qemu-user
# update-binfmts --display
# sudo apt install qemu binfmt-support qemu-user-static
# cp /usr/bin/qemu-aarch64-static <src root>/build/docker/ubuntu2204/arm64
#
# Then copy the build script to the build directory
# cp <src root>/build/bootstrap.sh <src root>build/docker/ubuntu2204/arm64
#
# After running the above, you can build the image by running in the current dockerfile directory
# sudo docker build -t <your image name> . --no-cache --network=host

# Ubuntu 22.04 requires user prompt for apt-get update command, docker has issues handling this input
ENV DEBIAN_FRONTEND=noninteractive

COPY qemu-aarch64-static /usr/bin/qemu-aarch64-static
COPY bootstrap.sh /tmp/bootstrap.sh

WORKDIR /tmp/
RUN chmod +x bootstrap.sh
RUN ./bootstrap.sh --install build

VOLUME /code
WORKDIR /code

ENTRYPOINT [ "/bin/bash", "-c"]

# We specify an empty command so that we can pass options to the ENTRYPOINT command.
# This is a bit of a Dockerfile quirk where if the ENTRYPOINT value is defined,
# then CMD becomes the default options passed to ENTRYPOINT.
# In this case we don't have any desired default arguments.
# However, we have to specify CMD to enable passing of command line parameters to ENTRYPOINT in the first place.
CMD [ ]
15 changes: 9 additions & 6 deletions build/scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,25 @@ function installBuildDependencies

apt-get install -y make build-essential g++ gdb gdbserver gcc git wget
apt-get install -y python3 ninja-build
apt-get install -y cmake libmsgsl-dev
apt-get install -y libboost-program-options-dev
apt-get install -y libproxy-dev libssl-dev uuid-dev libcurl4-openssl-dev
apt-get install -y cmake libmsgsl-dev
apt-get install -y file # Required by CPack for packaging and by default is not installed on Ubuntu 22.04


rm -rf /tmp/gtest
mkdir /tmp/gtest
pushd /tmp/gtest

if [[ ($DISTRO == "ubuntu" && $VER == "20.04") || ($DISTRO == "debian" && $VER == "10") ]];
if [[ ($DISTRO == "ubuntu" && ($VER == "20.04" || $VER == "22.04")) || ($DISTRO == "debian" && $VER == "10") ]];
then
if [[ $VER == "22.04" ]]; then release="v1.13.0"; else release="release-1.10.0"; fi;

# The latest native-version of gtest on ubuntu2004 and debian10 currently has a bug where
# CMakeLists doesn't declare an install target, causing 'make install' to fail.
# Clone from source and use release-1.10.0 instead, since gtest is a source package anyways.
git clone https://github.com/google/googletest.git .
git checkout release-1.10.0
git checkout $release
mkdir cmake
cd cmake
cmake /tmp/gtest
Expand Down Expand Up @@ -112,8 +116,7 @@ function installDeveloperTools
brew install cpplint
elif [ $OS == "linux" ];
then
apt-get install -y python-pip
pip install cpplint
apt install python3-pip

# Installs to a non-standard location so add to PATH manually
export PATH=$PATH:~/.local/bin
Expand Down Expand Up @@ -164,7 +167,7 @@ function installAll

function isSupportedLinux()
{
if [[ ($DISTRO == "ubuntu" && ($VER == "18.04" || $VER == "20.04"))
if [[ ($DISTRO == "ubuntu" && ($VER == "18.04" || $VER == "20.04" || $VER == "22.04"))
|| ($DISTRO == "debian" && ($VER == "10" || $VER == "11")) ]];
then
return 0
Expand Down
2 changes: 1 addition & 1 deletion client-lite/src/ipc/rest_port_advertiser.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <fcntl.h> // open, write
#include <unistd.h> // getpid
#include <sstream>
#include <gsl/gsl_util>
#include <gsl/gsl>
#include "do_filesystem.h"
#include "do_persistence.h"
#include "error_macros.h"
Expand Down
2 changes: 1 addition & 1 deletion common/lib-dohttp/do_http_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <iostream>
#endif
#include <regex>
#include <gsl/gsl_util>
#include <gsl/gsl>

namespace microsoft
{
Expand Down
2 changes: 1 addition & 1 deletion sdk-cpp/src/internal/rest/util/do_http_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Include this header explicitly to get it regardless of which boost version is installed.
#include <boost/asio/io_service.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <gsl/gsl_util>
#include <gsl/gsl>

#include "do_errors.h"
#include "do_error_helpers.h"
Expand Down

0 comments on commit d0e7d7f

Please sign in to comment.