azure: build Docker images as part of the pipeline The Docker images used for our continuous integration builds currently live in the libgit2/libgit2-docker repository. To make any changes in them, one has to make a PR there, get it reviewed, re-build the images and publish them to Docker Hub. This process is slow and tedious, making it harder than necessary to perform any updates to our Docker-based build pipeline. To fix this, we include all Dockerfiles used by Azure from the mentioned repository and inline them into our own repo. Instead of having to manually push them to the CI, it will now build the required containers on each pull request, allowing much greater flexibility.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index dda7ad5..231981d 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -13,7 +13,9 @@ jobs:
steps:
- template: azure-pipelines/docker.yml
parameters:
- imageName: 'libgit2/trusty-amd64:latest'
+ docker:
+ image: trusty
+ base: ubuntu:trusty
environmentVariables: |
CC=gcc
CMAKE_GENERATOR=Unix Makefiles
@@ -26,7 +28,9 @@ jobs:
steps:
- template: azure-pipelines/docker.yml
parameters:
- imageName: 'libgit2/trusty-amd64:latest'
+ docker:
+ image: trusty
+ base: ubuntu:trusty
environmentVariables: |
CC=gcc
CMAKE_GENERATOR=Unix Makefiles
@@ -39,7 +43,9 @@ jobs:
steps:
- template: azure-pipelines/docker.yml
parameters:
- imageName: 'libgit2/trusty-amd64:latest'
+ docker:
+ image: trusty
+ base: ubuntu:trusty
environmentVariables: |
CC=clang
CMAKE_GENERATOR=Unix Makefiles
@@ -52,7 +58,9 @@ jobs:
steps:
- template: azure-pipelines/docker.yml
parameters:
- imageName: 'libgit2/trusty-amd64:latest'
+ docker:
+ image: trusty
+ base: ubuntu:trusty
environmentVariables: |
CC=clang
CMAKE_GENERATOR=Unix Makefiles
@@ -137,6 +145,10 @@ jobs:
vmImage: 'Ubuntu 16.04'
steps:
- script: |
+ cd $(Build.SourcesDirectory)/azure-pipelines/docker
+ docker build -t libgit2/docurium --build-arg BASE=ubuntu:trusty -f docurium .
+ displayName: 'Build Docker image'
+ - script: |
git config user.name 'Documentation Generation'
git config user.email 'libgit2@users.noreply.github.com'
git branch gh-pages origin/gh-pages
diff --git a/azure-pipelines/docker.yml b/azure-pipelines/docker.yml
index 2bbe686..ce1e73d 100644
--- a/azure-pipelines/docker.yml
+++ b/azure-pipelines/docker.yml
@@ -4,11 +4,15 @@ steps:
- script: docker run --rm --privileged multiarch/qemu-user-static:register --reset
displayName: 'Register Docker QEMU'
+- script: |
+ cd $(Build.SourcesDirectory)/azure-pipelines/docker
+ docker build -t libgit2/${{parameters.docker.image}} --build-arg BASE=${{parameters.docker.base}} -f ${{parameters.docker.image}} .
+ displayName: 'Build Docker image'
- task: docker@0
displayName: Build
inputs:
action: 'Run an image'
- imageName: ${{ parameters.imageName }}
+ imageName: libgit2/${{ parameters.docker.image }}
volumes: |
$(Build.SourcesDirectory):/src
$(Build.BinariesDirectory):/build
@@ -20,7 +24,7 @@ steps:
displayName: Test
inputs:
action: 'Run an image'
- imageName: ${{ parameters.imageName }}
+ imageName: libgit2/${{ parameters.docker.image }}
volumes: |
$(Build.SourcesDirectory):/src
$(Build.BinariesDirectory):/build
diff --git a/azure-pipelines/docker/bionic b/azure-pipelines/docker/bionic
new file mode 100644
index 0000000..7cd906b
--- /dev/null
+++ b/azure-pipelines/docker/bionic
@@ -0,0 +1,7 @@
+ARG BASE
+FROM $BASE
+ARG CACHEBUST=1
+RUN apt-get update
+RUN apt-get -y install pkgconf clang git cmake curl libssl-dev libcurl4 libcurl4-openssl-dev libssh2-1-dev libz-dev valgrind openssh-client openssh-server
+RUN if [ "$ARCH" != "armhf" -a "$ARCH" != "arm64" ]; then apt-get -y install openjdk-11-jre-headless; fi
+RUN mkdir /var/run/sshd
diff --git a/azure-pipelines/docker/docurium b/azure-pipelines/docker/docurium
new file mode 100644
index 0000000..15d10a7
--- /dev/null
+++ b/azure-pipelines/docker/docurium
@@ -0,0 +1,6 @@
+FROM debian:jessie-slim
+ARG CACHEBUST=1
+RUN apt-get update
+RUN apt install -y cmake pkg-config ruby ruby-dev llvm libclang-3.5-dev libssl-dev python-pygments
+ARG CACHEBUST=1
+RUN gem install docurium
diff --git a/azure-pipelines/docker/trusty b/azure-pipelines/docker/trusty
new file mode 100644
index 0000000..67e6ec1
--- /dev/null
+++ b/azure-pipelines/docker/trusty
@@ -0,0 +1,20 @@
+ARG BASE
+FROM $BASE
+ARG CACHEBUST=1
+
+RUN apt-get update
+RUN apt-get install -y curl apt-transport-https software-properties-common
+RUN curl -sSL "https://bintray.com/user/downloadSubjectPublicKey?username=bintray" | apt-key add -
+RUN echo "deb https://dl.bintray.com/libgit2/ci-dependencies trusty libgit2deps" >> /etc/apt/sources.list
+RUN add-apt-repository ppa:openjdk-r/ppa -y
+RUN apt-get update
+RUN apt-get -y install clang git cmake libssl-dev libcurl3 libcurl3-gnutls libcurl4-gnutls-dev libssh2-1-dev valgrind openssh-client openssh-server openjdk-8-jre libpcre3 libpcre3-dev
+
+RUN git clone --branch mbedtls-2.6.1 https://github.com/ARMmbed/mbedtls.git /tmp/mbedtls
+RUN (cd /tmp/mbedtls && scripts/config.pl set MBEDTLS_MD4_C 1)
+RUN (cd /tmp/mbedtls && CFLAGS=-fPIC cmake -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF -DUSE_SHARED_MBEDTLS_LIBRARY=OFF -DUSE_STATIC_MBEDTLS_LIBRARY=ON .)
+RUN (cd /tmp/mbedtls && cmake --build .)
+RUN (cd /tmp/mbedtls && make install)
+RUN rm -rf /tmp/mbedtls
+
+RUN mkdir /var/run/sshd
diff --git a/azure-pipelines/docker/xenial b/azure-pipelines/docker/xenial
new file mode 100644
index 0000000..f82f272
--- /dev/null
+++ b/azure-pipelines/docker/xenial
@@ -0,0 +1,6 @@
+ARG BASE
+FROM $BASE
+ARG CACHEBUST=1
+RUN apt-get update
+RUN apt-get -y install pkgconf clang git cmake curl libssl-dev libcurl3 libcurl3-gnutls libcurl4-gnutls-dev valgrind openssh-client openssh-server openjdk-8-jre
+RUN mkdir /var/run/sshd
diff --git a/azure-pipelines/nightly.yml b/azure-pipelines/nightly.yml
index 96cc3e5..8bcccd7 100644
--- a/azure-pipelines/nightly.yml
+++ b/azure-pipelines/nightly.yml
@@ -9,7 +9,9 @@ jobs:
steps:
- template: docker.yml
parameters:
- imageName: 'libgit2/trusty-amd64:latest'
+ docker:
+ image: trusty
+ base: ubuntu:trusty
environmentVariables: |
CC=gcc
CMAKE_GENERATOR=Unix Makefiles
@@ -23,7 +25,9 @@ jobs:
steps:
- template: docker.yml
parameters:
- imageName: 'libgit2/trusty-amd64:latest'
+ docker:
+ image: trusty
+ base: ubuntu:trusty
environmentVariables: |
CC=gcc
CMAKE_GENERATOR=Unix Makefiles
@@ -37,7 +41,9 @@ jobs:
steps:
- template: docker.yml
parameters:
- imageName: 'libgit2/trusty-amd64:latest'
+ docker:
+ image: trusty
+ base: ubuntu:trusty
environmentVariables: |
CC=clang
CMAKE_GENERATOR=Unix Makefiles
@@ -51,7 +57,9 @@ jobs:
steps:
- template: docker.yml
parameters:
- imageName: 'libgit2/trusty-amd64:latest'
+ docker:
+ image: trusty
+ base: ubuntu:trusty
environmentVariables: |
CC=clang
CMAKE_GENERATOR=Unix Makefiles
@@ -144,7 +152,9 @@ jobs:
- template: docker.yml
parameters:
qemu: 'true'
- imageName: 'libgit2/bionic-x86:latest'
+ docker:
+ image: bionic
+ base: multiarch/ubuntu-core:x86-bionic
environmentVariables: |
CC=gcc
CMAKE_GENERATOR=Unix Makefiles
@@ -159,7 +169,9 @@ jobs:
- template: docker.yml
parameters:
qemu: 'true'
- imageName: 'libgit2/bionic-x86:latest'
+ docker:
+ image: bionic
+ base: multiarch/ubuntu-core:x86-bionic
environmentVariables: |
CC=clang
CMAKE_GENERATOR=Unix Makefiles
@@ -174,7 +186,9 @@ jobs:
- template: docker.yml
parameters:
qemu: 'true'
- imageName: 'libgit2/bionic-arm32:latest'
+ docker:
+ image: bionic
+ base: multiarch/ubuntu-core:armhf-bionic
environmentVariables: |
CC=gcc
CMAKE_GENERATOR=Unix Makefiles
@@ -190,7 +204,9 @@ jobs:
- template: docker.yml
parameters:
qemu: 'true'
- imageName: 'libgit2/bionic-arm64:latest'
+ docker:
+ image: bionic
+ base: multiarch/ubuntu-core:arm64-bionic
environmentVariables: |
CC=gcc
CMAKE_GENERATOR=Unix Makefiles