Rhel9 milvus #67
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 25 | |
# with: | |
# detached: true | |
# limit-access-to-actor: true | |
- name: Provision runner to ec2 | |
working-directory: build/ci/rhel-ansible | |
run: | | |
ansible-playbook -vv 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 |