Commit 4f09ff7d authored by Christian Schnidrig's avatar Christian Schnidrig

k8s

parent 7b9d9630
# To include this in your repo add the following line to `.gitlab-ci.yml`
#include: 'https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.cloud.switch.ch/petasolutions-switch-ch/ansible-vars/raw/Release/gitlab-ci/docker-k8s.yml'
variables:
TEST_IMAGE: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME"
RELEASE_IMAGE: "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"
stages:
- build
- release
- deploy
before_script:
- "docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY"
build:
image: "docker:stable"
stage: build
script:
- "docker build --pull --no-cache -t $TEST_IMAGE image"
- "docker push $TEST_IMAGE"
only:
- tags
- /^Development.*$/
tags:
- docker
release:
image: "docker:stable"
stage: release
script:
- "docker pull $TEST_IMAGE || true"
- "docker tag $TEST_IMAGE $RELEASE_IMAGE"
- "docker push $RELEASE_IMAGE"
only:
- tags
tags:
- docker
deploy_s1:
image: "$CI_REGISTRY/petasolutions-switch-ch/docker-ansible-runner:master"
stage: deploy
script:
- echo "$vault_password" > ./vault_password
- echo -e "machine gitlab.cloud.switch.ch\nlogin gitlab-ci-token\npassword ${CI_JOB_TOKEN}" > ~/.netrc
- chmod o-w .
- ansible-galaxy install -fr roles/requirements.yml
- mkdir ~/.kube
- cp galaxy/vars/group_vars/all/vault/kube-config ~/.kube/config
- ansible-vault --vault-password-file=./vault_password decrypt ~/.kube/config
- ansible-playbook -i inventory/${CI_ENVIRONMENT_NAME} deploy.yml -t openstack-exporter
environment: s1
only:
- /^Release.*$/
tags:
- docker
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment