Skip to content

Commit

Permalink
Enable devcontainers support
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Morales <v.morales@samsung.com>
  • Loading branch information
electrocucaracha committed Jun 14, 2023
1 parent 96e3c64 commit 79017a3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
13 changes: 13 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu-20.04",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:1": {},
"ghcr.io/devcontainers/features/sshd:1": {}
},
"hostRequirements": {
"cpus": 8,
"memory": "32gb"
},
"postCreateCommand": "cd e2e/provision/; cp nephio.yaml ~/nephio.yaml && ./install_sandbox.sh | tee ~/install_sandbox.log",
"forwardPorts": [7007, 3000]
}
1 change: 1 addition & 0 deletions e2e/provision/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Quick Start for GCE
[![Create a Sandbox in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?repo=nephio-project/test-infra)

## Table of Contents

Expand Down
2 changes: 1 addition & 1 deletion e2e/provision/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Vagrant.configure('2') do |config|
sh.inline = <<-SHELL
set -o errexit
set -o pipefail
echo "StrictHostKeyChecking no" >> ~/.ssh/config
cd /vagrant/
cp nephio.yaml ~/nephio.yaml
./install_sandbox.sh | tee ~/install_sandbox.log
Expand Down
8 changes: 7 additions & 1 deletion e2e/provision/install_sandbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ cat "$HOME/.ssh/id_rsa.pub" >>"$HOME/.ssh/authorized_keys"

KVER=$(uname -r)

if ! lsmod | grep -q gtp5g; then
if [[ "${LOAD_GTP5G_MODULE:-false}" == "true" ]] && ! lsmod | grep -q gtp5g; then
[[ -d "$HOME/gtp5g" ]] || git clone --depth 1 -b v0.6.8 https://github.com/free5gc/gtp5g.git "$HOME/gtp5g"

pushd "$HOME/gtp5g" >/dev/null
Expand Down Expand Up @@ -104,6 +104,12 @@ if [ "${DEPLOYMENT_TYPE:-r1}" == "one-summit" ]; then
popd >/dev/null
else
trap get_status ERR
if ! grep -q "StrictHostKeyChecking no" ~/.ssh/config; then
echo "StrictHostKeyChecking no" >> ~/.ssh/config
fi
if [ "${CODESPACE_NAME-}" ] && ! grep -q "ansible_port: 2222" ~/nephio.yaml; then
echo " ansible_port: 2222" >> ~/nephio.yaml
fi
# Management cluster creation
if [[ ${DEBUG:-false} != "true" ]]; then
ansible-playbook -i ~/nephio.yaml playbooks/cluster.yml
Expand Down
4 changes: 3 additions & 1 deletion e2e/provision/playbooks/cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
roles:
- role: andrewrothstein.docker_engine
become: true
when: ( container_engine is not defined ) or ( container_engine == "docker" )
when:
- ( container_engine is not defined ) or ( container_engine == "docker" )
- not lookup('ansible.builtin.env', 'CODESPACE_NAME')
- role: andrewrothstein.podman
when: container_engine == "podman"
- andrewrothstein.kind
Expand Down

0 comments on commit 79017a3

Please sign in to comment.