diff --git a/.devcontainer/Dockerfile_AzureLinux b/.devcontainer/Dockerfile_AzureLinux index aea57c1..c64d1ce 100644 --- a/.devcontainer/Dockerfile_AzureLinux +++ b/.devcontainer/Dockerfile_AzureLinux @@ -1,33 +1,6 @@ FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 -# install all needed packages for builds -RUN yum install -y ca-certificates \ - git \ - gdb \ - zlib-devel \ - gcc \ - rpm-build \ - make \ - curl \ - libcurl-devel \ - libicu-devel \ - libunwind-devel \ - nmap \ - wget \ - clang \ - glibc-devel \ - kernel-headers-5.15.125.1-2.cm2.noarch \ - binutils \ - lsb-release \ - cmake \ - bpftool \ - libbpf-devel - -# install JQ since it doesn't have a .rpm package -RUN curl https://stedolan.github.io/jq/download/linux64/jq > /usr/bin/jq && chmod +x /usr/bin/jq - -# install .net core 6 for ESRP signing and integration tests -RUN yum install -y dotnet-sdk-6.0 - -# Update packages to latest -RUN yum update -y \ No newline at end of file +# Install dependencies +COPY install-azurelinux-dependencies.sh /usr/local/bin/install_dependencies.sh +RUN chmod +x /usr/local/bin/install_dependencies.sh && \ + /usr/local/bin/install_dependencies.sh \ No newline at end of file diff --git a/.devcontainer/Dockerfile_Rocky b/.devcontainer/Dockerfile_Rocky index e76448e..48d2547 100644 --- a/.devcontainer/Dockerfile_Rocky +++ b/.devcontainer/Dockerfile_Rocky @@ -1,42 +1,6 @@ -FROM rockylinux:8 +FROM mcr.microsoft.com/mirror/docker/library/rockylinux:8 -# install all needed packges to build .rpm packages -RUN echo "assumeyes=1" >> /etc/yum.conf - -# install endpoint for git > 2.0 -RUN yum install http://opensource.wandisco.com/rhel/8/git/x86_64/wandisco-git-release-8-1.noarch.rpm - -# Enable powertools and extra repos -RUN dnf install dnf-plugins-core && dnf install epel-release && dnf config-manager --set-enabled powertools && dnf update - -# install all needed packages for builds -RUN yum install git \ - gdb \ - zlib-devel \ - gcc-toolset-10 \ - rpm-build \ - make \ - curl \ - libcurl-devel \ - libicu-devel \ - libunwind-devel \ - nmap \ - wget \ - clang \ - redhat-lsb \ - cmake \ - elfutils-libelf-devel \ - libbpf-devel \ - bpftool - -# install JQ since it doesn't have a .rpm package -RUN curl https://stedolan.github.io/jq/download/linux64/jq > /usr/bin/jq && chmod +x /usr/bin/jq - -# install .net core 6 for ESRP signing and integration tests -RUN yum install dotnet-runtime-6.0 -RUN yum install dotnet-sdk-6.0 - -# Update packages to latest -RUN yum update - -WORKDIR /azp \ No newline at end of file +# Install dependencies +COPY install-rocky-dependencies.sh /usr/local/bin/install_dependencies.sh +RUN chmod +x /usr/local/bin/install_dependencies.sh && \ + /usr/local/bin/install_dependencies.sh \ No newline at end of file diff --git a/.devcontainer/Dockerfile_Ubuntu b/.devcontainer/Dockerfile_Ubuntu index b5a8d3c..6d9578c 100644 --- a/.devcontainer/Dockerfile_Ubuntu +++ b/.devcontainer/Dockerfile_Ubuntu @@ -1,63 +1,10 @@ -FROM ubuntu:20.04 +FROM mcr.microsoft.com/mirror/docker/library/ubuntu:20.04 # To make it easier for build and release pipelines to run apt-get, # configure apt to not require confirmation (assume the -y argument by default) ENV DEBIAN_FRONTEND=noninteractive -RUN echo "APT::Get::Assume-Yes \"true\";" > /etc/apt/apt.conf.d/90assumeyes -RUN apt-get update -RUN apt -y install software-properties-common -RUN add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main" -RUN apt-get update - -RUN apt upgrade -y \ - && apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - jq \ - git \ - iputils-ping \ - libcurl4 \ - libicu55 \ - libunwind8 \ - netcat \ - gdb \ - zlib1g-dev \ - stress-ng \ - wget \ - dpkg-dev \ - fakeroot \ - lsb-release \ - gettext \ - liblocale-gettext-perl \ - pax \ - cmake \ - libelf-dev \ - clang \ - clang-12 \ - llvm \ - build-essential \ - libbpf-dev - -# Set preference to clang-12 -RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 100 - -# Build and install bpftool -RUN rm -rf /usr/sbin/bpftool -RUN git clone --recurse-submodules https://github.com/libbpf/bpftool.git -WORKDIR bpftool/src -RUN make install -RUN ln -s /usr/local/sbin/bpftool /usr/sbin/bpftool - -# install debbuild -RUN wget https://github.com/debbuild/debbuild/releases/download/22.02.1/debbuild_22.02.1-0ubuntu20.04_all.deb \ - && dpkg -i debbuild_22.02.1-0ubuntu20.04_all.deb - -# install .NET 6 for signing process and integration tests -RUN wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb -RUN dpkg -i packages-microsoft-prod.deb -RUN rm packages-microsoft-prod.deb -RUN apt -y update && apt-get install -y dotnet-runtime-6.0 -RUN apt-get install -y dotnet-sdk-6.0 - -WORKDIR /azp \ No newline at end of file +# Install dependencies +COPY install-ubuntu-dependencies.sh /usr/local/bin/install_dependencies.sh +RUN chmod +x /usr/local/bin/install_dependencies.sh && \ + /usr/local/bin/install_dependencies.sh \ No newline at end of file diff --git a/.devcontainer/install-azurelinux.dependencies.sh b/.devcontainer/install-azurelinux.dependencies.sh new file mode 100644 index 0000000..5b296c4 --- /dev/null +++ b/.devcontainer/install-azurelinux.dependencies.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# install all needed packages for builds +yum install -y ca-certificates \ + git \ + gdb \ + zlib-devel \ + gcc \ + rpm-build \ + make \ + curl \ + libcurl-devel \ + libicu-devel \ + libunwind-devel \ + nmap \ + wget \ + clang \ + glibc-devel \ + kernel-headers-5.15.125.1-2.cm2.noarch \ + binutils \ + lsb-release \ + cmake \ + bpftool \ + libbpf-devel \ + sudo \ + which + +# install JQ since it doesn't have a .rpm package +curl https://stedolan.github.io/jq/download/linux64/jq > /usr/bin/jq && chmod +x /usr/bin/jq + +# install .net core 6 for ESRP signing and integration tests +yum install -y dotnet-sdk-6.0 + +# Update packages to latest +yum update -y \ No newline at end of file diff --git a/.devcontainer/install-rocky-dependencies.sh b/.devcontainer/install-rocky-dependencies.sh new file mode 100644 index 0000000..b65f21c --- /dev/null +++ b/.devcontainer/install-rocky-dependencies.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +echo "assumeyes=1" >> /etc/yum.conf +yum install http://opensource.wandisco.com/rhel/8/git/x86_64/wandisco-git-release-8-1.noarch.rpm +dnf install dnf-plugins-core && dnf install epel-release && dnf config-manager --set-enabled powertools && dnf update +yum install git \ + gdb \ + python3 \ + zlib-devel \ + gcc-toolset-10 \ + rpm-build \ + make \ + curl \ + libcurl-devel \ + libicu-devel \ + libunwind-devel \ + nmap \ + wget \ + clang \ + redhat-lsb \ + cmake \ + elfutils-libelf-devel \ + libbpf-devel \ + bpftool + +pip3 uninstall -y setuptools +pip3 uninstall -y pip +curl https://stedolan.github.io/jq/download/linux64/jq > /usr/bin/jq && chmod +x /usr/bin/jq +yum install dotnet-runtime-6.0 +yum install dotnet-sdk-6.0 \ No newline at end of file diff --git a/.devcontainer/install-ubuntu-dependencies.sh b/.devcontainer/install-ubuntu-dependencies.sh new file mode 100644 index 0000000..0ccb66b --- /dev/null +++ b/.devcontainer/install-ubuntu-dependencies.sh @@ -0,0 +1,58 @@ +#!/bin/bash +echo "APT::Get::Assume-Yes \"true\";" > sudo /etc/apt/apt.conf.d/90assumeyes +DEBIAN_FRONTEND=noninteractive +sudo apt-get update +sudo apt -y install software-properties-common +sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main" +sudo apt-get update +sudo apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + jq \ + git \ + iputils-ping \ + libcurl4 \ + libicu55 \ + libunwind8 \ + netcat \ + gdb \ + zlib1g-dev \ + stress-ng \ + wget \ + dpkg-dev \ + fakeroot \ + lsb-release \ + gettext \ + liblocale-gettext-perl \ + pax \ + cmake \ + libelf-dev \ + clang-12 \ + llvm \ + build-essential \ + libbpf-dev + +# Set preference to clang-12 +yes '' | sudo update-alternatives --force --all +sudo update-alternatives --remove-all clang +sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 100 +sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-12 100 +sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-12 100 + +# Build and install bpftool +sudo rm -rf /usr/sbin/bpftool +git clone --recurse-submodules https://github.com/libbpf/bpftool.git +cd bpftool/src +sudo make install +sudo ln -s /usr/local/sbin/bpftool /usr/sbin/bpftool + +# install debbuild +wget https://github.com/debbuild/debbuild/releases/download/22.02.1/debbuild_22.02.1-0ubuntu20.04_all.deb \ + && sudo dpkg -i debbuild_22.02.1-0ubuntu20.04_all.deb + +# install .NET 6 for signing process and integration tests +wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb +sudo dpkg -i packages-microsoft-prod.deb +rm packages-microsoft-prod.deb +sudo apt -y update && sudo apt-get install -y dotnet-runtime-6.0 +sudo apt-get install -y dotnet-sdk-6.0 \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1666048..8bf219b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -13,15 +13,14 @@ pr: stages: - stage: "Build" jobs: - - job: "ProcDump_Run_Unit_Tests" + - job: "ProcDump_Build_Run_Unit_Tests" pool: - name: "Sysinternals-for-Linux-AME" - demands: - - ImageOverride -equals procdump-ubuntu-build-agent + vmImage: "ubuntu-20.04" steps: - script: | clang --version clang++ --version + gcc --version displayName: 'List compiler versions' - script: | @@ -30,6 +29,17 @@ stages: service rsyslog start || true displayName: 'Enable syslog' + - script: | + chmod +x .devcontainer/install-ubuntu-dependencies.sh + .devcontainer/install-ubuntu-dependencies.sh + displayName: "Install pre-reqs for Ubuntu" + + - script: | + clang --version + clang++ --version + gcc --version + displayName: 'List compiler versions' + - template: templates/build.yaml - script: | @@ -56,13 +66,4 @@ stages: inputs: PathtoPublish: '$(Build.ArtifactStagingDirectory)/logs/procdumpprofiler.log' ArtifactName: 'procdumpprofiler.log' - publishLocation: 'Container' - - - job: "Build_ProcDump" - pool: - name: "Sysinternals-for-Linux-AME" - demands: - - ImageOverride -equals procdump-ubuntu-build-agent - steps: - - template: templates/build.yaml - displayName: 'Build ProcDump' + publishLocation: 'Container' \ No newline at end of file diff --git a/sudo b/sudo new file mode 100644 index 0000000..81ccc88 --- /dev/null +++ b/sudo @@ -0,0 +1 @@ +APT::Get::Assume-Yes "true"; /etc/apt/apt.conf.d/90assumeyes