Skip to content

Commit

Permalink
adding back tmp image build aysnc, wait tmp build, bootc install, and…
Browse files Browse the repository at this point in the history
… reboot

Signed-off-by: greg pereira <[email protected]>
  • Loading branch information
Gregory-Pereira committed May 3, 2024
1 parent ee6e914 commit 72a276d
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 22 deletions.
2 changes: 0 additions & 2 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 Down
67 changes: 47 additions & 20 deletions training/provision/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- 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
Expand All @@ -34,7 +35,7 @@
registry: quay.io
authfile: /etc/containers/auth.json

- name: Pull the parent image
- name: Pull the Parent Image
async: 1000
poll: 0
register: pull_result
Expand All @@ -45,32 +46,58 @@
arch: amd64
state: present

- name: Check on parent image pull
- name: Check on Parent Image Pull
async_status:
jid: "{{ pull_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: Build Temp Image
async: 1000
poll: 0
register: build_result
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: Check on Temp Image Build
async_status:
jid: "{{ build_result.ansible_job_id }}"
register: job_result
until: job_result.finished
retries: 100
delay: 10

- 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: Pause for 5 minutes
# ansible.builtin.pause:
Expand Down

0 comments on commit 72a276d

Please sign in to comment.