Skip to content
Snippets Groups Projects
Verified Commit 01a444aa authored by Varac's avatar Varac
Browse files

Use ci template for ci ssh setup

parent 69534d4c
No related branches found
No related tags found
No related merge requests found
include:
- .gitlab/ci_templates/kaniko.yml
- .gitlab/ci_templates/ssh_setup.yml
stages:
- build
- setup-cluster
......@@ -36,14 +37,7 @@ ci_test_image:
bootstrap:
stage: setup-cluster
before_script:
- ansible --version
script:
# Ensure test/ is not world-writable otherwise ansible-playbook refuses to run, see
# https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir
- chmod 755 ansible/
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- echo "hostname $HOSTNAME, subdomain $SUBDOMAIN, domain $DOMAIN, address $ADDRESS"
- python3 -m openappstack $HOSTNAME create --create-droplet $DOMAIN --hostname $HOSTNAME --ssh-key-id $SSH_KEY_ID --create-domain-records --subdomain $SUBDOMAIN
- python3 -m openappstack $HOSTNAME install --ansible-param='--skip-tags=helmfile'
......@@ -59,17 +53,11 @@ bootstrap:
- helmfiles/**/*
- test/**/*
- openappstack/**/*
extends: .ssh_setup
install:
stage: install-apps
variables:
ANSIBLE_HOST_KEY_CHECKING: 'False'
script:
# Ensure test/ is not world-writable otherwise ansible-playbook refuses to run, see
# https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir
- chmod 755 ansible/
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- python3 -m openappstack $HOSTNAME install --ansible-param='--tags=helmfile'
# Show versions of installed apps/binaries
- ansible master -m shell -a 'oas-version-info.sh 2>&1'
......@@ -85,14 +73,11 @@ install:
- helmfiles/**/*
- test/**/*
- openappstack/**/*
extends: .ssh_setup
testinfra:
stage: health-test
script:
- mkdir ~/.ssh
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- echo -e 'Host *\n stricthostkeychecking no' > ~/.ssh/config
- cd ansible/
- pytest -v -m 'testinfra' --connection=ansible --ansible-inventory=../clusters/${HOSTNAME}/inventory.yml --hosts='ansible://*'
only:
......@@ -102,15 +87,12 @@ testinfra:
- helmfiles/**/*
- test/**/*
- openappstack/**/*
extends: .ssh_setup
certs:
stage: health-test
allow_failure: true
script:
- mkdir ~/.ssh
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- echo -e 'Host *\n stricthostkeychecking no' > ~/.ssh/config
- cd ansible/
- pytest -s -m 'certs' --connection=ansible --ansible-inventory=../clusters/${HOSTNAME}/inventory.yml --hosts='ansible://*'
only:
......@@ -120,6 +102,7 @@ certs:
- helmfiles/**/*
- test/**/*
- openappstack/**/*
extends: .ssh_setup
prometheus-alerts:
stage: health-test
......@@ -127,10 +110,6 @@ prometheus-alerts:
OAS_DOMAIN: 'ci-${CI_PIPELINE_ID}.ci.openappstack.net'
allow_failure: true
script:
- mkdir ~/.ssh
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- echo -e 'Host *\n stricthostkeychecking no' > ~/.ssh/config
- cd test/
- pytest -s -m 'prometheus' --connection=ansible --ansible-inventory=../clusters/${HOSTNAME}/inventory.yml --hosts='ansible://*'
only:
......@@ -139,6 +118,7 @@ prometheus-alerts:
- ansible/**/*
- helmfiles/**/*
- test/**/*
extends: .ssh_setup
behave-nextcloud:
stage: integration-test
......
.ssh_setup:
before_script:
- mkdir ~/.ssh
- echo -e 'Host *\n stricthostkeychecking no' > ~/.ssh/config
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment