diff --git a/.github/scripts/provision.sh b/.github/scripts/provision.sh index 4685c5ee3..af50643ee 100755 --- a/.github/scripts/provision.sh +++ b/.github/scripts/provision.sh @@ -2,14 +2,7 @@ set -x -if [[ "$(uname -m)" == "aarch64" ]]; then - arch="arm64" -else - arch="amd64" -fi - -dnf install -y podman wget \ - https://s3.us-east-2.amazonaws.com/amazon-ssm-us-east-2/latest/linux_${arch}/amazon-ssm-agent.rpm +dnf install -y podman wget dnf clean all wget -P locallm/models https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/resolve/main/llama-2-7b-chat.Q5_K_S.gguf @@ -24,6 +17,4 @@ podman run -it \ -p 8501:8501 \ -e MODEL_SERVICE_ENDPOINT=http://10.88.0.1:8001/v1 \ ghcr.io/containers/chatbot:latest - -# this file is sampled when the terraform apply is running -touch /tmp/user_data_completed +ß diff --git a/.github/workflows/testing-framework.yaml b/.github/workflows/testing-framework.yaml index 4be7bd842..be1db95c4 100644 --- a/.github/workflows/testing-framework.yaml +++ b/.github/workflows/testing-framework.yaml @@ -6,9 +6,9 @@ on: workflow_dispatch: - # pull_request: ## temporary for debugging development purposes - # branches: - # - main + pull_request: ## temporary for debugging development purposes + branches: + - main env: TF_VAR_aws_region: "eu-west-2" @@ -41,7 +41,8 @@ jobs: aws_image_type: m7g.medium aws_ami_architecture: arm64 steps: - - uses: actions/checkout@v4.1.1 + - name: Checkout + uses: actions/checkout@v4.1.1 with: path: main @@ -59,11 +60,11 @@ jobs: terraform_version: "1.7.5" terraform_wrapper: false - - name: Init Terraform + - name: Init run: terraform init working-directory: terraform-test-environment-module - - name: Spin Test Environment + - name: Bootstrap id: up run: terraform apply -auto-approve -lock=false working-directory: terraform-test-environment-module @@ -76,8 +77,19 @@ jobs: run: | echo "id=$(terraform output id | xargs)" >> $GITHUB_OUTPUT echo "url=$(terraform output host | xargs)" >> $GITHUB_OUTPUT + echo "pem_filename=$(terraform output pem_filename | xargs)" >> $GITHUB_OUTPUT working-directory: terraform-test-environment-module + - run: sleep 30 && ssh -o StrictHostKeyChecking=no -i terraform-test-environment-module/${{ steps.terraform-output.outputs.pem_filename }} fedora@${{ steps.terraform-output.outputs.url }} pwd + + - name: Provision + run: | + ansible-playbook ./main/recipes/natural_language_processing/chatbot/provision/playbook.yml \ + -i terraform-test-environment-module/hosts.ini \ + --private-key=terraform-test-environment-module/${{ steps.terraform-output.outputs.pem_filename }} + env: + ANSIBLE_HOST_KEY_CHECKING: false + - name: Set up Python uses: actions/setup-python@v5.0.0 with: @@ -88,6 +100,7 @@ jobs: run: make install - name: Wait for the user data script to finish + if: always() run: sleep 240 - name: Run Integration Tests diff --git a/recipes/natural_language_processing/chatbot/provision/playbook.yml b/recipes/natural_language_processing/chatbot/provision/playbook.yml new file mode 100644 index 000000000..3e8e1aaff --- /dev/null +++ b/recipes/natural_language_processing/chatbot/provision/playbook.yml @@ -0,0 +1,28 @@ +--- +- name: Test Environment Provisioning + hosts: test_environments + remote_user: fedora + become: true + gather_facts: false + vars: + arch: "amd64" + + tasks: + + - name: Wait until the instance is ready + ansible.builtin.wait_for_connection: + delay: 10 + timeout: 60 + + - name: Gather facts for first time + ansible.builtin.setup: + + - name: Set variable arch + set_fact: + arch: "arm64" + when: ansible_architecture == "aarch64" + + - name: Required packages + ansible.builtin.package: + name: "https://s3.us-east-2.amazonaws.com/amazon-ssm-us-east-2/latest/linux_{{ arch }}/amazon-ssm-agent.rpm" + state: present