Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instructlab e2e testing #471

Merged
merged 3 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 5 additions & 24 deletions .github/workflows/training-e2e.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: traning E2E

on:
# schedule: # schedule the job to run every day at midnight
# - cron: '0 * * * *'
schedule: # schedule the job to run every day at midnight
- cron: '0 12 * * *'

# For testing purposes, will remove
pull_request:
Expand Down Expand Up @@ -52,13 +52,6 @@ jobs:
path: terraform-test-environment-module
ref: 'main'

# - name: Setup tmate session
# uses: mxschmitt/[email protected]
# timeout-minutes: 45
# with:
# detached: true
# limit-access-to-actor: true

- name: Setup Terraform
uses: hashicorp/[email protected]
with:
Expand Down Expand Up @@ -110,23 +103,11 @@ jobs:
timeout-minutes: 15
with:
detached: true
limit-access-to-actor: true

# - name: Check Connectivity
# run: ssh -o StrictHostKeyChecking=no \
# -i terraform-test-environment-module/${{ steps.terraform-output.outputs.pem_filename }} \
# root@${{ steps.terraform-output.outputs.url }} which ilab

# - name: run the e2e tests
# run: |
# ssh -i terraform-test-environment-module/${{ steps.terraform-output.outputs.pem_filename }} \
# root@${{ steps.terraform-output.outputs.url }} \
# curl -sLO /tmp https://raw.githubusercontent.com/stefwalter/instructlab/container-testing/scripts/basic-workflow-tests.sh

- name: Run e2e tests
limit-access-to-actor: false

- name: Run tests
run: |
ansible-playbook ./main/training/tests/e2e-tests/playbook.yml \
-vv \
-i terraform-test-environment-module/hosts.ini \
--private-key=terraform-test-environment-module/${{ steps.terraform-output.outputs.pem_filename }} \
--extra-vars "image_name=${{ matrix.image_name }}" \
Expand Down
22 changes: 17 additions & 5 deletions training/tests/e2e-tests/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,20 @@
- name: Gather facts for first time
ansible.builtin.setup:

- name: Clone repository
git:
repo: https://github.com/instructlab/instructlab.git
dest: /tmp/instructlab
version: d905a25bed58b3649e7d7eef74257eea79be6e94
- name: Get test script
ansible.builtin.get_url:
url: https://raw.githubusercontent.com/instructlab/instructlab/main/scripts/basic-workflow-tests.sh
dest: /tmp/basic-workflow-tests.sh
mode: 755

- name: Run tests
ansible.builtin.shell: /tmp/basic-workflow-tests.sh
register: out

- name: Test Results - stdout
debug:
msg: "{{out.stdout_lines}}"

- name: Test Results - stderr
debug:
msg: "{{out.stderr_lines}}"
5 changes: 2 additions & 3 deletions training/tests/provision/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
poll: 0
register: build_result
ansible.builtin.shell: |
podman build -t quay.io/ai-lab/derived_image:latest --build-arg "sshpubkey={{ ssh_public_key }}" -f /tmp/Containerfile --authfile=/etc/containers/auth.json .
podman build -t quay.io/ai-lab/derived_image:latest --build-arg "sshpubkey={{ ssh_public_key }}" -f /tmp/Containerfile --authfile=/etc/containers/auth.json . > /tmp/build.log 2>&1
podman push quay.io/ai-lab/derived_image:latest --authfile=/etc/containers/auth.json

- name: Check on Build Bootc Image
Expand All @@ -59,10 +59,9 @@
podman run --authfile=/etc/containers/auth.json \
--rm --privileged --pid=host \
--security-opt label=type:unconfined_t \
-v /etc/containers/:/etc/containers \
-v /:/target \
-v /var/lib/containers:/var/lib/containers quay.io/ai-lab/derived_image:latest \
bootc install to-filesystem --karg=console=ttyS0,115200n8 --karg=systemd.journald.forward_to_console=1 --replace=alongside /target
bootc install to-existing-root --karg=console=ttyS0,115200n8 --karg=systemd.journald.forward_to_console=1

- name: Check on Install Bootc Image
async_status:
Expand Down
8 changes: 2 additions & 6 deletions training/tests/provision/templates/Containerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ FROM quay.io/ai-lab/{{ image_name }}:latest
ARG sshpubkey

RUN set -eu && mkdir /usr/etc-system && \
echo 'AuthorizedKeysFile /usr/etc-system/%u.keys' >> /etc/ssh/sshd_config.d/30-auth-system.conf && \
echo 'AuthorizedKeysFile /usr/etc-system/%u.keys' > /etc/ssh/sshd_config.d/30-auth-system.conf && \
echo $sshpubkey > /usr/etc-system/root.keys && \
chmod 0600 /usr/etc-system/root.keys

# RUN useradd -G root ec2-user && \
# mkdir /home/ec2-user/.ssh && \
# echo $sshpubkey > /home/ec2-user/.ssh/authorized_keys && \
# chmod 0600 /home/ec2-user/.ssh/authorized_keys && \
# chown -R ec2-user:root /home/ec2-user
RUN dnf install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm
Loading