Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Verified Commit 5829bfc9 authored by Vincent SIMONIN's avatar Vincent SIMONIN
Browse files

:construction_worker: Testing environment is routed

* We can consult the test environment via domain $CI_COMMIT_SHORT_SHA.$HOSTNAME
parent 71c2ef02
No related branches found
No related tags found
1 merge request!53✨ Add new mapping property `protocol`
Pipeline #116389 passed
...@@ -44,9 +44,9 @@ run-test-job: ...@@ -44,9 +44,9 @@ run-test-job:
- pip install -r "$CI_PROJECT_DIR/plugins/netbox-cert-plugin/tests/requirements.e2e.txt" - pip install -r "$CI_PROJECT_DIR/plugins/netbox-cert-plugin/tests/requirements.e2e.txt"
- pip install -r "$CI_PROJECT_DIR/tests/requirements.e2e.txt" - pip install -r "$CI_PROJECT_DIR/tests/requirements.e2e.txt"
script: script:
- env HOST="$HOST" PORT="$PORT" API_KEY="$API_KEY" pytest --junit-xml=tests-report-netbox-rps-plugin.xml "$CI_PROJECT_DIR/plugins/netbox-rps-plugin/tests/" - env HOST="$CI_COMMIT_SHORT_SHA.$HOSTNAME" PORT="$PORT" API_KEY="$API_KEY" pytest --junit-xml=tests-report-netbox-rps-plugin.xml "$CI_PROJECT_DIR/plugins/netbox-rps-plugin/tests/"
- env HOST="$HOST" PORT="$PORT" API_KEY="$API_KEY" pytest --junit-xml=tests-report-netbox-cert-plugin.xml "$CI_PROJECT_DIR/plugins/netbox-cert-plugin/tests/" - env HOST="$CI_COMMIT_SHORT_SHA.$HOSTNAME" PORT="$PORT" API_KEY="$API_KEY" pytest --junit-xml=tests-report-netbox-cert-plugin.xml "$CI_PROJECT_DIR/plugins/netbox-cert-plugin/tests/"
- env HOST="$HOST" PORT="$PORT" API_KEY="$API_KEY" pytest --junit-xml=tests-report-netbox-dist-plugin.xml "$CI_PROJECT_DIR/tests/e2e/" - env HOST="$CI_COMMIT_SHORT_SHA.$HOSTNAME" PORT="$PORT" API_KEY="$API_KEY" pytest --junit-xml=tests-report-netbox-dist-plugin.xml "$CI_PROJECT_DIR/tests/e2e/"
after_script: after_script:
- env ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_PRIVATE_KEY_FILE="$ANSIBLE_PRIVATE_KEY_FILE" ansible-playbook -i "$TESTING_HOSTS" -u debian ansible/halt_test.yml - env ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_PRIVATE_KEY_FILE="$ANSIBLE_PRIVATE_KEY_FILE" ansible-playbook -i "$TESTING_HOSTS" -u debian ansible/halt_test.yml
- deactivate - deactivate
......
...@@ -25,7 +25,9 @@ ...@@ -25,7 +25,9 @@
- name: Create .env file - name: Create .env file
ansible.builtin.copy: ansible.builtin.copy:
dest: "/home/debian/netbox/{{ lookup('ansible.builtin.env','CI_PIPELINE_ID') }}/.env" dest: "/home/debian/netbox/{{ lookup('ansible.builtin.env','CI_PIPELINE_ID') }}/.env"
content: "TAG={{ lookup('ansible.builtin.env','CI_COMMIT_SHORT_SHA') }}" content: |
TAG={{ lookup('ansible.builtin.env','CI_COMMIT_SHORT_SHA') }}
HOSTNAME={{ lookup('ansible.builtin.env','HOSTNAME') }}
- name: Run `docker-compose up` - name: Run `docker-compose up`
community.docker.docker_compose: community.docker.docker_compose:
...@@ -35,7 +37,7 @@ ...@@ -35,7 +37,7 @@
- name: Wait until the metrics are available - name: Wait until the metrics are available
ansible.builtin.uri: ansible.builtin.uri:
url: "http://{{ lookup('ansible.builtin.env', 'HOST') }}:8080/metrics" url: "http://{{ lookup('ansible.builtin.env','CI_COMMIT_SHORT_SHA') }}.{{ lookup('ansible.builtin.env', 'HOSTNAME') }}/metrics"
status_code: 200 status_code: 200
register: curl_output register: curl_output
until: curl_output.status == 200 until: curl_output.status == 200
......
...@@ -3,11 +3,15 @@ services: ...@@ -3,11 +3,15 @@ services:
netbox: netbox:
image: "code.europa.eu:4567/digit-c4/netbox-plugins:${TAG}" image: "code.europa.eu:4567/digit-c4/netbox-plugins:${TAG}"
ports: ports:
- 8080:8080 - 8080
healthcheck: healthcheck:
start_period: 2s start_period: 2s
retries: 30 retries: 30
env_file: env/netbox.env env_file: env/netbox.env
labels:
- "traefik.http.routers.netbox.rule=Host(`${TAG}.${HOSTNAME}`)"
networks:
- traefik
logging: logging:
driver: "syslog" driver: "syslog"
options: options:
...@@ -17,6 +21,8 @@ services: ...@@ -17,6 +21,8 @@ services:
netbox-worker: netbox-worker:
image: "code.europa.eu:4567/digit-c4/netbox-plugins:${TAG}" image: "code.europa.eu:4567/digit-c4/netbox-plugins:${TAG}"
env_file: env/netbox.env env_file: env/netbox.env
networks:
- traefik
logging: logging:
driver: "syslog" driver: "syslog"
options: options:
...@@ -26,6 +32,8 @@ services: ...@@ -26,6 +32,8 @@ services:
netbox-housekeeping: netbox-housekeeping:
image: "code.europa.eu:4567/digit-c4/netbox-plugins:${TAG}" image: "code.europa.eu:4567/digit-c4/netbox-plugins:${TAG}"
env_file: env/netbox.env env_file: env/netbox.env
networks:
- traefik
logging: logging:
driver: "syslog" driver: "syslog"
options: options:
...@@ -34,6 +42,8 @@ services: ...@@ -34,6 +42,8 @@ services:
tag: "netbox-housekeeping" tag: "netbox-housekeeping"
postgres: postgres:
env_file: env/postgres.env env_file: env/postgres.env
networks:
- traefik
logging: logging:
driver: "syslog" driver: "syslog"
options: options:
...@@ -42,6 +52,8 @@ services: ...@@ -42,6 +52,8 @@ services:
tag: "netbox-postgres" tag: "netbox-postgres"
redis: redis:
env_file: env/redis.env env_file: env/redis.env
networks:
- traefik
logging: logging:
driver: "syslog" driver: "syslog"
options: options:
...@@ -50,9 +62,16 @@ services: ...@@ -50,9 +62,16 @@ services:
tag: "netbox-redis" tag: "netbox-redis"
redis-cache: redis-cache:
env_file: env/redis-cache.env env_file: env/redis-cache.env
networks:
- traefik
logging: logging:
driver: "syslog" driver: "syslog"
options: options:
syslog-address: "tcp://gra1-63cfda8371ef06f3c6bf175c.gra1.logs.ovh.com:6514" syslog-address: "tcp://gra1-63cfda8371ef06f3c6bf175c.gra1.logs.ovh.com:6514"
syslog-format: "rfc5424" syslog-format: "rfc5424"
tag: "netbox-cache" tag: "netbox-cache"
networks:
traefik:
name: traefik_traefik
external: true
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