Update CI

This commit is contained in:
Grégoire Henry 2017-03-05 02:15:14 +01:00
parent 05d210b982
commit 585f24b222

View File

@ -1,31 +1,24 @@
variables: variables:
image_name: ocp_tezos public_docker_image: docker.io/tezos/tezos
image_id: ${CI_BUILD_REF_NAME}
build_image_name: ${image_name}_build_deps
build_image_id: ${CI_BUILD_REF}
private_registry: registry.ocamlpro.com:8443
private_image_id: $private_registry/${CI_PROJECT_PATH}
public_image_id: docker.io/tezosledger/tezos:latest
image: ${build_image_name}:${build_image_id} image: ${CI_REGISTRY_IMAGE}:${CI_BUILD_REF}_build_deps
stages: stages:
- build_deps - build_deps
- build - build
- build_test
- test - test
- expurge - build_docker
- publish - publish
- cleanup - cleanup
build_deps: build_deps:
stage: build_deps stage: build_deps
image: ocp:docker image: docker:latest
tags: tags:
- docker_builder - docker_builder
script: script:
- ./scripts/create_build_deps_docker_image.sh - ./scripts/create_build_deps_docker_image.sh
${build_image_name} ${build_image_id} ${CI_REGISTRY_IMAGE} ${CI_BUILD_REF}_build_deps
build: build:
stage: build stage: build
@ -33,19 +26,8 @@ build:
- tezos_builder - tezos_builder
script: script:
- echo "PRODUCTION=yes" > src/Makefile.local - echo "PRODUCTION=yes" > src/Makefile.local
- make -j4 - make -C src -j4
artifacts: - make -C test -j4 build-test
expire_in: 1 week
untracked: true
build:test:
stage: build_test
tags:
- tezos_builder
script:
- make -C test build-test -j4
dependencies:
- build
artifacts: artifacts:
expire_in: 1 week expire_in: 1 week
untracked: true untracked: true
@ -58,7 +40,6 @@ test:store:
- make -C test run-test-store - make -C test run-test-store
dependencies: dependencies:
- build - build
- build:test
test:context: test:context:
stage: test stage: test
@ -68,7 +49,6 @@ test:context:
- make -C test run-test-context - make -C test run-test-context
dependencies: dependencies:
- build - build
- build:test
test:state: test:state:
stage: test stage: test
@ -78,7 +58,6 @@ test:state:
- make -C test run-test-state - make -C test run-test-state
dependencies: dependencies:
- build - build
- build:test
test:basic: test:basic:
stage: test stage: test
@ -88,7 +67,6 @@ test:basic:
- make -C test run-test-basic - make -C test run-test-basic
dependencies: dependencies:
- build - build
- build:test
test:basic.sh: test:basic.sh:
stage: test stage: test
@ -98,7 +76,6 @@ test:basic.sh:
- make -C test run-test-basic.sh - make -C test run-test-basic.sh
dependencies: dependencies:
- build - build
- build:test
test:data-encoding: test:data-encoding:
stage: test stage: test
@ -108,7 +85,6 @@ test:data-encoding:
- make -C test run-test-data-encoding - make -C test run-test-data-encoding
dependencies: dependencies:
- build - build
- build:test
test:p2p-io-scheduler: test:p2p-io-scheduler:
stage: test stage: test
@ -118,7 +94,6 @@ test:p2p-io-scheduler:
- make -C test run-test-p2p-io-scheduler - make -C test run-test-p2p-io-scheduler
dependencies: dependencies:
- build - build
- build:test
test:p2p-connection: test:p2p-connection:
stage: test stage: test
@ -128,7 +103,6 @@ test:p2p-connection:
- make -C test run-test-p2p-connection - make -C test run-test-p2p-connection
dependencies: dependencies:
- build - build
- build:test
test:p2p-connection-pool: test:p2p-connection-pool:
stage: test stage: test
@ -138,27 +112,40 @@ test:p2p-connection-pool:
- make -C test run-test-p2p-connection-pool - make -C test run-test-p2p-connection-pool
dependencies: dependencies:
- build - build
- build:test
build:docker:
stage: build_docker
image: docker:latest
tags:
- docker_builder
script:
- source scripts/version.sh
- sed scripts/Dockerfile.binaries.in
-e 's/$alpine_version/'"$alpine_version"'/g' > Dockerfile
- mkdir bin
- cp tezos-client tezos-node tezos-protocol-compiler bin/
- docker build -q -t "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF}" .
- docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "${CI_REGISTRY}"
- docker tag "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF}"
"${CI_REGISTRY_IMAGE}:${CI_BUILD_REF_NAME}"
- docker push "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF_NAME}"
- docker rmi "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF_NAME}"
publish:docker: publish:docker:
stage: publish stage: publish
image: ocp:docker image: docker:latest
tags: tags:
- public_docker_builder - docker_builder
only:
- master@tezos/tezos
- alphanet@tezos/tezos
script: script:
- ./scripts/create_docker_image.sh ${image_name} ${build_image_id} - mkdir -p ~/.docker ;
- docker tag ${image_name}:${build_image_id} - echo "$CI_DOCKER_AUTH" > ~/.docker/config.json ;
"$private_image_id:$CI_BUILD_REF_NAME" - docker tag "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF_NAME}"
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $private_registry "${public_docker_image}:${CI_BUILD_REF_NAME}"
- docker push "$private_image_id:$CI_BUILD_REF_NAME" - docker push "${public_docker_image}:${CI_BUILD_REF_NAME}"
- docker rmi "$private_image_id:$CI_BUILD_REF_NAME" - docker rmi "${public_docker_image}:${CI_BUILD_REF_NAME}"
- if [ "$CI_PROJECT_PATH" = "tezos/tezos" -a "$CI_BUILD_REF_NAME" = "master" ]; then
mkdir -p ~/.docker ;
echo "$CI_DOCKER_AUTH" > ~/.docker/config.json ;
docker tag ${image_name}:${build_image_id} ${public_image_id} ;
docker push ${public_image_id} ;
docker rmi ${public_image_id} ;
fi
publish:github: publish:github:
image: ocaml/opam image: ocaml/opam
@ -190,12 +177,13 @@ publish:github:
cleanup: cleanup:
stage: cleanup stage: cleanup
image: ocp:docker image: docker:latest
tags: tags:
- docker_builder - docker_builder
script: script:
- docker tag ${build_image_name}:${build_image_id} - docker tag "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF}_build_deps"
${build_image_name}:${CI_PROJECT_NAMESPACE}_${CI_BUILD_REF_NAME} "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF_NAME}_build_deps"
- docker rmi ${build_image_name}:${build_image_id} - docker rmi "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF}_build_deps"
- docker rmi "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF}"
when: always when: always
allow_failure: true allow_failure: true