-
Notifications
You must be signed in to change notification settings - Fork 0
/
edgebuild.yaml
86 lines (75 loc) · 2.6 KB
/
edgebuild.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
- name: yolov7
hosts: all
vars:
project_id: "{{ lookup('env','PROJECT_ID') }}"
tasks:
- name: Ensure workdir (and some subdirs)
ansible.builtin.file:
path: /opt/teknoir/yolov7
state: directory
mode: '0755'
- name: RSync workdir
rsync:
src: "{{ playbook_dir }}/"
dest: /opt/teknoir/yolov7/
recursive: yes
delete: yes
rsync_opts:
- --include=models/
- --include=utils/
- --include=tracker/
- --include=*.yaml
- --include=*.txt
- --include=*.sh
- --include=*.py
- --include=*.Dockerfile
- --exclude=*
- name: Get L4T Version
shell:
cmd: cat /etc/nv_tegra_release
register: nv_tegra_release_content
- name: Set L4T Version variable
set_fact:
l4t_version: "r{{ nv_tegra_release_content.stdout | regex_search('R(\\d+).*REVISION:\\s+(\\d+.\\d+)', '\\1', '\\2') | join('.') }}"
- name: Fix Nvidia versioning f-up
set_fact:
l4t_version: r34.1.1
- name: Set images var
set_fact:
base_images:
"r32.6.1": "us-central1-docker.pkg.dev/teknoir/nvidia/l4t-pytorch:r32.6.1-pth1.9-py3"
"r32.7.1": "us-central1-docker.pkg.dev/teknoir/nvidia/l4t-pytorch:r32.7.1-pth1.10-py3"
"r34.1.1": "us-central1-docker.pkg.dev/teknoir/nvidia/l4t-pytorch:r34.1.1-pth1.11-py3"
- name: Set image vars
set_fact:
base_image: "{{ base_images[l4t_version] }}"
image_name: "us-central1-docker.pkg.dev/teknoir/teknoir-ai/yolov7-base"
tag: "l4t{{ l4t_version }}"
- name: Get temporary registry access token
local_action:
module: ansible.builtin.command
_raw_params: gcloud auth application-default print-access-token
register: access_token_result
- name: Set access token variable
set_fact:
access_token: "{{ access_token_result.stdout }}"
- name: Login to docker registry
ansible.builtin.shell: |
echo "{{ access_token }}" | \
docker login -u oauth2accesstoken --password-stdin https://us-central1-docker.pkg.dev/teknoir
- name: Build PyTorch Yolov7 image
ansible.builtin.shell: |
docker build \
--tag={{ image_name }}:{{ tag }} \
--build-arg=BASE_IMAGE={{ base_image }} \
--file=l4t.Dockerfile .
args:
chdir: /opt/teknoir/yolov7
vars:
ansible_command_timeout: 18000
- name: Push image
ansible.builtin.shell: |
docker push {{ image_name }}:{{ tag }}
vars:
ansible_command_timeout: 6000