Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infra Setup #43

Merged
merged 161 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
161 commits
Select commit Hold shift + click to select a range
9ec2004
first attempt at CI refactor
Edwardius Nov 25, 2023
774d72f
bye bye profiles, hellow modules
Edwardius Nov 25, 2023
bb02926
profiles -> modules
Edwardius Nov 25, 2023
bfbd520
the ci debug train is about to begin
Edwardius Nov 25, 2023
040efa6
setup is gone
Edwardius Nov 25, 2023
9e78abb
docker_env is non existent
Edwardius Nov 25, 2023
3d8d06f
modules dir not found in ci
Edwardius Nov 25, 2023
4c44dcd
what
Edwardius Nov 25, 2023
39cf3ee
we skip exporting environment in ci
Edwardius Nov 25, 2023
4ae573f
templates not template
Edwardius Nov 25, 2023
dbfc53e
permissions
Edwardius Nov 25, 2023
f2c9081
bad substitution
Edwardius Nov 25, 2023
34b91b8
LOL MUCH FILES
Edwardius Nov 26, 2023
86b31e4
some changes reverted, workflow for building base images
Edwardius Nov 30, 2023
621bf4c
renamed main.yml and moved around sample dockerfiles
Edwardius Nov 30, 2023
eee525b
gotta reconfirm the dockerfile locations
Edwardius Nov 30, 2023
cc25af2
gotta reconfirm the dockerfile locations
Edwardius Nov 30, 2023
e776395
remove test.sh
Edwardius Dec 3, 2023
b07fbcd
need to setup env for watod
Edwardius Dec 3, 2023
943fc49
work plz
Edwardius Dec 3, 2023
08b39a5
testing
Edwardius Dec 3, 2023
a339fc8
tmate to investigate
Edwardius Dec 3, 2023
db447d6
here?
Edwardius Dec 3, 2023
b0cea5c
this?
Edwardius Dec 3, 2023
f108039
what
Edwardius Dec 3, 2023
a77b5a4
lets try this instead
Edwardius Dec 3, 2023
1c8d9f4
space at end
Edwardius Dec 3, 2023
f960d4e
back to square one
Edwardius Dec 4, 2023
8bb2b61
where is this error
Edwardius Dec 4, 2023
9b8d0e3
more print statements
Edwardius Dec 4, 2023
008827d
what
Edwardius Dec 4, 2023
3689f39
??
Edwardius Dec 4, 2023
51f65de
?
Edwardius Dec 4, 2023
b73779f
pleasseeee
Edwardius Dec 4, 2023
fd35996
sdfkhg
Edwardius Dec 4, 2023
2363172
something is up with the json format
Edwardius Dec 4, 2023
7a5a972
correcting json format
Edwardius Dec 4, 2023
b887b29
found ya
Edwardius Dec 4, 2023
4c7de65
change json formatting again
Edwardius Dec 4, 2023
3bcd745
include?
Edwardius Dec 4, 2023
e2c0cab
add .
Edwardius Dec 4, 2023
145aea9
come on
Edwardius Dec 18, 2023
377b8c7
some json reformatting
Edwardius Dec 18, 2023
1c2867b
whoops, steps not intended here
Edwardius Dec 18, 2023
9c9a4e2
outputs to github output
Edwardius Dec 18, 2023
795a573
-c
Edwardius Dec 18, 2023
4090088
sanitization of profiles keyword
Edwardius Dec 18, 2023
edce97b
docker refactor
Edwardius Dec 18, 2023
957b876
refactoring docker...
Edwardius Dec 18, 2023
c4338a1
testing workflows
Edwardius Dec 19, 2023
8df6d9d
dispatch?
Edwardius Dec 19, 2023
a4a737c
no dispatch?
Edwardius Dec 19, 2023
4ecc32a
naming
Edwardius Dec 19, 2023
6d3eb66
rename
Edwardius Dec 19, 2023
f884b6a
Merge branch 'main' of github.com:WATonomous/wato_monorepo into eddy-…
Edwardius Dec 19, 2023
be9f56f
changes to how we build base images, via lego bricks :)
Edwardius Dec 19, 2023
7fa877b
moved the ARG to the top
Edwardius Dec 21, 2023
6c8d606
from yesterday (22)
Edwardius Dec 22, 2023
f18fc21
first test at building base images
Edwardius Dec 22, 2023
b4d41e7
moved out injecting tensorrt
Edwardius Dec 22, 2023
1328131
back to debugging ci
Edwardius Dec 22, 2023
d680c0d
i filtered for no reason
Edwardius Dec 22, 2023
4a36bbe
need include keyword
Edwardius Dec 22, 2023
6c586f9
no spaces :(
Edwardius Dec 22, 2023
1ff4bab
changes
Edwardius Dec 22, 2023
acbc381
wrong file name
Edwardius Dec 22, 2023
ec782af
added a .
Edwardius Dec 22, 2023
dd55a8e
nice
Edwardius Dec 22, 2023
68a55f5
i love my runner code
Edwardius Dec 22, 2023
97d542b
didnt pass registry and docker repo properly
Edwardius Dec 22, 2023
8ebc6a7
whoops no $
Edwardius Dec 22, 2023
6395239
bruh I grief myself so often
Edwardius Dec 22, 2023
ff4749e
whoops
Edwardius Dec 22, 2023
8dd7d57
more whoops
Edwardius Dec 22, 2023
5a24230
debugging
Edwardius Dec 22, 2023
37ca936
no version specifics?... maybe
Edwardius Dec 22, 2023
33374ab
more spelling mistakes
Edwardius Dec 22, 2023
a80e286
more mistakes
Edwardius Dec 22, 2023
15d62c6
bruh
Edwardius Dec 22, 2023
172fe4e
okay
Edwardius Dec 22, 2023
da5cf48
change name
Edwardius Dec 22, 2023
b475604
now to fix the other ones
Edwardius Dec 22, 2023
fea8ad3
no dispatches
Edwardius Dec 22, 2023
536623b
no such thing as the noetic image
Edwardius Dec 22, 2023
c344ee4
cleanup
Edwardius Dec 22, 2023
fe6f52a
more fixing
Edwardius Dec 22, 2023
c35be1e
hmm...
Edwardius Dec 22, 2023
eee13dd
testing tests
Edwardius Dec 22, 2023
648b755
lets try the watod way
Edwardius Dec 22, 2023
5590bf6
blah
Edwardius Dec 22, 2023
b6c32b2
tmate
Edwardius Dec 22, 2023
21a7a03
asdgf
Edwardius Dec 22, 2023
8a4f042
no tmate
Edwardius Dec 23, 2023
2128028
pull
Edwardius Dec 23, 2023
2747b58
sdfl
Edwardius Dec 23, 2023
e367380
more testing debug
Edwardius Dec 26, 2023
4d9f5c3
updating docker compose command, add BACKUP_TAG
Edwardius Dec 26, 2023
6f03d8c
removed target tag
Edwardius Dec 26, 2023
5dcce9a
syntax
Edwardius Dec 26, 2023
f500c74
added concurrency protection
Edwardius Dec 26, 2023
4a140a5
remove workdir change
Edwardius Dec 26, 2023
c99c17b
rebuild base images
Edwardius Dec 28, 2023
2ed898a
testing workflow dispatch
Edwardius Dec 28, 2023
74fbf69
testing dispatch
Edwardius Dec 28, 2023
4cffe79
dude wtf
Edwardius Dec 28, 2023
00214e8
merged main
Edwardius Dec 28, 2023
1e6bbb1
dispatch trigger exists now
Edwardius Dec 28, 2023
edbd64e
making sure caching is working
Edwardius Dec 28, 2023
50bac19
removing fixuid for prod, adding it as an override later
Edwardius Dec 28, 2023
ffce0c1
the commit before this one is safe
Edwardius Dec 28, 2023
79584ed
more stuff
Edwardius Dec 28, 2023
e55d296
keeping fixuid in the base image, it should be deleted when we make o…
Edwardius Dec 28, 2023
1a0ebad
prod and security cleanup
Edwardius Dec 28, 2023
9d67654
cleanup ghcr workflow
Edwardius Dec 28, 2023
da7a4de
unitests are done with build image
Edwardius Dec 28, 2023
a6c785d
first attempt at removing fixuid
Edwardius Dec 28, 2023
eb9428d
no more fixuid
Edwardius Dec 28, 2023
a0be4cf
more gid uid shit
Edwardius Dec 28, 2023
5805900
more uid gid
Edwardius Dec 28, 2023
92c96a0
user name change issue
Edwardius Dec 28, 2023
3eaacac
bruh
Edwardius Dec 28, 2023
65bb584
come on
Edwardius Dec 28, 2023
7ecd3e3
bolty
Edwardius Dec 28, 2023
8bef2b6
unittesting is done with dev
Edwardius Dec 28, 2023
db4d2f8
it finally works
Edwardius Dec 28, 2023
de46d33
changes to where we are sourcing ament_ws when opening a terminal
Edwardius Dec 30, 2023
99c1de5
add dispatch authorization
Edwardius Dec 30, 2023
d5abf24
adding auth config
Edwardius Dec 30, 2023
991cf86
debugging authorization
Edwardius Dec 30, 2023
4b2dcfd
debug
Edwardius Dec 30, 2023
8827151
debug
Edwardius Dec 30, 2023
7c2cdd0
bruh
Edwardius Dec 30, 2023
40ea0e4
bro wtf
Edwardius Dec 30, 2023
1d5f4ca
idc
Edwardius Dec 30, 2023
afab72e
fixing testing
Edwardius Dec 30, 2023
0dbe618
wtf
Edwardius Dec 30, 2023
2f736d6
dude wtf
Edwardius Dec 30, 2023
36d6669
BIG: ros2 pkg creates and initial docker copy
Edwardius Jan 1, 2024
ce76d0b
added a temp file placeholder
Edwardius Jan 1, 2024
ce4a602
monorepo subdirectories
Edwardius Jan 1, 2024
15fbdb9
BIG: adding all the modules
Edwardius Jan 1, 2024
aa60a54
all the dockerfiles
Edwardius Jan 1, 2024
ea09b9e
empty config
Edwardius Jan 1, 2024
a6b90f6
activate specfic modules in workflow
Edwardius Jan 1, 2024
a3b4679
add interfacing dockerfiles
Edwardius Jan 1, 2024
cf70902
more fixes
Edwardius Jan 1, 2024
ee97b5b
skip some tests
Edwardius Jan 1, 2024
10aa501
mpc
Edwardius Jan 1, 2024
56e8eb6
curla brackets
Edwardius Jan 1, 2024
a84a2de
if satement
Edwardius Jan 1, 2024
23808fc
ill deal with the dev overrides in ci in a bit
Edwardius Jan 1, 2024
2733192
fixing straglers
Edwardius Jan 2, 2024
ecd0e98
we'll switch to tilt later
Edwardius Jan 2, 2024
1ddff16
skipping source stage for infra
Edwardius Jan 2, 2024
890b15f
debugging
Edwardius Jan 2, 2024
784c4d9
I can never get this right
Edwardius Jan 2, 2024
7e047ea
like this?
Edwardius Jan 2, 2024
c0fe695
trying to stop infra from source stage build
Edwardius Jan 2, 2024
cd5dee0
full infra setup, with new dev option to watod
Edwardius Jan 2, 2024
bd001f8
some clarifications in the docs (need to like completely redo)
Edwardius Jan 2, 2024
ecdef6b
vnc is kinda working ;3
Edwardius Jan 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions .github/include/base_image_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{ "include":
[
{
"tag": "humble-ubuntu22.04",
"external_image": "ubuntu:22.04",
"injections": {
"ros2": "humble"
}
},





{
"tag": "cuda11.0-foxy-ubuntu20.04",
"external_image": "nvcr.io/nvidia/cuda:11.0.3-runtime-ubuntu20.04",
"injections": {
"ros2": "foxy"
}
},
{
"tag": "cuda11.2-foxy-ubuntu20.04",
"external_image": "nvcr.io/nvidia/cuda:11.2.2-runtime-ubuntu20.04",
"injections": {
"ros2": "foxy"
}
},
{
"tag": "cuda11.4-foxy-ubuntu20.04",
"external_image": "nvcr.io/nvidia/cuda:11.4.3-runtime-ubuntu20.04",
"injections": {
"ros2": "foxy"
}
},
{
"tag": "cuda11.7-humble-ubuntu22.04",
"external_image": "nvcr.io/nvidia/cuda:11.7.1-runtime-ubuntu22.04",
"injections": {
"ros2": "humble"
}
},
{
"tag": "cuda11.8-humble-ubuntu22.04",
"external_image": "nvcr.io/nvidia/cuda:11.8.0-runtime-ubuntu22.04",
"injections": {
"ros2": "humble"
}
},
{
"tag": "cuda12.0-humble-ubuntu22.04",
"external_image": "nvcr.io/nvidia/cuda:12.0.0-runtime-ubuntu22.04",
"injections": {
"ros2": "humble"
}
},
{
"tag": "cuda12.2-humble-ubuntu22.04",
"external_image": "nvcr.io/nvidia/cuda:12.2.2-runtime-ubuntu22.04",
"injections": {
"ros2": "humble"
}
},





{
"tag": "cuda11.0-cudnn8-foxy-ubuntu20.04",
"external_image": "nvcr.io/nvidia/cuda:11.0.3-cudnn8-runtime-ubuntu20.04",
"injections": {
"ros2": "foxy"
}
},
{
"tag": "cuda11.2-cudnn8-foxy-ubuntu20.04",
"external_image": "nvcr.io/nvidia/cuda:11.2.2-cudnn8-runtime-ubuntu20.04",
"injections": {
"ros2": "foxy"
}
},
{
"tag": "cuda11.4-cudnn8-foxy-ubuntu20.04",
"external_image": "nvcr.io/nvidia/cuda:11.4.3-cudnn8-runtime-ubuntu20.04",
"injections": {
"ros2": "foxy"
}
},
{
"tag": "cuda11.7-cudnn8-humble-ubuntu22.04",
"external_image": "nvcr.io/nvidia/cuda:11.7.1-cudnn8-runtime-ubuntu22.04",
"injections": {
"ros2": "humble"
}
},
{
"tag": "cuda11.8-cudnn8-humble-ubuntu22.04",
"external_image": "nvcr.io/nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04",
"injections": {
"ros2": "humble"
}
},
{
"tag": "cuda12.0-cudnn8-humble-ubuntu22.04",
"external_image": "nvcr.io/nvidia/cuda:12.0.0-cudnn8-runtime-ubuntu22.04",
"injections": {
"ros2": "humble"
}
},
{
"tag": "cuda12.2-cudnn8-humble-ubuntu22.04",
"external_image": "nvcr.io/nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04",
"injections": {
"ros2": "humble"
}
}
]
}
19 changes: 19 additions & 0 deletions .github/templates/docker_context/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Generate Docker Environment

outputs:
docker_matrix:
description: "list of docker compose services"
value: ${{ steps.environment-generator.outputs.docker_matrix }}
registry:
description: "name of the docker registry we are using"
value: ${{ steps.environment-generator.outputs.registry }}
repository:
description: "name of the docker repository we are using"
value: ${{ steps.environment-generator.outputs.repository }}

runs:
using: "composite"
steps:
- id: environment-generator
run: ${{ github.action_path }}/docker_context.sh
shell: bash
42 changes: 42 additions & 0 deletions .github/templates/docker_context/docker_context.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash
set -e

################# Sweep for Docker Services and Modules #################
# Scans for services and modules in the wato_monorepo,
# dynamically builds a json matrix for downstream CI build and testing

# Find docker compose files in 'modules' directory
modules=$(find modules -maxdepth 1 -name "docker-compose*")

# Initialize an empty array for JSON objects
json_objects=()

# Loop through each module
while read -r module; do
# Retrieve docker compose service names
services=$(docker-compose -f "$module" config --services)
module_out=$(echo "$module" | sed -n 's/modules\/docker-compose\.\(.*\)\.yaml/\1/p')

# Loop through each service
while read -r service_out; do
# Construct JSON object for each service with module and service name
json_object=$(jq -nc --arg module_out "$module_out" --arg service_out "$service_out" \
'{module: $module_out, service: $service_out}')
# Append JSON object to the array
json_objects+=($json_object)
done <<< "$services"
done <<< "$modules"

# Convert the array of JSON objects to a single JSON array
json_services=$(jq -nc '[( $ARGS.positional[] | fromjson )]' --args -- ${json_objects[*]})
echo "docker_matrix=$(echo $json_services | jq -c '{include: .}')" >> $GITHUB_OUTPUT

################# Setup Docker Registry and Repository Name #################
# Docker Registry to pull/push images
REGISTRY_URL="ghcr.io/watonomous/wato_monorepo"

REGISTRY=$(echo "$REGISTRY_URL" | sed 's|^\(.*\)/.*$|\1|')
REPOSITORY=$(echo "$REGISTRY_URL" | sed 's|^.*/\(.*\)$|\1|')

echo "registry=$REGISTRY" >> $GITHUB_OUTPUT
echo "repository=$REPOSITORY" >> $GITHUB_OUTPUT
19 changes: 19 additions & 0 deletions .github/templates/github_context/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Generate GitHub Environment

outputs:
source_branch:
description: "branch we are currently on"
value: ${{ steps.environment-generator.outputs.source_branch }}
target_branch:
description: "branch we are trying to merge into"
value: ${{ steps.environment-generator.outputs.target_branch }}

runs:
using: "composite"
steps:
- id: environment-generator
run: ${{ github.action_path }}/branch_sanitation.sh
shell: bash
env:
SOURCE_BRANCH: ${{ github.head_ref || github.ref_name }}
TARGET_BRANCH: ${{ github.base_ref }}
23 changes: 23 additions & 0 deletions .github/templates/github_context/branch_sanitation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
set -e

# Takes in a branch name and sanitizes the name for docker tagging
# (eg. no / in the branch name)
sanitize_branch_name() {
echo $(echo $1 | sed 's/[^a-zA-Z0-9._]/-/g' | cut -c 1-128)
}

################# Setup Source and Target Branch #################
SOURCE_BRANCH_NAME=$(sanitize_branch_name $SOURCE_BRANCH)
TARGET_BRANCH_NAME=$(sanitize_branch_name $TARGET_BRANCH)

if [ -z "$TARGET_BRANCH_NAME" ]; then
TARGET_BRANCH_NAME=$SOURCE_BRANCH_NAME
fi

echo "source_branch=$SOURCE_BRANCH_NAME" >> $GITHUB_OUTPUT
echo "target_branch=$TARGET_BRANCH_NAME" >> $GITHUB_OUTPUT

################# Debug notices #################
echo "::notice:: Using $SOURCE_BRANCH_NAME as the source branch"
echo "::notice:: Using $TARGET_BRANCH_NAME as the target branch"
17 changes: 0 additions & 17 deletions .github/templates/setup/action.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/templates/setup/docker_context.sh

This file was deleted.

13 changes: 9 additions & 4 deletions .github/templates/test/action.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
name: Docker test

inputs:
module:
description: "the module to be enabled"
required: true
service:
description: "docker compose service"
description: "the service being tested"
required: true
source_branch:
description: "the source branch"
required: true

runs:
Expand All @@ -11,7 +17,6 @@ runs:
- run: ${{ github.action_path }}/test_image.sh
shell: bash
env:
TAG: build_${{ inputs.source_branch }}
ACTIVE_MODULES: ${{ inputs.module }}
SERVICE: ${{ inputs.service }}
# CI is unable to find the current branch for pull requests, normally used to generate tag
TAG: ${{ github.head_ref || github.ref_name }}

11 changes: 4 additions & 7 deletions .github/templates/test/test_image.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
#!/bin/bash
set -e

bash scripts/watod-setup-env.sh

echo "Running $SERVICE tests..."
CONTAINER_NAME="$SERVICE-github-actions"

# Run docker-compose service in detached mode and prevent early exit
bash watod run -d --name "$CONTAINER_NAME" "$SERVICE" tail -f /dev/null
bash watod -dev pull "$SERVICE"
bash watod -dev run -d --name "$CONTAINER_NAME" "$SERVICE" tail -f /dev/null

# Run tests for ros2 packages, on failure script will exit with error message
docker exec "$CONTAINER_NAME" /bin/bash -c "source ~/.bashrc; colcon test; colcon test-result --verbose"

docker stop "$CONTAINER_NAME"
docker rm "$CONTAINER_NAME"
docker exec "$CONTAINER_NAME" /bin/bash -c "source /home/bolty/ament_ws/install/setup.bash; colcon test; colcon test-result --verbose"

bash watod -dev down
Loading
Loading