980f5e2187
Introduces three new types representing each of the possible package sources and moves the logic for specifying the package source to the server. Concrete changes: * Determining whether a specified git reference is a commit vs. a branch/tag is now done in the server, and is done more precisely by using a regular expression. * Package sources now have a new `CacheKey` function which can be used to retrieve a key under which a build manifest can be cached *if* the package source is not a moving target (i.e. a full git commit hash of either nixpkgs or a private repository). This function is not yet used. * Users *must* now specify a package source, Nixery no longer defaults to anything and will fail to launch if no source is configured.
55 lines
1.8 KiB
YAML
55 lines
1.8 KiB
YAML
language: nix
|
|
services:
|
|
- docker
|
|
env:
|
|
- NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/88d9f776091896cfe57dc6fbdf246e7d27d5f105.tar.gz
|
|
before_script:
|
|
- mkdir test-files
|
|
- echo ${GOOGLE_KEY} | base64 -d > test-files/key.json
|
|
- echo ${GCS_SIGNING_PEM} | base64 -d > test-files/gcs.pem
|
|
- nix-env -f '<nixpkgs>' -iA cachix -A go
|
|
- cachix use nixery
|
|
script:
|
|
- test -z $(gofmt -l server/ build-image/)
|
|
- nix-build | cachix push nixery
|
|
|
|
# This integration test makes sure that the container image built
|
|
# for Nixery itself runs fine in Docker, and that images pulled
|
|
# from it work in Docker.
|
|
#
|
|
# Output from the Nixery container is printed at the end of the
|
|
# test regardless of test status.
|
|
- IMG=$(docker load -q -i $(nix-build -A nixery-image) | awk '{ print $3 }')
|
|
- echo "Loaded Nixery image as ${IMG}"
|
|
|
|
- |
|
|
docker run -d -p 8080:8080 --name nixery \
|
|
-v ${PWD}/test-files:/var/nixery \
|
|
-e PORT=8080 \
|
|
-e BUCKET=nixery-layers \
|
|
-e GOOGLE_CLOUD_PROJECT=nixery \
|
|
-e GOOGLE_APPLICATION_CREDENTIALS=/var/nixery/key.json \
|
|
-e GCS_SIGNING_ACCOUNT="${GCS_SIGNING_ACCOUNT}" \
|
|
-e GCS_SIGNING_KEY=/var/nixery/gcs.pem \
|
|
-e NIXERY_CHANNEL=nixos-unstable \
|
|
${IMG}
|
|
|
|
# print all of the container's logs regardless of success
|
|
- |
|
|
function print_logs {
|
|
echo "Nixery container logs:"
|
|
docker logs nixery
|
|
}
|
|
trap print_logs EXIT
|
|
|
|
# Give the container ~20 seconds to come up
|
|
- |
|
|
attempts=0
|
|
echo -n "Waiting for Nixery to start ..."
|
|
until $(curl --fail --silent "http://localhost:8080/v2/"); do
|
|
[[ attempts -eq 30 ]] && echo "Nixery container failed to start!" && exit 1
|
|
((attempts++))
|
|
echo -n "."
|
|
sleep 1
|
|
done
|
|
- docker run --rm localhost:8080/hello hello
|