Skip to content

Commit

Permalink
Merge branch 'master' of github.com:shadow-robot/aurora
Browse files Browse the repository at this point in the history
  • Loading branch information
Build Tools committed Sep 20, 2024
2 parents 5a0c141 + 0b9acd3 commit 9464e8d
Show file tree
Hide file tree
Showing 32 changed files with 729 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ansible/data/molecule/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ansible==4.2.0
ansible-core==2.11.11
ansible==5.2.0
ansible-core==2.12.8
ansible-compat==2.0.2
ansible-lint==5.4.0
asn1crypto==1.5.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ lint: |
platforms:
# Adding CODEBUILD_BUILD_ID to instance name in order to allow parallel EC2 execution of tests from CodeBuild
- name: server_and_nuc_desktop_icons_docker_ec2_${CODEBUILD_BUILD_ID}
image: ami-0820357ff5cf2333d
image: ami-00826bd51e68b1487
instance_type: t2.micro
region: eu-west-2
vpc_id: vpc-0f8cc2cc245d57eb4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ lint: |
platforms:
# Adding CODEBUILD_BUILD_ID to instance name in order to allow parallel EC2 execution of tests from CodeBuild
- name: teleop_server_desktop_icons_simulation_haptx_ec2_${CODEBUILD_BUILD_ID}
image: ami-0820357ff5cf2333d
image: ami-00826bd51e68b1487
instance_type: t2.micro
region: eu-west-2
vpc_id: vpc-0f8cc2cc245d57eb4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ lint: |
platforms:
# Adding CODEBUILD_BUILD_ID to instance name in order to allow parallel EC2 execution of tests from CodeBuild
- name: teleop_server_check_desktop_icons_docker_ec2_${CODEBUILD_BUILD_ID}
image: ami-0820357ff5cf2333d
image: ami-00826bd51e68b1487
instance_type: t2.micro
region: eu-west-2
vpc_id: vpc-0f8cc2cc245d57eb4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ lint: |
platforms:
# Adding CODEBUILD_BUILD_ID to instance name in order to allow parallel EC2 execution of tests from CodeBuild
- name: teleop_server_desktop_icons_haptx_bimanual_ec2_${CODEBUILD_BUILD_ID}
image: ami-0820357ff5cf2333d
image: ami-00826bd51e68b1487
instance_type: t2.micro
region: eu-west-2
vpc_id: vpc-0f8cc2cc245d57eb4
Expand Down
58 changes: 58 additions & 0 deletions docker/molecule/base/jammy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
FROM public.ecr.aws/shadowrobot/ubuntu:jammy

MAINTAINER "Shadow Robot's Software Team <[email protected]>"

LABEL Description="Ubuntu Jammy image contains Ansible and Molecule" Vendor="Shadow Robot" Version="1.0"

ENV DEBIAN_FRONTEND noninteractive

ENV LC_ALL C.UTF-8

ENV LANG C.UTF-8

ARG ml_base_aurora_branch

ENV ml_base_aurora_branch ${ml_base_aurora_branch:-"master"}

RUN set -x && \
apt-get update && \
\
echo "Installing wget" && \
apt-get install -y --no-install-recommends ca-certificates wget && \
\
echo "Installing dependencies for python3.8, SSL, pip3" && \
apt-get install -y build-essential zlib1g-dev libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev && \
\
echo "Installing git, sudo and Python 3 pip and dev" && \
apt-get install -y \
python3-dev \
python3-pip \
git \
libyaml-dev \
python3-cryptography \
libssl-dev \
libffi-dev \
sshpass \
sudo && \
pip3 install --upgrade pip gcovr && \
echo "Cloning Aurora" && \
git clone --depth 1 https://github.com/shadow-robot/aurora.git -b $ml_base_aurora_branch /tmp/aurora && \
\
pip3 --version && \
python3 --version && \
echo "Installing molecule" && \
echo "cython<3" > /tmp/constraint.txt && \
PIP_CONSTRAINT=/tmp/constraint.txt pip3 install -r /tmp/aurora/ansible/data/molecule/requirements.txt && \
\
echo "Clean up" && \
apt-get clean && \
rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
/root/.ansible \
/root/.gitconfig \
/root/.cache

VOLUME /var/lib/docker

1 change: 1 addition & 0 deletions docker/molecule/base/jammy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please read [these instructions](../../../../docs/molecule_dockers.md).
43 changes: 43 additions & 0 deletions docker/molecule/base/jammy/buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2024 Shadow Robot Company Ltd.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.

version: 0.2
env:
shell: bash
variables:
branch: master
image: aurora-molecule
tag: jammy
dockerfile_folder: docker/molecule/base/jammy/
exported-variables:
- branch
- image
- tag
- dockerfile_folder
phases:
build:
commands:
- cd ..
- rm -rf aurora
- git clone https://github.com/shadow-robot/aurora.git
- cd aurora
- git checkout $branch
- cd $dockerfile_folder
- aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/shadowrobot
- docker build -t $image .
- docker tag $image:latest public.ecr.aws/shadowrobot/$image:$tag
- docker push public.ecr.aws/shadowrobot/$image:$tag
- comm -13 <(aws ecr-public describe-image-tags --repository-name $image --region us-east-1 --output text | awk '{print $3}' | tr " " "\n" | sort -u) <(aws ecr-public describe-images --repository-name $image --region us-east-1 --output text | awk '{print $2}' | tr " " "\n" | sort -u) >> ids_to_delete.txt
- ids_to_delete=$(sed 's/^/imageDigest=/' ids_to_delete.txt)
- if [[ -s ids_to_delete.txt ]]; then aws ecr-public batch-delete-image --repository-name $image --region us-east-1 --image-ids $ids_to_delete --output text; fi
28 changes: 28 additions & 0 deletions docker/molecule/base/jammy/docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2024 Shadow Robot Company Ltd.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.

version: '3'

services:
sut:
build:
context: .
args:
ml_base_aurora_branch: ${SOURCE_BRANCH}
command: >
bash -c "pip3 freeze | grep molecule &&
pip3 freeze | grep ansible &&
pip3 freeze | grep docker"
environment:
- SOURCE_BRANCH
8 changes: 8 additions & 0 deletions docker/molecule/base/jammy/hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

export DOCKERFILE_PATH=${DOCKERFILE_PATH:-Dockerfile}

echo "Executing build command"
echo "docker build --build-arg ml_base_aurora_branch=${SOURCE_BRANCH} -f ${DOCKERFILE_PATH} -t ${IMAGE_NAME} ."

docker build --build-arg ml_base_aurora_branch="${SOURCE_BRANCH}" -f "${DOCKERFILE_PATH}" -t "${IMAGE_NAME}" .
37 changes: 37 additions & 0 deletions docker/molecule/devel/jammy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM public.ecr.aws/shadowrobot/aurora-molecule-docker:jammy

LABEL Description="Ubuntu Jammy image contains Ansible, Molecule, Docker and EC2 driver and Development tools with GUI" Vendor="Shadow Robot" Version="1.0"

ENV DEBIAN_FRONTEND noninteractive

ENV PULSE_SERVER /run/pulse/native

ARG ml_devel_aurora_branch

ENV ml_devel_aurora_branch ${ml_devel_aurora_branch:-"master"}

ENV ml_devel_aurora_script "https://raw.githubusercontent.com/shadow-robot/aurora/$ml_devel_aurora_branch/bin/run-ansible.sh"

RUN set -x && \
\
echo "Downloading one-liner" && \
wget -O /tmp/oneliner "$( echo "$ml_devel_aurora_script" | sed 's/#/%23/g' )" && \
chmod 755 /tmp/oneliner && \
\
echo "Setting up UI and new Docker user" && \
/tmp/oneliner configure_software --branch $ml_devel_aurora_branch software=[setup-docker] && \
\
echo "Add user to docker group" && \
usermod -aG docker user && \
\
echo "Installing IDEs and AWS CLI" && \
/tmp/oneliner install_software --branch $ml_devel_aurora_branch software=[pycharm,vscode,aws-cli] && \
\
echo "Clean up" && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/.ansible /root/.gitconfig /root/.cache

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
VOLUME /var/lib/docker
CMD ["/usr/bin/terminator"]

9 changes: 9 additions & 0 deletions docker/molecule/devel/jammy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Launching container with UI

In order to launch development image please use the following command

```bash
docker run -it --name sample_dev -e DISPLAY -e QT_X11_NO_MITSHM=1 -e LOCAL_USER_ID=$(id -u) \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw public.ecr.aws/shadowrobot/aurora-molecule-devel:jammy
```
44 changes: 44 additions & 0 deletions docker/molecule/devel/jammy/buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2024 Shadow Robot Company Ltd.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.

version: 0.2

env:
shell: bash
variables:
branch: master
image: aurora-molecule-devel
tag: jammy
dockerfile_folder: docker/molecule/devel/jammy/
exported-variables:
- branch
- image
- tag
- dockerfile_folder
phases:
build:
commands:
- cd ..
- rm -rf aurora
- git clone https://github.com/shadow-robot/aurora.git
- cd aurora
- git checkout $branch
- cd $dockerfile_folder
- aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/shadowrobot
- docker build -t $image .
- docker tag $image:latest public.ecr.aws/shadowrobot/$image:$tag
- docker push public.ecr.aws/shadowrobot/$image:$tag
- comm -13 <(aws ecr-public describe-image-tags --repository-name $image --region us-east-1 --output text | awk '{print $3}' | tr " " "\n" | sort -u) <(aws ecr-public describe-images --repository-name $image --region us-east-1 --output text | awk '{print $2}' | tr " " "\n" | sort -u) >> ids_to_delete.txt
- ids_to_delete=$(sed 's/^/imageDigest=/' ids_to_delete.txt)
- if [[ -s ids_to_delete.txt ]]; then aws ecr-public batch-delete-image --repository-name $image --region us-east-1 --image-ids $ids_to_delete --output text; fi
28 changes: 28 additions & 0 deletions docker/molecule/devel/jammy/docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2024 Shadow Robot Company Ltd.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.

version: '3'

services:
sut:
build:
context: .
args:
ml_devel_aurora_branch: ${SOURCE_BRANCH}
command: >
bash -c "aws --version &&
test -f /usr/bin/pycharm &&
test -f /usr/bin/code"
environment:
- SOURCE_BRANCH
8 changes: 8 additions & 0 deletions docker/molecule/devel/jammy/hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

export DOCKERFILE_PATH=${DOCKERFILE_PATH:-Dockerfile}

echo "Executing build command"
echo "docker build --build-arg ml_devel_aurora_branch=${SOURCE_BRANCH} -f ${DOCKERFILE_PATH} -t ${IMAGE_NAME} ."

docker build --build-arg ml_devel_aurora_branch="${SOURCE_BRANCH}" -f "${DOCKERFILE_PATH}" -t "${IMAGE_NAME}" .
28 changes: 28 additions & 0 deletions docker/molecule/docker/jammy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM public.ecr.aws/shadowrobot/aurora-molecule:jammy

LABEL Description="Ubuntu Jammy image contains Ansible, Molecule and Docker driver" Vendor="Shadow Robot" Version="1.0"

ARG ml_docker_aurora_branch

ENV ml_docker_aurora_branch ${ml_docker_aurora_branch:-"master"}

ENV ml_docker_aurora_script "https://raw.githubusercontent.com/shadow-robot/aurora/$ml_docker_aurora_branch/bin/run-ansible.sh"

RUN set -x && \
\
echo "Installing Docker" && \
wget -O /tmp/oneliner "$( echo "$ml_docker_aurora_script" | sed 's/#/%23/g' )" && \
chmod 755 /tmp/oneliner && \
/tmp/oneliner install_software --branch $ml_docker_aurora_branch software=[docker] skip_molecule_task=true && \
\
echo "Clean up" && \
apt-get clean && \
rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
/root/.ansible \
/root/.gitconfig \
/root/.cache

VOLUME /var/lib/docker
1 change: 1 addition & 0 deletions docker/molecule/docker/jammy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please read [these instructions](../../../../docs/molecule_dockers.md).
Loading

0 comments on commit 9464e8d

Please sign in to comment.