diff options
Diffstat (limited to 'contrib/ci/ci.sh')
-rwxr-xr-x | contrib/ci/ci.sh | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/contrib/ci/ci.sh b/contrib/ci/ci.sh index 7dd3a957a..0719015b9 100755 --- a/contrib/ci/ci.sh +++ b/contrib/ci/ci.sh | |||
@@ -1,29 +1,33 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | set -evuo pipefail | 2 | set -exvuo pipefail |
3 | 3 | ||
4 | # Use podman if available, otherwise use docker. | 4 | # Requires podman |
5 | # Fails if neither is found in PATH | 5 | # Fails if not found in PATH |
6 | OCI_RUNTIME=$(which podman || which docker) | 6 | OCI_RUNTIME=$(which podman) |
7 | REPO_NAME=$(basename "${PWD}") | 7 | REPO_NAME=$(basename "${PWD}") |
8 | JOB_NAME="${1}" | 8 | JOB_NAME="${1}" |
9 | JOB_CONTAINER=$((grep CONTAINER_NAME ci/jobs/${JOB_NAME}/config.ini | cut -d' ' -f 3) || echo "${REPO_NAME}") | 9 | JOB_ARCH=$((grep CONTAINER_ARCH contrib/ci/jobs/${JOB_NAME}/config.ini | cut -d' ' -f 3) || echo "${2:-amd64}") |
10 | JOB_CONTAINER=$((grep CONTAINER_NAME contrib/ci/jobs/${JOB_NAME}/config.ini | cut -d' ' -f 3) || echo "localhost/${REPO_NAME}:${JOB_ARCH}") | ||
11 | CONTAINER_BUILD=$((grep CONTAINER_BUILD contrib/ci/jobs/${JOB_NAME}/config.ini | cut -d' ' -f 3) || echo "True") | ||
10 | 12 | ||
11 | echo "${JOB_CONTAINER}" | 13 | echo "Image name: ${JOB_CONTAINER}" |
12 | 14 | ||
13 | if [ "${JOB_CONTAINER}" = "${REPO_NAME}" ] ; then | 15 | if [ "${CONTAINER_BUILD}" = "True" ] ; then |
14 | "${OCI_RUNTIME}" build \ | 16 | "${OCI_RUNTIME}" build \ |
17 | --arch "${JOB_ARCH}" \ | ||
15 | -t "${JOB_CONTAINER}" \ | 18 | -t "${JOB_CONTAINER}" \ |
16 | -f ci/Containerfile . | 19 | -f contrib/ci/Containerfile . |
17 | fi | 20 | fi |
18 | 21 | ||
19 | "${OCI_RUNTIME}" run \ | 22 | "${OCI_RUNTIME}" run \ |
20 | --rm \ | 23 | --rm \ |
21 | -ti \ | 24 | -ti \ |
25 | --arch "${JOB_ARCH}" \ | ||
22 | --env CI_COMMIT_REF="$(git rev-parse HEAD)" \ | 26 | --env CI_COMMIT_REF="$(git rev-parse HEAD)" \ |
23 | --volume "${PWD}":/workdir \ | 27 | --volume "${PWD}":/workdir \ |
24 | --workdir /workdir \ | 28 | --workdir /workdir \ |
25 | "${JOB_CONTAINER}" \ | 29 | "${JOB_CONTAINER}" \ |
26 | ci/jobs/"${JOB_NAME}"/job.sh | 30 | contrib/ci/jobs/"${JOB_NAME}"/job.sh |
27 | 31 | ||
28 | top_dir=$(dirname "${BASH_SOURCE[0]}") | 32 | top_dir=$(dirname "${BASH_SOURCE[0]}") |
29 | 33 | ||