Skip to content

Commit

Permalink
removing ssh timeout and ansible.cfg
Browse files Browse the repository at this point in the history
Signed-off-by: greg pereira <[email protected]>
  • Loading branch information
Gregory-Pereira authored and lmilbaum committed May 3, 2024
1 parent 0eba1ab commit bcf522f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 80 deletions.
26 changes: 12 additions & 14 deletions .github/workflows/training-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ jobs:

- name: Provision
run: |
cp ./main/training/provision/ansible.cfg ./ && \
ansible-playbook ./main/training/provision/playbook.yml \
-vvv \
-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 All @@ -99,7 +97,7 @@ jobs:
- name: run the e2e tests
run: |
ssh -i terraform-test-environment-module/${{ steps.terraform-output.outputs.pem_filename }} \
${{ steps.terraform-output.outputs.url }} \
root@${{ steps.terraform-output.outputs.url }} \
curl -sLO /tmp https://raw.githubusercontent.com/stefwalter/instructlab/container-testing/scripts/basic-workflow-tests.sh
- name: Destroy Test Environment
Expand All @@ -111,14 +109,14 @@ jobs:
TF_VAR_aws_instance_type: ${{ matrix.aws_image_type }}
TF_VAR_aws_ami_architecture: ${{ matrix.aws_ami_architecture }}

- name: Publish Job Results to Slack
id: slack
if: always()
uses: slackapi/[email protected]
with:
payload: |
{
"text": "${{ github.workflow }} workflow status: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
# - name: Publish Job Results to Slack
# id: slack
# if: always()
# uses: slackapi/[email protected]
# with:
# payload: |
# {
# "text": "${{ github.workflow }} workflow status: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
# }
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
79 changes: 13 additions & 66 deletions training/provision/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
- name: Required packages
ansible.builtin.dnf:
name:
- https://s3.eu-west-2.amazonaws.com/amazon-ssm-eu-west-2/latest/linux_amd64/amazon-ssm-agent.rpm
- podman
state: present
disable_gpg_check: true

- name: Temp Image Containerfile
- name: Derived Image Containerfile
ansible.builtin.template:
src: ./templates/Containerfile.j2
dest: /tmp/Containerfile
Expand All @@ -34,76 +35,22 @@
registry: quay.io
authfile: /etc/containers/auth.json

- name: Pull the parent image
- name: Build and Install the Bootc Image
async: 1000
poll: 0
register: pull_result
containers.podman.podman_image:
name: "quay.io/ai-lab/{{ image_name }}:latest"
pull: true
auth_file: /etc/containers/auth.json
arch: amd64
state: present

- name: Check on parent image pull
register: build_result
ansible.builtin.shell: |
podman build -t derived_image:latest -f /tmp/Containerfile --authfile=/etc/containers/auth.json .
podman run --rm --privileged --pid=host --security-opt label=type:unconfined_t -v /:/target -v /var/lib/containers:/var/lib/containers derived_image:latest bootc install to-filesystem --karg=console=ttyS0,115200n8 --replace=alongside /target
- name: Check on Build and Install Bootc Image
async_status:
jid: "{{ pull_result.ansible_job_id }}"
jid: "{{ build_result.ansible_job_id }}"
register: job_result
until: job_result.finished
retries: 100
delay: 10

- name: Check the images was pulled
ansible.builtin.command:
cmd: |
podman images -a
# - name: Simulate long running op (15 sec), wait for up to 45 sec, poll every 5 sec
# ansible.builtin.command: /bin/sleep 15
# async: 45
# poll: 5

# - name: Build Temp image
# containers.podman.podman_image:
# name: "quay.io/ai-lab/{{ image_name }}:latest"
# build:
# target: temp_image
# file: /tmp/Containerfile
# state: build
# auth_file: /etc/containers/auth.json

# - name: Pause for 5 minutes
# ansible.builtin.pause:
# minutes: 5

# - name: Building an image with ssh key
# ansible.builtin.command:
# cmd: |
# podman build -t localhost/temp_image:latest -f /tmp/Containerfile

# - name: check podman images for sanity
# ansible.builtin.command:
# cmd: |
# podman images

# - name: Bootc install
# ignore_unreachable: true
# containers.podman.podman_container:
# name: "{{ image_name }}"
# image: localhost/temp_image:latest
# state: started
# auto_remove: yes
# cap_add:
# - sys_admin
# security_opt:
# - "label=type:unconfined_t"
# volumes:
# - "/:/target"
# - "/var/lib/containers:/var/lib/containers"
# privileged: yes
# pid_mode: host
# command: "bootc install to-filesystem --karg=console=ttyS0,115200n8 --replace=alongside /target"

# - name: Restart instance
# ansible.builtin.reboot:
# test_command: which ilab
- name: Restart instance
ansible.builtin.reboot:
test_command: which ilab

0 comments on commit bcf522f

Please sign in to comment.