Update build pipeline

This commit is contained in:
2019-01-01 11:30:28 +01:00
parent ee700ec0e2
commit 9dcf3b6828
+4 -23
View File
@@ -5,7 +5,7 @@ stages:
variables:
DOCKER_HOST: tcp://docker:2375/
image: registry.gitlab.com/sparetimecoder/build-tools
image: registry.gitlab.com/sparetimecoders/build-tools
build:
stage: build
@@ -13,33 +13,14 @@ build:
services:
- docker:dind
script:
- docker version
- docker build --cache-from $CI_REGISTRY_IMAGE:latest -t $CI_REGISTRY_IMAGE:latest .
- docker tag $CI_REGISTRY_IMAGE:latest $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker push $CI_REGISTRY_IMAGE:latest
.deploy: &deploy_template
before_script:
- mkdir -p ~/.kube
- echo ${KUBECONFIG_CONTENT} | base64 -d > ~/.kube/config
- kubectl config get-contexts
- |
cat <<EOF > .buildtools
declare -A valid_environments
valid_environments=(
["staging"]="--context k8s.unbound.se --namespace staging"
["prod"]="--context k8s.unbound.se --namespace default"
)
EOF
- build
- push
deploy-to-prod:
<<: *deploy_template
stage: deploy-prod
when: on_success
script:
- echo Deploy Angus to PROD.
- echo Deploy to PROD.
- deploy prod
environment:
name: prod