Skip to content

Commit

Permalink
swap user ec2 to root
Browse files Browse the repository at this point in the history
Signed-off-by: greg pereira <[email protected]>
  • Loading branch information
Gregory-Pereira committed Jun 24, 2024
1 parent 1933b15 commit c5f611e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 23 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ai-lab-remote-rhel-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ jobs:
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/[email protected]
timeout-minutes: 17
with:
detached: true
limit-access-to-actor: true
# - name: Setup tmate session
# # if: ${{ failure() }}
# uses: mxschmitt/[email protected]
# timeout-minutes: 25
# with:
# detached: true
# limit-access-to-actor: true

- name: Provision runner to ec2
working-directory: build/ci/rhel-ansible
Expand Down
41 changes: 25 additions & 16 deletions build/ci/rhel-ansible/playbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

- name: remove podman for clean docker install
ansible.builtin.shell: |
sudo dnf -y remove \
dnf -y remove \
docker \
docker-client \
docker-client-latest \
Expand Down Expand Up @@ -65,9 +65,11 @@
cd /tmp
export ARCH=$(uname -m)
if [[ "$ARCH" == "arm64" ]] || [[ "$ARCH" == "aarch64" ]]; then
echo "aarch64 selected"
curl -sLO https://github.com/docker/compose/releases/download/v2.28.0/docker-compose-linux-aarch64
sudo mv /tmp/docker-compose-linux-aarch64 /usr/bin/docker-compose
elif [[ "$ARCH" == "amd64" ]] || [[ "$ARCH" == "x86_64" ]]; then
echo "x86_64 selected"
curl -sLO https://github.com/docker/compose/releases/download/v2.28.0/docker-compose-linux-x86_64
sudo mv /tmp/docker-compose-linux-x86_64 /usr/bin/docker-compose
fi
Expand All @@ -79,29 +81,36 @@
password: "{{ registry_pass }}"
registry: quay.io

- name: Register to subscription manager
ansible.builtin.shell: |
subscription-manager register --username "{{ subman_user }}" --password "{{ subman_pass }}" --force
- name: Clone Git repository
become: false
ansible.builtin.git:
repo: https://github.com/redhat-et/milvus.git
dest: "/home/ec2-user/milvus"
dest: "/tmp/milvus"
version: "rhel9-milvus"
clone: yes
update: yes

- name: DEBUG - sleep
ansible.builtin.shell: |
sleep 400
# - name: DEBUG - sleep
# ansible.builtin.shell: |
# sleep 900

- name: Make the builder image
async: 1000
poll: 0
register: builder_result
become: true

ansible.builtin.shell: |
set -x
cd /home/ec2-user/milvus/
cd /tmp/milvus/
sudo su
echo $TARGETARCH
export TARGETARCH=$(uname -m)
echo $TARGETARCH
./build/builder.sh make install
ls -al /home/ec2-user/milvus/
ls -al /tmp/milvus/
set +x
- name: Check on the builder image
Expand All @@ -117,12 +126,12 @@
poll: 0
register: milvus_result
ansible.builtin.shell: |
cd /home/ec2-user/milvus
ls -al /home/ec2-user/milvus
mv /home/ec2-user/milvus/bin /home/ec2-user/milvus/build/docker/milvus/rhel9/
mv /home/ec2-user/milvus/configs /home/ec2-user/milvus/build/docker/milvus/rhel9/
mv /home/ec2-user/milvus/lib /home/ec2-user/milvus/build/docker/milvus/rhel9/
sudo su && /home/ec2-user/milvus/build/build_image.sh make
cd /tmp/milvus
ls -al /tmp/milvus
mv /tmp/milvus/bin /tmp/milvus/build/docker/milvus/rhel9/
mv /tmp/milvus/configs /tmp/milvus/build/docker/milvus/rhel9/
mv /tmp/milvus/lib /tmp/milvus/build/docker/milvus/rhel9/
/tmp/milvus/build/build_image.sh make
- name: Check on the milvus image
async_status:
Expand All @@ -134,7 +143,7 @@

- name: log docker images
ansible.builtin.shell: |
sudo su && docker images
docker images
- name: DEBUG - sleep
ansible.builtin.shell: |
Expand Down
3 changes: 3 additions & 0 deletions build/docker/builder/cpu/rhel9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ RUN dnf install -y make cmake automake gcc gcc-c++ \
RUN alias python3='python3.11'

# Assumes you have a valid subman subscription at the host machine

# RUN subscription-manager register --username $SUBMAN_USER --password $SUBMAN_PASS --force
RUN subscription-manager attach

# This gets used for the codeready-builder-for-rhel-9-<arch> stream for openblas-devel
COPY build/docker/builder/cpu/rhel9/install-rpms.sh /root/install-rpms.sh
RUN chmod +x /root/install-rpms.sh
Expand Down
2 changes: 2 additions & 0 deletions build/docker/builder/cpu/rhel9/install-rpms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ else
exit 1
fi

subscription-manager attach

if [[ "$RUN_MODE" == "aarch64" ]]; then
dnf install -y \
https://www.rpmfind.net/linux/centos-stream/9-stream/AppStream/aarch64/os/Packages/perl-Unicode-EastAsianWidth-12.0-7.el9.noarch.rpm \
Expand Down

0 comments on commit c5f611e

Please sign in to comment.