-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
46 lines (44 loc) · 1.48 KB
/
.gitlab-ci.yml
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
36
37
38
39
40
41
42
43
44
45
46
variables:
REGISTRY: gitlab.informatik.hu-berlin.de:4567
build_all:
image: $REGISTRY/ti/software/bazel-builder:latest
stage: build
tags:
- aes
script:
- bazel build ...
- bazel test ...
- mkdir logs && cp -rL bazel-testlogs/* logs # Artifacts have to be in the workspace, but bazel-testlogs is a symlink that points outside of it.
artifacts:
when: always
paths:
- logs
deploy:
image: docker:stable
stage: deploy
tags:
- dockerimage
services:
- docker:dind # Needed until container_push works (https://github.com/google/containerregistry/issues/42)
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $REGISTRY
script:
- docker run --rm
-e CACHE_USER="$CACHE_USER"
-e CACHE_PASSWORD="$CACHE_PASSWORD"
-v /var/run/docker.sock:/var/run/docker.sock
-v "$PWD":/data "$REGISTRY"/ti/software/bazel-builder:latest
"cd /data && bazel run -c opt //sparse_linear_algebra/experiments:all_images"
- docker images --format "{{.Repository}} {{.Tag}}"
| grep -E "^$REGISTRY/$CI_PROJECT_PATH"
| grep -E 'latest$'
| cut -d" " -f1
| while read image; do
docker tag $image $image:$CI_COMMIT_SHA;
docker tag $image $image:$CI_COMMIT_REF_SLUG;
docker push $image:$CI_COMMIT_SHA;
docker push $image:$CI_COMMIT_REF_SLUG;
if [ "$CI_COMMIT_REF_SLUG" = "master" ]; then
docker push $image:latest;
fi;
done;