diff options
author | Axel Huebl <axel.huebl@plasma.ninja> | 2019-06-10 18:21:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-10 18:21:33 +0200 |
commit | d4008db75d1a15b07e8770aea79bc8342ec59fc3 (patch) | |
tree | 1ba9693a03f3589f54b9ed3e008e40cafb8ea9de | |
parent | 0953cd3a2efae8f05bf8bf7cecf346763e686541 (diff) | |
download | spack-d4008db75d1a15b07e8770aea79bc8342ec59fc3.tar.gz spack-d4008db75d1a15b07e8770aea79bc8342ec59fc3.tar.bz2 spack-d4008db75d1a15b07e8770aea79bc8342ec59fc3.tar.xz spack-d4008db75d1a15b07e8770aea79bc8342ec59fc3.zip |
CD: Package Index (#11665)
Build the docker image for the new package index REST API on each
merge/push to develop and master.
-rw-r--r-- | share/spack/packages/Dockerfile | 11 | ||||
-rwxr-xr-x | share/spack/packages/build-image.sh | 17 | ||||
l--------- | share/spack/packages/push-image.sh | 1 | ||||
-rwxr-xr-x | share/spack/packages/split.sh | 20 | ||||
-rwxr-xr-x | share/spack/qa/run-docker-tests | 4 |
5 files changed, 53 insertions, 0 deletions
diff --git a/share/spack/packages/Dockerfile b/share/spack/packages/Dockerfile new file mode 100644 index 0000000000..716a52ef68 --- /dev/null +++ b/share/spack/packages/Dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu:18.04 AS build-env +WORKDIR /build +RUN apt-get update && apt-get install -y jq +COPY packages.json ./ +COPY split.sh ./ +RUN /build/split.sh + +FROM nginx:mainline-alpine +COPY --from=build-env --chown=nginx:nginx /build/packages /build/packages.json /usr/share/nginx/html/api/ + +CMD ["nginx", "-g", "daemon off;"] diff --git a/share/spack/packages/build-image.sh b/share/spack/packages/build-image.sh new file mode 100755 index 0000000000..c068d11715 --- /dev/null +++ b/share/spack/packages/build-image.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +script="$( basename "$0" )" +cd "$( dirname "$0" )" + +export IMAGE="spack/packages.spack.io:latest" + +if [ "$script" '=' 'push-image.sh' ] ; then + docker push "${IMAGE}" +else + docker build -f -t "${IMAGE}" . +fi diff --git a/share/spack/packages/push-image.sh b/share/spack/packages/push-image.sh new file mode 120000 index 0000000000..b3fd71be24 --- /dev/null +++ b/share/spack/packages/push-image.sh @@ -0,0 +1 @@ +build-image.sh
\ No newline at end of file diff --git a/share/spack/packages/split.sh b/share/spack/packages/split.sh new file mode 100755 index 0000000000..2c499926cb --- /dev/null +++ b/share/spack/packages/split.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +# split the package index in a small file tree of +# /p/package.json +# files with sub-directories grouped by the initial letter of the packages + +base_dir=$(pwd)/packages/ + +for pkg in $(cat packages.json | jq -c '.[]') +do + name="$(echo ${pkg} | jq -r '.name')"; + first_letter=${name::1} + mkdir -p ${base_dir}${first_letter}/ + echo ${pkg} > ${base_dir}${first_letter}/${name}.json +done diff --git a/share/spack/qa/run-docker-tests b/share/spack/qa/run-docker-tests index 8613c7e728..9bd56535d3 100755 --- a/share/spack/qa/run-docker-tests +++ b/share/spack/qa/run-docker-tests @@ -37,10 +37,14 @@ for config in share/spack/docker/config/* ; do ./share/spack/docker/build-image.sh; done +spack list --format version_json > packages.json +./share/spack/packages/build-image.sh + if [ "$TEST_SUITE" '=' "docker" -a \ "$TRAVIS_EVENT_TYPE" != "pull_request" ] && ensure_docker_login ; then for config in share/spack/docker/config/* ; do source "$config" ./share/spack/docker/push-image.sh done + ./share/spack/packages/push-image.sh fi |