File: ci-docker-run

package info (click to toggle)
apptainer 1.4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 12,748 kB
  • sloc: sh: 3,321; ansic: 1,706; awk: 414; python: 103; makefile: 54
file content (35 lines) | stat: -rwxr-xr-x 1,407 bytes parent folder | download
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
#!/bin/bash -e
# Copyright (c) Contributors to the Apptainer project, established as
#   Apptainer a Series of LF Projects LLC.
#   For website terms of use, trademark policy, privacy policy and other
#   project policies see https://lfprojects.org/policies

# Run docker as shown at
#  https://djw8605.github.io/2016/05/03/building-centos-packages-on-travisci/
#
# This more complicated setup is needed for github actions too because 
#  they do not provide a mechanism for directly using docker --privileged,
#  which is needed for any reasonable subset of apptainer tests to succeed
#  (it is not needed for building, just for testing).
# Github actions does at least start a VM with docker already running.

DOCKER_HUB_URI="$OS_TYPE:$OS_VERSION"
docker pull "$DOCKER_HUB_URI"

DOCKER_CONTAINER_NAME="test_${OS_TYPE##*/}_${OS_VERSION//./_}"
PKGTYPE=rpm
if [ "$OS_TYPE" = "debian" ] || [ "$OS_TYPE" = "ubuntu" ]; then
    PKGTYPE=deb
fi

CONTAINER_VERS="${CONTAINER_VERS:-$DOCKER_HUB_URI}"

docker run --privileged --network=host -v "$(pwd):/build:rw" \
  -e OS_TYPE=$OS_TYPE -e GO_ARCH=$GO_ARCH -e CONTAINER_VERS="$CONTAINER_VERS" \
  -e HIDE_DIST=$HIDE_DIST -e INS_OPTS="$INS_OPTS" \
  --name "$DOCKER_CONTAINER_NAME" "$DOCKER_HUB_URI" /bin/bash -exc \
	"cd /build && scripts/ci-${TEST_TYPE:-$PKGTYPE-build}-test"

docker ps -a
docker stop "$DOCKER_CONTAINER_NAME"
docker rm -v "$DOCKER_CONTAINER_NAME"