Skip to content

Commit

Permalink
Temporary commit to test CI
Browse files Browse the repository at this point in the history
  • Loading branch information
hhenry01 committed Sep 30, 2023
1 parent e0e365d commit 7999f78
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
// Uncomment the files containing the programs you need
// "docker-compose.docs.yml", // docs
// "docker-compose.website.yml", // grafana, website
// "docker-compose.db.yml", // mongodb

"docker-compose.yml",
"docker-compose.db.yml" // mongodb
"docker-compose.yml"
],
"forwardPorts": [
3000, // grafana
Expand Down
27 changes: 23 additions & 4 deletions .devcontainer/docker-compose.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,37 @@
version: '3.8'

services:
# mongodb_container:
# image: mongo:latest
# environment:
# MONGO_INITDB_ROOT_USERNAME: root
# MONGO_INITDB_ROOT_PASSWORD: rootpassword
# ports:
# - 27017:27017
sailbot-workspace:
build:
context: .
dockerfile: Dockerfile

# URL: mongodb://localhost:27017
mongodb:
# NOTE: CI reads environment variables from sailbot_workspace/.github/workflows/test_definitions.yml instead of here
environment:
- MONGODB_CONN_STR=mongodb://root:rootpassword@mongodb_container:27017
# Initialize mongodb and keep the service running
# command: '/bin/bash -c "sleep 5; mongosh $$CONN_STR --eval \"show dbs;\""; sleep infinity'
command: 'sleep infinity'
depends_on:
- mongodb_container

# # URL: mongodb://mongodb:27017
mongodb_container:
image: mongo:latest
restart: unless-stopped
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: rootpassword
ports:
- 27017:27017

# Runs on the same network as the workspace container, allows "forwardPorts" in devcontainer.json function.
network_mode: service:sailbot-workspace

# Uncomment to change startup options
# environment:
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ services:
- sailbot-new-project-bashhistory:/home/ros/commandhistory:delegated
- sailbot-new-project-roslog:/home/ros/.ros/log:delegated

environment:
- MONGODB_CONN_STR=mongodb://localhost:27017

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/test_definitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: UBCSailbot/sailbot_workspace
ref: user/hhenry01/enable-docker-ci

- name: Checkout ROS package
if: ${{ inputs.repository != 'sailbot_workspace' }}
Expand All @@ -63,12 +64,18 @@ jobs:

- name: Start MongoDB
if: ${{ inputs.repository != 'sailbot_workspace' && inputs.repository != 'custom_interfaces' }}
run: docker-compose -f ".devcontainer/docker-compose.ci.yml" up -d --build
# URL to mongosh command must match what is defined in sailbot_workspace/.devcontainer/.docker-compose.ci.yml
run: docker compose -f .devcontainer/docker-compose.ci.yml up -d && docker compose -f .devcontainer/docker-compose.ci.yml run sailbot-workspace mongosh "mongodb://mongodb_container:27017"

# - name: Get MongoDB Connection String
# if: ${{ inputs.repository != 'sailbot_workspace' && inputs.repository != 'custom_interfaces' }}
# run: docker network ls && docker network inspect devcontainer_default && echo "MONGODB_CONN_STR=mongodb://$(docker network inspect devcontainer_default | grep mongodb -A 3 | grep IPv4Address | cut -d "\"" -f 4 | cut -d "/" -f 1):27017" >> $GITHUB_ENV

- name: Test
uses: ./.github/actions/test/
env:
DISABLE_VCS: ${{ inputs.repository != 'sailbot_workspace' }}
# MONGODB_CONN_STR: $MONGODB_CONN_STR

- name: Stop MongoDB
if: ${{ inputs.repository != 'sailbot_workspace' && inputs.repository != 'custom_interfaces' }}
Expand Down

0 comments on commit 7999f78

Please sign in to comment.