Skip to content

Release 2.0.0

Release 2.0.0 #650

Workflow file for this run

name: Linux Only
on:
workflow_dispatch:
pull_request:
branches:
- '*'
jobs:
build-and-test-linux-only:
runs-on: self-hosted
env:
UNIQUE_ID: ${{ github.run_id }}-${{ github.run_number }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
ES_PASSWORD: ""
KIBANA_PASSWORD: ""
AZURE_IP: ""
IP_ADDRESS: ""
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Set the environment for docker compose
run: |
cd testing/v2/development
echo "HOST_UID=$(id -u)" > .env
echo "HOST_GID=$(id -g)" >> .env
PUBLIC_IP=$(curl -s https://api.ipify.org)
echo "IP_ADDRESS=$PUBLIC_IP" >> $GITHUB_ENV
- name: Start pipeline container
run: |
cd testing/v2/development
docker compose -p ${{ env.UNIQUE_ID }} up -d pipeline
- name: Install Python requirements
run: |
cd testing/v2/development
docker compose -p ${{ env.UNIQUE_ID }} exec -T pipeline bash -c "
cd /home/lme-user/LME/testing/v2/installers/azure && \
pip install -r requirements.txt
"
- name: Build an Azure instance
env:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
run: |
cd testing/v2/development
docker compose -p ${{ env.UNIQUE_ID }} exec -T \
-e AZURE_CLIENT_ID \
-e AZURE_CLIENT_SECRET \
-e AZURE_TENANT_ID \
-e AZURE_SUBSCRIPTION_ID \
pipeline bash -c "
cd /home/lme-user/LME/testing/v2/installers && \
python3 ./azure/build_azure_linux_network.py \
-g pipe-${{ env.UNIQUE_ID }} \
-s ${{ env.IP_ADDRESS }}/32 \
-vs Standard_E4d_v4 \
-l westus \
-ast 23:00 \
-y
"
- name: Install LME on Azure instance
run: |
cd testing/v2/development
docker compose -p ${{ env.UNIQUE_ID }} exec -T pipeline bash -c "
sleep 60 &&
pwd && \
ls -la && \
cd /home/lme-user/LME/testing/v2/installers && \
IP_ADDRESS=\$(cat pipe-${{ env.UNIQUE_ID }}.ip.txt) && \
./install_v2/install.sh lme-user \$IP_ADDRESS "pipe-${{ env.UNIQUE_ID }}.password.txt" ${{ env.BRANCH_NAME }}
"
- name: Retrieve Elastic password
run: |
cd testing/v2/development
AZURE_IP=$(docker compose -p ${{ env.UNIQUE_ID }} exec -T pipeline bash -c "cat /home/lme-user/LME/testing/v2/installers/pipe-${{ env.UNIQUE_ID }}.ip.txt")
echo "AZURE_IP=$AZURE_IP" >> $GITHUB_ENV
echo "Azure IP:$AZURE_IP"
echo "Azure IP retrieved successfully"
ES_PASSWORD=$(docker compose -p ${{ env.UNIQUE_ID }} exec -T pipeline bash -c "ssh lme-user@$AZURE_IP '. /home/lme-user/LME/scripts/extract_secrets.sh -q && echo \$elastic'" | tail -n 1 | tr -d '\n')
echo "::add-mask::$ES_PASSWORD"
echo "ES_PASSWORD=$ES_PASSWORD" >> $GITHUB_ENV
KIBANA_PASSWORD=$(docker compose -p ${{ env.UNIQUE_ID }} exec -T pipeline bash -c "ssh lme-user@$AZURE_IP '. /home/lme-user/LME/scripts/extract_secrets.sh -q && echo \$kibana_system'" | tail -n 1 | tr -d '\n')
echo "::add-mask::$KIBANA_PASSWORD"
echo "KIBANA_PASSWORD=$KIBANA_PASSWORD" >> $GITHUB_ENV
echo "Kibana password retrieved successfully."
- name: Install test requirements on Azure instance
run: |
cd testing/v2/development
docker compose -p ${{ env.UNIQUE_ID }} exec -T pipeline bash -c "
cd /home/lme-user/LME/testing/v2/installers && \
IP_ADDRESS=\$(cat pipe-${{ env.UNIQUE_ID }}.ip.txt) && \
ssh lme-user@\$IP_ADDRESS 'whoami && hostname && \
wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
sudo apt install -y ./google-chrome-stable_current_amd64.deb && \
cd /home/lme-user/LME/testing/tests && \
python3 -m venv venv && \
source venv/bin/activate && \
pip install -r requirements.txt '
"
- name: Run tests on Azure instance
env:
ES_PASSWORD: ${{ env.ES_PASSWORD }}
elastic: ${{ env.ES_PASSWORD }}
KIBANA_PASSWORD: ${{ env.KIBANA_PASSWORD }}
AZURE_IP: ${{ env.AZURE_IP }}
run: |
sleep 360
cd testing/v2/development
docker compose -p ${{ env.UNIQUE_ID }} exec -T pipeline bash -c "
cd /home/lme-user/LME/testing/v2/installers && \
IP_ADDRESS=\$(cat pipe-${{ env.UNIQUE_ID }}.ip.txt) && \
ssh lme-user@\$IP_ADDRESS 'cd /home/lme-user/LME/testing/tests && \
echo ELASTIC_PASSWORD=\"$ES_PASSWORD\" >> .env && \
echo KIBANA_PASSWORD=\"$KIBANA_PASSWORD\" >> .env && \
echo elastic=\"$ES_PASSWORD\" >> .env && \
cat .env && \
source venv/bin/activate && \
pytest -v api_tests/linux_only/ selenium_tests/linux_only/'
"
- name: Cleanup Azure resources
if: always()
env:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_SECRET: ${{ secrets.AZURE_SECRET }}
AZURE_TENANT: ${{ secrets.AZURE_TENANT }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
run: |
cd testing/v2/development
docker compose -p ${{ env.UNIQUE_ID }} exec -T pipeline bash -c "
az login --service-principal -u $AZURE_CLIENT_ID -p $AZURE_SECRET --tenant $AZURE_TENANT
az group delete --name pipe-${{ env.UNIQUE_ID }} --yes --no-wait
"
- name: Stop and remove containers
if: always()
run: |
cd testing/v2/development
docker compose -p ${{ env.UNIQUE_ID }} down
docker system prune -af