forked from milvus-io/milvus
-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (83 loc) · 3.19 KB
/
ai-lab-remote-rhel-build.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
87
88
89
90
91
92
93
94
95
96
97
98
99
name: AI-lab remove rhel-build
on:
workflow_dispatch:
pull_request:
branches:
- master
paths:
- 'build/docker/builder/cpu/rhel9/**'
- '.github/workflows/ai-lab-remote-rhel-build.yaml'
env:
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
TF_VAR_vpc_id: ${{ secrets.VPC_ID }}
TF_VAR_rh_access: ${{ secrets.RH_ACCESS }}
TF_VAR_rh_org: ${{ secrets.RH_ORG }}
TF_VAR_ami_id: ${{ secrets.AMI_ID }}
jobs:
rhel9-milvus:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
max-parallel: 1
steps:
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3.1.1
with:
terraform_version: "1.7.5"
- name: Checkout code on runner
uses: actions/checkout@v4.1.6
- name: sshkeygen for ansible
run: ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N ""
- name: Terraform Init
run: terraform init
- name: Terraform Apply
run: terraform apply -auto-approve
- name: Set up Python on runner
uses: actions/setup-python@v5.1.0
with:
python-version: '3.11'
- name: Install Ansible on runner
run: |
python3 -m pip install --upgrade pip
pip install ansible
# currently no reqs
# - name: Ansible Collections
# working-directory: build/ci/rhel-ansible
# run: ansible-galaxy install -r requirements.yaml
- name: Install jq and build inventory on runner
run: |
sudo apt-get install -y jq
PUBLIC_IP=$(terraform output -json | jq -r '.public_ip.value')
# PUBLIC_IP=$(terraform output -json | jq -r '.public_ip.value' | cut -d "\"" -f 2)
echo "public_ip=$PUBLIC_IP" >> $GITHUB_OUTPUT
echo "[test_environments]" > build/ci/rhel-ansible/inventory.ini
echo "test_environment_host ansible_host=${PUBLIC_IP}" >> build/ci/rhel-ansible/inventory.ini
# cat build/ci/rhel-ansible/inventory.ini
# - name: Setup tmate session
# # if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3.18
# timeout-minutes: 15
# with:
# detached: true
# limit-access-to-actor: true
- name: Provision runner to ec2
working-directory: build/ci/rhel-ansible
run: |
ansible-playbook -v playbook.yaml \
-i inventory.ini \
--private-key=/home/runner/.ssh/id_rsa \
--extra-vars "registry_user=${{ secrets.REGISTRY_USER }}" \
--extra-vars "registry_pass=${{ secrets.REGISTRY_PASS }}" \
--extra-vars "subman_user=${{ secrets.SUBMAN_USER }}" \
--extra-vars "subman_pass=${{ secrets.SUBMAN_PASS }}"
env:
ANSIBLE_CONFIG: ansible.cfg
- name: Terraform Destroy
if: always()
run: terraform destroy -auto-approve
# For stacked runs of CI with concurrency allow for destroy to work
- name: Wait for 30 seconds for destroy to work
if: always()
run: sleep 30