Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
58e0f34
initial test pipeline
hamza-itential Sep 16, 2025
95456c1
add session token
hamza-itential Sep 16, 2025
d9235de
add themis clone step
hamza-itential Sep 16, 2025
83f9dc8
add tofu ec2 provision, hosts generation
hamza-itential Sep 16, 2025
1c95379
fix working dirs
hamza-itential Sep 16, 2025
f0a6753
add auto approval, aws profile name
hamza-itential Sep 16, 2025
e7623ea
remove AWS_PROFILE, split tofu into 2 steps
hamza-itential Sep 16, 2025
2317441
Update test-deployer.yml
hamza-itential Sep 16, 2025
bc28b6a
Update test-deployer.yml
hamza-itential Sep 17, 2025
127e3c2
Update test-deployer.yml
hamza-itential Sep 17, 2025
949dcb6
Update test-deployer.yml
hamza-itential Sep 17, 2025
ad6b27a
Update test-deployer.yml
hamza-itential Sep 18, 2025
1351c9e
Update test-deployer.yml
hamza-itential Sep 18, 2025
6879e3d
Update test-deployer.yml
hamza-itential Sep 18, 2025
b167d77
Update test-deployer.yml
hamza-itential Sep 18, 2025
d120d1d
Update test-deployer.yml
hamza-itential Sep 18, 2025
2ccbbc1
Update test-deployer.yml
hamza-itential Sep 18, 2025
0f7575b
Update test-deployer.yml
hamza-itential Sep 18, 2025
fcf159a
Update test-deployer.yml
hamza-itential Sep 18, 2025
01faa2b
Update test-deployer.yml
hamza-itential Sep 18, 2025
8b6450c
Update test-deployer.yml
hamza-itential Sep 19, 2025
4c6ef2d
Update test-deployer.yml
hamza-itential Sep 19, 2025
f77963b
Update test-deployer.yml
hamza-itential Sep 19, 2025
da4fa6d
Update test-deployer.yml
hamza-itential Sep 19, 2025
2538f3e
Update test-deployer.yml
hamza-itential Sep 22, 2025
0d2df58
Update test-deployer.yml
hamza-itential Sep 22, 2025
6a9998d
Update test-deployer.yml
hamza-itential Sep 22, 2025
ea28a34
Update test-deployer.yml
hamza-itential Sep 22, 2025
1a8a315
Update test-deployer.yml
hamza-itential Sep 22, 2025
23e5fa8
Update test-deployer.yml
hamza-itential Sep 22, 2025
a55a9ce
Update test-deployer.yml
hamza-itential Sep 22, 2025
75ec69c
Update test-deployer.yml
hamza-itential Sep 22, 2025
2d0cc15
Update test-deployer.yml
hamza-itential Sep 22, 2025
69c3631
Update test-deployer.yml
hamza-itential Sep 22, 2025
ace10ac
Update test-deployer.yml
hamza-itential Sep 22, 2025
8cd9239
Update test-deployer.yml
hamza-itential Sep 22, 2025
89f4553
Update test-deployer.yml
hamza-itential Sep 22, 2025
fe758b8
Update test-deployer.yml
hamza-itential Sep 22, 2025
7d123d3
Update test-deployer.yml
hamza-itential Sep 22, 2025
d037642
Update test-deployer.yml
hamza-itential Sep 22, 2025
b4acc91
Update test-deployer.yml
hamza-itential Sep 22, 2025
8869795
Update test-deployer.yml
hamza-itential Sep 22, 2025
bd791fd
Update test-deployer.yml
hamza-itential Sep 22, 2025
1413cc5
Update test-deployer.yml
hamza-itential Sep 22, 2025
4a80f42
Update test-deployer.yml
hamza-itential Sep 22, 2025
53cdbcb
Update test-deployer.yml
hamza-itential Sep 22, 2025
2c3fd8d
Update test-deployer.yml
hamza-itential Sep 22, 2025
2aa56a3
Update test-deployer.yml
hamza-itential Sep 22, 2025
3e6bd8c
Update test-deployer.yml
hamza-itential Sep 22, 2025
e34f9f3
Update test-deployer.yml
hamza-itential Sep 22, 2025
0f7a81d
Update test-deployer.yml
hamza-itential Sep 22, 2025
5c6fc57
Update test-deployer.yml
hamza-itential Sep 22, 2025
06e5731
Update test-deployer.yml
hamza-itential Sep 22, 2025
2056891
Update test-deployer.yml
hamza-itential Sep 22, 2025
9bf1c75
Update test-deployer.yml
hamza-itential Sep 22, 2025
9efc732
Update test-deployer.yml
hamza-itential Sep 22, 2025
c7d2799
Update test-deployer.yml
hamza-itential Sep 22, 2025
12802c8
Update test-deployer.yml
hamza-itential Sep 23, 2025
b68f3d1
Update test-deployer.yml
hamza-itential Sep 23, 2025
4d0b1c0
Update test-deployer.yml
hamza-itential Sep 23, 2025
5fcab3f
Update test-deployer.yml
hamza-itential Sep 23, 2025
42e09fa
Update test-deployer.yml
hamza-itential Sep 23, 2025
6b4fe8d
Update test-deployer.yml
hamza-itential Sep 23, 2025
310780e
Update test-deployer.yml
hamza-itential Sep 23, 2025
604fb5e
Update test-deployer.yml
hamza-itential Sep 23, 2025
c28bff4
Update test-deployer.yml
hamza-itential Sep 23, 2025
a79a6b4
try fixing weird issue
hamza-itential Sep 23, 2025
4e4287b
nvm try again
hamza-itential Sep 23, 2025
5eee598
Update install.yml
hamza-itential Sep 23, 2025
025c50c
Update test-deployer.yml
hamza-itential Sep 23, 2025
a4be9e5
revert deployer changes
hamza-itential Sep 23, 2025
76d71fb
Update test-deployer.yml
hamza-itential Sep 23, 2025
008961a
Update test-deployer.yml
hamza-itential Sep 23, 2025
d122b91
Update test-deployer.yml
hamza-itential Sep 23, 2025
bfa944e
add debugging tasks before installing build packages
hamza-itential Sep 23, 2025
4c41b6d
Update test-deployer.yml
hamza-itential Sep 23, 2025
37cdad5
Update test-deployer.yml
hamza-itential Sep 24, 2025
93ef6cd
Update test-deployer.yml
hamza-itential Sep 24, 2025
bd828db
Update test-deployer.yml
hamza-itential Sep 24, 2025
f8b4945
Update test-deployer.yml
hamza-itential Sep 24, 2025
ccea485
Update test-deployer.yml
hamza-itential Sep 24, 2025
b7fa219
Update test-deployer.yml
hamza-itential Sep 24, 2025
d0690ff
Update test-deployer.yml
hamza-itential Sep 24, 2025
fc8fe87
Update test-deployer.yml
hamza-itential Sep 24, 2025
088d989
Update test-deployer.yml
hamza-itential Sep 24, 2025
3c68ed9
Update test-deployer.yml
hamza-itential Sep 24, 2025
ed46814
Update test-deployer.yml
hamza-itential Sep 24, 2025
30d8a0a
Update test-deployer.yml
hamza-itential Sep 24, 2025
0ac5eaf
Update test-deployer.yml
hamza-itential Sep 24, 2025
9905f69
Update test-deployer.yml
hamza-itential Sep 24, 2025
af91bb3
Update test-deployer.yml
hamza-itential Sep 24, 2025
f7fa960
Update test-deployer.yml
hamza-itential Sep 24, 2025
d2887a1
Update test-deployer.yml
hamza-itential Sep 24, 2025
0926e27
Update test-deployer.yml
hamza-itential Sep 24, 2025
ca34425
Update test-deployer.yml
hamza-itential Sep 24, 2025
c50646d
Update test-deployer.yml
hamza-itential Sep 24, 2025
6f0b43d
Update test-deployer.yml
hamza-itential Sep 24, 2025
27df46a
Update test-deployer.yml
hamza-itential Sep 24, 2025
cc3e164
Update test-deployer.yml
hamza-itential Sep 24, 2025
f1da227
Update test-deployer.yml
hamza-itential Sep 24, 2025
6f23f15
Update test-deployer.yml
hamza-itential Sep 25, 2025
92ad20c
Update test-deployer.yml
hamza-itential Sep 25, 2025
5e5035e
Update test-deployer.yml
hamza-itential Sep 25, 2025
3a32e72
Update test-deployer.yml
hamza-itential Sep 25, 2025
3d4724d
Update test-deployer.yml
hamza-itential Sep 25, 2025
ee51a15
Update test-deployer.yml
hamza-itential Sep 25, 2025
417450a
Update test-deployer.yml
hamza-itential Sep 25, 2025
58e18b7
Update test-deployer.yml
hamza-itential Sep 25, 2025
ba31202
Update test-deployer.yml
hamza-itential Sep 25, 2025
eb14af6
Update test-deployer.yml
hamza-itential Sep 26, 2025
91c3c1b
Update test-deployer.yml
hamza-itential Sep 26, 2025
ca8b0ae
make workflow reusable
hamza-itential Sep 26, 2025
930e386
fix
hamza-itential Sep 26, 2025
0edfa67
fix
hamza-itential Sep 26, 2025
5b1f037
fix
hamza-itential Sep 26, 2025
85003f3
trigger
hamza-itential Sep 26, 2025
0d287c1
fix
hamza-itential Sep 26, 2025
cf53067
test all cases
hamza-itential Sep 26, 2025
f3f6319
add more test cases
hamza-itential Sep 26, 2025
64b1a5d
fix
hamza-itential Sep 26, 2025
02a4835
fix
hamza-itential Sep 26, 2025
42dca7e
improvements
hamza-itential Sep 26, 2025
36b1a0c
fixes
hamza-itential Sep 26, 2025
cb05d0e
Update test-deployer.yml
hamza-itential Sep 26, 2025
1081e2b
Update test-on-pull-request.yml
hamza-itential Sep 26, 2025
25a8bb9
Update test-deployer.yml
hamza-itential Sep 29, 2025
322d4d7
Update test-deployer.yml
hamza-itential Sep 30, 2025
7f9905a
Update test-deployer.yml
hamza-itential Sep 30, 2025
d0f8e59
Update test-deployer.yml
hamza-itential Sep 30, 2025
61cedde
Update test-deployer.yml
hamza-itential Oct 1, 2025
3d7f19b
Update test-deployer.yml (3 jobs test)
hamza-itential Oct 2, 2025
f916288
Update test-deployer.yml
hamza-itential Oct 2, 2025
8613bfe
Update test-deployer.yml
hamza-itential Oct 2, 2025
436e3d6
Update test-deployer.yml
hamza-itential Oct 2, 2025
4d2732c
Update test-deployer.yml
hamza-itential Oct 2, 2025
f3e68e3
Update test-deployer.yml
hamza-itential Oct 2, 2025
c71d70d
Update test-deployer.yml
hamza-itential Oct 2, 2025
4512727
Update test-deployer.yml
hamza-itential Oct 2, 2025
1a3858e
Update test-deployer.yml
hamza-itential Oct 6, 2025
81ecc34
Update test-deployer.yml
hamza-itential Oct 6, 2025
8fc758a
Update test-deployer.yml
hamza-itential Oct 6, 2025
ac9e241
Use pull_request_target trigger
hamza-itential Oct 10, 2025
40df0e0
Update test-on-pull-request.yml
hamza-itential Oct 10, 2025
78a9679
Update test-deployer.yml
hamza-itential Oct 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
234 changes: 234 additions & 0 deletions .github/workflows/test-deployer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
# Runs the Itential Deployer on EC2 instances conforming to some validated design and other parameters
# (e.g. OS type and version), and validates that the deployed services are all running correctly.
# This allows for testing deployments on various configurations in parallel in a fully automated manner.

# Main steps performed by this workflow:
# - Cloning Themis from GitLab
# - Provisioning EC2 instances using Themis
# - Converting OpenTofu output to Ansible inventory
# - Running deployer on newly created instances
# - Running validation script to test each service (Redis, MongoDB, Platform, Gateway)
# - Terminating all instances using Themis, irrespective of success


name: Test Deployer


on:
workflow_call:
inputs:
ref:
required: true
type: string
design:
required: true
type: string
os-type:
required: true
type: string
os-version:
required: true
type: string
secrets:
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
AWS_SESSION_TOKEN:
required: true
GITLAB_SSH_KEY:
required: true
EC2_SSH_KEY:
required: true
NEXUS_USERNAME:
required: true
NEXUS_PASSWORD:
required: true


jobs:
test-deployer:
runs-on: self-hosted
container:
image: ghcr.io/catthehacker/ubuntu:act-latest
env:
GIT_SSH_COMMAND: ssh -i ~/.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
PIP_BREAK_SYSTEM_PACKAGES: "1"
timeout-minutes: 60

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Update package lists
run: sudo apt update

- name: Install Python
run: |
sudo apt install -y python3
wget https://bootstrap.pypa.io/get-pip.py && sudo python3 get-pip.py && rm get-pip.py
sudo ln -s /usr/bin/python3 /usr/bin/python || true
sudo ln -s /usr/bin/pip3 /usr/bin/pip || true
python --version
pip --version

# For some reason, Node appears to be a dependency of Themis
- name: Install Node.js
run: |
sudo apt install -y nodejs
node --version

- name: Install OpenTofu
uses: opentofu/setup-opentofu@v1
with:
tofu_version: latest

- name: Install Ansible
run: |
pip install "ansible>=9.0.0,<10.0.0" "ansible-core>=2.11,<2.17"
ansible --version

# Configures Ansible to fail immediately on error, skip host key checking, use correct key file
- name: Write Ansible configuration file
run: |
cat > ~/.ansible.cfg << 'EOF'
[defaults]
any_errors_fatal = True
host_key_checking = False
max_fail_percentage = 0
private_key_file = ~/.ssh/pet-east1.open.pem
EOF

- name: Install this collection
run: ansible-galaxy collection install . --force

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }}
aws-region: us-east-1

- name: Setup SSH for GitLab
run: |
mkdir -p ~/.ssh
echo "${{ secrets.GITLAB_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa

- name: Setup SSH for EC2
run: |
echo "${{ secrets.EC2_SSH_KEY }}" > ~/.ssh/pet-east1.open.pem
chmod 600 ~/.ssh/pet-east1.open.pem

- name: Clone Themis repository
working-directory: ..
run: |
git clone git@gitlab.com:itential/platform-engineering/themis.git
cd themis
ls -la

- name: Install Themis Python script dependencies
working-directory: ../themis
run: pip install -r scripts/requirements.txt

# This is potentially more secure than adding the credentials as extra vars in the ansible-playbook command
- name: Add Nexus credentials to inventory
working-directory: ../themis
run: |
echo 'repository_username: "${{ secrets.NEXUS_USERNAME }}"' >> inventories/common/group_vars/all.yml
echo 'repository_password: "${{ secrets.NEXUS_PASSWORD }}"' >> inventories/common/group_vars/all.yml

- name: Initialize OpenTofu
working-directory: ../themis/tofu_aws
run: tofu init

# Copies the vars file for the selected design to the working directory to be imported automatically
- name: Set validated design
working-directory: ../themis/tofu_aws
run: cp tfvars/${{ inputs.design }}.tfvars design.auto.tfvars

- name: Set additional job-specific variables
working-directory: ../themis/tofu_aws
run: |
cat > github_actions.auto.tfvars << 'EOF'
profile = ""
owner = "github"
os_type = "${{ inputs.os-type }}"
os_version = "${{ inputs.os-version }}"
EOF

- name: Generate OpenTofu execution plan
working-directory: ../themis/tofu_aws
run: tofu plan -out=plan.tfplan

- name: Provision EC2 instances
working-directory: ../themis/tofu_aws
run: tofu apply plan.tfplan

- name: Generate Ansible inventory hosts file
working-directory: ../themis/tofu_aws
run: python3 ../scripts/generate_inventory.py --validate -o hosts.json

# Retries until SSH connection is established or timeout is reached
- name: Wait for EC2 instances to be ready to SSH into
working-directory: ../themis
run: ansible all -m wait_for_connection -a "delay=10 timeout=300" -i tofu_aws/hosts.json -v

# Waits for cloud init marker file to be written to disk (see cloud-init.tpl)
- name: Wait for cloud init script to complete
working-directory: ../themis
run: ansible all -m wait_for -a "path=/var/log/cloud-init-finished.marker timeout=300" -i tofu_aws/hosts.json -v

- name: Run the deployer
working-directory: ../themis
run: >
ansible-playbook itential.deployer.site
-i tofu_aws/hosts.json
-i inventories/common
-i inventories/${{ inputs.design }}
-v

- name: Verify that Platform is running correctly
working-directory: ../themis
run: |
for host in $(jq -r '.all.children.platform.hosts[] | .ansible_host' tofu_aws/hosts.json); do
python3 scripts/validate.py platform "http://$host:3000"
done
for host in $(jq -r '(.all.children.platform_secondary.hosts // [])[] | .ansible_host' tofu_aws/hosts.json); do
python3 scripts/validate.py platform "http://$host:3000"
done

- name: Verify that Gateway is running correctly
working-directory: ../themis
run: |
for host in $(jq -r '.all.children.gateway.hosts[] | .ansible_host' tofu_aws/hosts.json); do
python3 scripts/validate.py gateway "http://$host:8083"
done

- name: Verify that Redis is running correctly
working-directory: ../themis
run: |
for host in $(jq -r '.all.children.redis.hosts[] | .ansible_host' tofu_aws/hosts.json); do
python3 scripts/validate.py redis "$host"
done
for host in $(jq -r '(.all.children.redis_secondary.hosts // [])[] | .ansible_host' tofu_aws/hosts.json); do
python3 scripts/validate.py redis "$host"
done

- name: Verify that MongoDB is running correctly
working-directory: ../themis
run: |
for host in $(jq -r '.all.children.mongodb.hosts[] | .ansible_host' tofu_aws/hosts.json); do
python3 scripts/validate.py mongodb "$host"
done
for host in $(jq -r '(.all.children.mongodb_arbiter.hosts // [])[] | .ansible_host' tofu_aws/hosts.json); do
python3 scripts/validate.py mongodb "$host" --arbiter
done

- name: Terminate EC2 instances
if: always()
working-directory: ../themis/tofu_aws
run: tofu destroy -auto-approve
22 changes: 22 additions & 0 deletions .github/workflows/test-on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test Deployer on Pull Request


on:
pull_request_target:
branches:
- pipeline-test


jobs:
run-test:
strategy:
matrix:
design: [minimal, aio, ha2, asa]
fail-fast: false
uses: ./.github/workflows/test-deployer.yml
with:
ref: ${{ github.event.pull_request.head.sha }}
design: ${{ matrix.design }}
os-type: rocky
os-version: "9"
secrets: inherit
8 changes: 8 additions & 0 deletions roles/redis/tasks/install-from-source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
- name: Online install
when: not offline_install_enabled
block:
- name: Check current systemd packages

Check failure on line 38 in roles/redis/tasks/install-from-source.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

risky-shell-pipe

Shells that use pipes should set the pipefail option.

Check failure on line 38 in roles/redis/tasks/install-from-source.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

no-changed-when

Commands should not change things if nothing needs doing.

Check failure on line 38 in roles/redis/tasks/install-from-source.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

command-instead-of-module

rpm used in place of yum or rpm_key module
shell: rpm -qa | grep systemd

Check failure on line 39 in roles/redis/tasks/install-from-source.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

fqcn[action-core]

Use FQCN for builtin module actions (shell).
register: systemd_packages

- name: Show systemd packages
debug:

Check failure on line 43 in roles/redis/tasks/install-from-source.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

fqcn[action-core]

Use FQCN for builtin module actions (debug).
var: systemd_packages.stdout_lines

Check failure on line 45 in roles/redis/tasks/install-from-source.yml

View workflow job for this annotation

GitHub Actions / Ansible Lint

yaml[trailing-spaces]

Trailing spaces
- name: Install Redis build packages
ansible.builtin.dnf:
name: "{{ item }}"
Expand Down
Loading