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: variables:
DOCKER_HOST: tcp://docker:2375/ DOCKER_HOST: tcp://docker:2375/
image: registry.gitlab.com/sparetimecoder/build-tools image: registry.gitlab.com/sparetimecoders/build-tools
build: build:
stage: build stage: build
@@ -13,33 +13,14 @@ build:
services: services:
- docker:dind - docker:dind
script: script:
- docker version - build
- docker build --cache-from $CI_REGISTRY_IMAGE:latest -t $CI_REGISTRY_IMAGE:latest . - push
- 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
deploy-to-prod: deploy-to-prod:
<<: *deploy_template
stage: deploy-prod stage: deploy-prod
when: on_success when: on_success
script: script:
- echo Deploy Angus to PROD. - echo Deploy to PROD.
- deploy prod - deploy prod
environment: environment:
name: prod name: prod