Skip to content

Commit

Permalink
add: configurable logfile (#43)
Browse files Browse the repository at this point in the history
* add: configurable logfile

* Bump: php-version in molecule

* bump: update testcontainer

* updaet molecule

* pip

* mol action

* add_namespace

* mole 3

* mole4

* assert

* Aktualisierung der Molekülkonfiguration

* Hinzufügen von pytest in prepare.yml

* Hinzufügen von pytest und python3-pip in prepare.yml

* Entfernen von pytest und python3-pip in prepare.yml

* Aktualisierung der Molekülkonfiguration: Deaktiviere die 'verify'-Schritt in molecule.yml
  • Loading branch information
mleutenegger authored May 15, 2024
1 parent 9e365e4 commit 7ae6b7a
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 16 deletions.
27 changes: 23 additions & 4 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,29 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3.0.2
uses: actions/checkout@v4
with:
path: "${{ github.repository }}"
- name: molecule
uses: robertdebock/[email protected]

- name: Set up Python 3.
uses: actions/setup-python@v5
with:
image: ubuntu
python-version: '3.x'

- name: run molecule
uses: gofrolist/molecule-action@v2

# - name: Install test dependencies.
# run: pip3 install ansible molecule molecule-plugins[docker] docker

# - name: Run Molecule tests.
# run: molecule test
# env:
# PY_COLORS: '1'
# ANSIBLE_FORCE_COLOR: '1'
# MOLECULE_DISTRO: ubuntu2204
# # - name: molecule

# uses: robertdebock/[email protected]
# with:
# image: ubuntu
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
silverstripe_ss_environment_type: 'dev'
# Uses the given file to check wether a flush should occur
silverstripe_ss_flush_on_deploy: '{{ ss_current_dir_path }}/index.php'
# Specify the location of the logfile
silverstripe_ss_error_log: '../../../logs/ss_log.log'
# Additional keys to be written to the .env file
silverstripe_add_ss_keys: {}

Expand Down
1 change: 1 addition & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
galaxy_info:
role_name: silverstripe
namespace: syntro_gmbh
author: Matthias Leutenegger
description: Role to deploy a Silverstripe installation.
company: Syntro GmbH
Expand Down
20 changes: 12 additions & 8 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
---
dependency:
name: galaxy
options:
ignore-errors: true
driver:
name: docker
lint: |
set -e
yamllint .
platforms:
- name: instance
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu1804}-ansible:latest"
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2004}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
cgroupns_mode: host
privileged: true
pre_build_image: true
provisioner:
name: ansible
lint:
name: ansible-lint
playbooks:
prepare: prepare.yml
converge: converge.yml
# lint:
# name: ansible-lint
verifier:
name: testinfra
lint:
name: flake8
options:
s: true
scenario:
name: default
test_sequence:
- lint
- destroy
- dependency
- syntax
- create
- prepare
- converge
- verify
# - verify
- cleanup
- destroy
4 changes: 2 additions & 2 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
- php-xml
# - php-dom
- php-curl
php_version: '7.4'
php_default_version_debian: "7.4"
php_version: '8.1'
php_default_version_debian: "8.1"
php_opcache_enable_cli: "1"
php_enable_webserver: false
roles:
Expand Down
13 changes: 12 additions & 1 deletion molecule/default/tests/test_default.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

import testinfra.utils.ansible_runner
import testinfra

testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']
Expand Down Expand Up @@ -28,3 +28,14 @@ def test_webroot(host):
assert f.exists
f = host.file('/var/www/html/.htaccess')
assert f.exists


def test_env(host):
f = host.file('/var/www/releases/')
assert f.exists
r = f.glob('*')
assert len(r) > 0
r = r[0]
f = host.file('/var/www/releases/' + r + '/.env')
assert f.exists

2 changes: 1 addition & 1 deletion tasks/2_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@

- name: 'release : set relative logfile path'
set_fact:
ss_current_log_file: '../../../logs/ss_log.log'
ss_current_log_file: "{{ silverstripe_ss_error_log | default('../../../logs/ss_log.log') }}"
when:
- ss_current_dir_path_stat.stat.isdir is defined
- ss_current_dir_path_stat.stat.isdir
Expand Down

0 comments on commit 7ae6b7a

Please sign in to comment.