summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2020-02-18 18:10:06 +0000
committerGitHub <noreply@github.com>2020-02-18 18:10:06 +0000
commit1256b462114b9abccbf087d4ca59015721b83ac9 (patch)
tree7b2d696875ce6136def1c02132cee477ea9715e0
parent5254c9bb95d7571f46881c4378d8207a3499c289 (diff)
parenteaa70c6c36d3a8061e6c3ec5f95cf137fe1222ab (diff)
downloadlibgit2-1256b462114b9abccbf087d4ca59015721b83ac9.tar.gz
Merge pull request #5406 from libgit2/pks/azure-fix-arm32
azure: fix ARM32 builds by replacing gosu(1)
-rw-r--r--azure-pipelines/docker.yml6
-rw-r--r--azure-pipelines/docker/bionic10
-rw-r--r--azure-pipelines/docker/entrypoint.sh4
-rw-r--r--azure-pipelines/docker/xenial6
-rwxr-xr-xazure-pipelines/setup-linux.sh27
-rw-r--r--tests/object/cache.c8
6 files changed, 19 insertions, 42 deletions
diff --git a/azure-pipelines/docker.yml b/azure-pipelines/docker.yml
index 0e1988c8a..0f0885770 100644
--- a/azure-pipelines/docker.yml
+++ b/azure-pipelines/docker.yml
@@ -13,9 +13,9 @@ steps:
if [ -f /tmp/dockercache/${{parameters.docker.image}}.tar ]; then docker load < /tmp/dockercache/${{parameters.docker.image}}.tar; fi
displayName: 'Load Docker cache'
- script: |
- cd $(Build.SourcesDirectory)/azure-pipelines/docker
- docker build -t libgit2/${{parameters.docker.image}} --build-arg BASE=${{parameters.docker.base}} -f ${{parameters.docker.image}} .
- if [ ! -d /tmp/dockercache ]; then mkdir /tmp/dockercache; fi
+ cd $(Build.SourcesDirectory)/azure-pipelines/docker &&
+ docker build -t libgit2/${{parameters.docker.image}} --build-arg BASE=${{parameters.docker.base}} -f ${{parameters.docker.image}} . &&
+ if [ ! -d /tmp/dockercache ]; then mkdir /tmp/dockercache; fi &&
docker save libgit2/${{parameters.docker.image}} $(docker history -q libgit2/${{parameters.docker.image}} | grep -v '<missing>') > /tmp/dockercache/${{parameters.docker.image}}.tar
displayName: 'Build Docker image'
- task: docker@0
diff --git a/azure-pipelines/docker/bionic b/azure-pipelines/docker/bionic
index 648bda704..ae9604de7 100644
--- a/azure-pipelines/docker/bionic
+++ b/azure-pipelines/docker/bionic
@@ -1,13 +1,12 @@
ARG BASE
-FROM $BASE
+FROM $BASE AS apt
RUN apt-get update && \
- apt-get install -y --no-install-recommends \
+ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
clang \
cmake \
curl \
gcc \
git \
- gosu \
libcurl4-openssl-dev \
libpcre3-dev \
libssh2-1-dev \
@@ -19,11 +18,12 @@ RUN apt-get update && \
openssl \
pkgconf \
python \
+ sudo \
valgrind \
&& \
rm -rf /var/lib/apt/lists/*
-RUN mkdir /var/run/sshd
+FROM apt AS mbedtls
RUN cd /tmp && \
curl --location --silent https://tls.mbed.org/download/mbedtls-2.16.2-apache.tgz | \
tar -xz && \
@@ -34,7 +34,9 @@ RUN cd /tmp && \
cd .. && \
rm -rf mbedtls-2.16.2
+FROM mbedtls AS configure
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod a+x /usr/local/bin/entrypoint.sh
+RUN mkdir /var/run/sshd
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
diff --git a/azure-pipelines/docker/entrypoint.sh b/azure-pipelines/docker/entrypoint.sh
index 38eedf02b..830df49e9 100644
--- a/azure-pipelines/docker/entrypoint.sh
+++ b/azure-pipelines/docker/entrypoint.sh
@@ -1,4 +1,4 @@
#!/bin/bash -e
useradd --shell /bin/bash libgit2
-chown -R $(id -u libgit2) /home/libgit2
-exec gosu libgit2 "$@"
+chown --recursive libgit2:libgit2 /home/libgit2
+exec sudo --preserve-env --user=libgit2 "$@"
diff --git a/azure-pipelines/docker/xenial b/azure-pipelines/docker/xenial
index cb5d4919a..8b2501de6 100644
--- a/azure-pipelines/docker/xenial
+++ b/azure-pipelines/docker/xenial
@@ -8,7 +8,6 @@ RUN apt-get update && \
curl \
gcc \
git \
- gosu \
krb5-user \
libcurl4-gnutls-dev \
libgcrypt20-dev \
@@ -23,7 +22,10 @@ RUN apt-get update && \
openssl \
pkgconf \
python \
- valgrind
+ sudo \
+ valgrind \
+ && \
+ rm -rf /var/lib/apt/lists/*
FROM apt AS mbedtls
RUN cd /tmp && \
diff --git a/azure-pipelines/setup-linux.sh b/azure-pipelines/setup-linux.sh
deleted file mode 100755
index c5ecb550b..000000000
--- a/azure-pipelines/setup-linux.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-
-set -e
-set -x
-
-TMPDIR=${TMPDIR:-/tmp}
-
-if [ -z "$SKIP_APT" ]; then
- apt-get update
- apt-get -y install build-essential pkg-config clang cmake openssl libssl-dev libssh2-1-dev libcurl4-gnutls-dev openssh-server
-fi
-
-mkdir -p /var/run/sshd
-
-if [ "$MBEDTLS" ]; then
- MBEDTLS_DIR=${MBEDTLS_DIR:-$(mktemp -d ${TMPDIR}/mbedtls.XXXXXXXX)}
-
- git clone --depth 10 --single-branch --branch mbedtls-2.6.1 https://github.com/ARMmbed/mbedtls.git ${MBEDTLS_DIR}
- cd ${MBEDTLS_DIR}
-
- CFLAGS=-fPIC cmake -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF -DUSE_SHARED_MBEDTLS_LIBRARY=OFF -DUSE_STATIC_MBEDTLS_LIBRARY=ON .
- cmake --build .
-
- if [ -z "$SKIP_MBEDTLS_INSTALL" ]; then
- make install
- fi
-fi
diff --git a/tests/object/cache.c b/tests/object/cache.c
index 3ccc325e4..08bf03648 100644
--- a/tests/object/cache.c
+++ b/tests/object/cache.c
@@ -244,15 +244,15 @@ static void *cache_quick(void *arg)
void test_object_cache__fast_thread_rush(void)
{
- int try, th, data[THREADCOUNT*2];
+ int try, th, data[THREADCOUNT];
#ifdef GIT_THREADS
- git_thread t[THREADCOUNT*2];
+ git_thread t[THREADCOUNT];
#endif
for (try = 0; try < REPEAT; ++try) {
cl_git_pass(git_repository_open(&g_repo, cl_fixture("testrepo.git")));
- for (th = 0; th < THREADCOUNT*2; ++th) {
+ for (th = 0; th < THREADCOUNT; ++th) {
data[th] = th;
#ifdef GIT_THREADS
cl_git_pass(
@@ -263,7 +263,7 @@ void test_object_cache__fast_thread_rush(void)
}
#ifdef GIT_THREADS
- for (th = 0; th < THREADCOUNT*2; ++th) {
+ for (th = 0; th < THREADCOUNT; ++th) {
void *rval;
cl_git_pass(git_thread_join(&t[th], &rval));
cl_assert_equal_i(th, *((int *)rval));