Skip to content

Commit

Permalink
New macOS documentation (#2315)
Browse files Browse the repository at this point in the history
* added clab icon to the website

* init macos-arm docs

* add multiarch build

* install clab via curl script to allow multi arch downloads

* checking plugins installation

* remove atuin install

* use docker build push action

* set dockerfile path

* use devcontainer step

* add default value for the clab_version input

* not using moby for d-in-d due to

#60 75.51 (!) Packages for moby not available in OS debian bookworm (arm64). To resolve, either: (1) set feature option '"moby": false' , or (2) choose a compatible OS version (eg: 'ubuntu-20.04').

* update skopeo

* use packaged skopeo

* install go via dockerfile and not devcontainer features as this was super slow

* try tar without sudo as sudo failed in gh actions

* install docker as not vscode user

* bring back devcontainer feature for go

dockerfile install is not faster

* added go extension

* added macos docs and changed the macros

* fix links
  • Loading branch information
hellt authored Nov 27, 2024
1 parent 2269834 commit d2f7f58
Show file tree
Hide file tree
Showing 42 changed files with 690 additions and 411 deletions.
15 changes: 9 additions & 6 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ RUN echo "deb [trusted=yes] https://netdevops.fury.site/apt/ /" | \

# Install necessary packages, including curl
RUN apt-get update && apt-get install -y --no-install-recommends \
containerlab${CLAB_VERSION:+=$CLAB_VERSION} \
direnv \
btop \
iputils-ping \
Expand All @@ -19,15 +18,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
telnet \
curl

# Install Containerlab
RUN bash -c "$(curl -sL https://get.containerlab.dev)" -- -v ${CLAB_VERSION}

# Install GitHub CLI directly from the latest release
RUN bash -c 'VERSION=$(curl -s https://api.github.com/repos/cli/cli/releases/latest | \
RUN bash -c 'ARCH=$(uname -m | sed "s/x86_64/amd64/" | sed "s/aarch64/arm64/") && \
VERSION=$(curl -s https://api.github.com/repos/cli/cli/releases/latest | \
grep -oP "\"tag_name\": \"\K[^\"]+") && \
CLEAN_VERSION=${VERSION#v} && \
DOWNLOAD_URL="https://github.com/cli/cli/releases/download/${VERSION}/gh_${CLEAN_VERSION}_linux_amd64.tar.gz" && \
DOWNLOAD_URL="https://github.com/cli/cli/releases/download/${VERSION}/gh_${CLEAN_VERSION}_linux_${ARCH}.tar.gz" && \
curl -L "$DOWNLOAD_URL" | tar xz -C /tmp && \
mv /tmp/gh_${CLEAN_VERSION}_linux_amd64/bin/gh /usr/local/bin/ && \
mv /tmp/gh_${CLEAN_VERSION}_linux_${ARCH}/bin/gh /usr/local/bin/ && \
chmod +x /usr/local/bin/gh && \
rm -rf /tmp/gh_${CLEAN_VERSION}_linux_amd64'
rm -rf /tmp/gh_${CLEAN_VERSION}_linux_${ARCH}'

# Install gNMIc and gNOIc
RUN bash -c "$(curl -sL https://get-gnmic.openconfig.net)" && \
Expand Down Expand Up @@ -61,7 +64,7 @@ COPY ./.devcontainer/zsh/install-zsh-plugins.sh /tmp/install-zsh-plugins.sh
RUN bash -c "/tmp/install-zsh-plugins.sh"

# Setup pyenv virtual environment for clab tests
COPY ./tests/requirements.txt /tmp/requirements.txt
COPY tests/requirements.txt /tmp/requirements.txt
ENV PYENV_ROOT="/home/vscode/.pyenv"
ENV PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH"
RUN pyenv virtualenv system clab-rf \
Expand Down
5 changes: 4 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "26.1.4",
"dockerDashComposeVersion": "none"
"dockerDashComposeVersion": "none",
"moby": "false"
},
// Add sshd to support gh cli codespace cp.
"ghcr.io/devcontainers/features/sshd:1": {
Expand All @@ -24,6 +25,8 @@
"customizations": {
"vscode": {
"extensions": [
// go
"golang.go",
"mhutchie.git-graph",
"ms-azuretools.vscode-docker",
// Python.
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,6 @@ eval "$(atuin init zsh)"
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

# go path
export PATH=$PATH:/usr/local/go/bin:~/go/bin
5 changes: 3 additions & 2 deletions .devcontainer/zsh/install-zsh-plugins.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
# atuin
# bash <(curl --proto '=https' --tlsv1.2 -sSf https://setup.atuin.sh)
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/atuinsh/atuin/releases/download/v18.3.0/atuin-installer.sh | sh
curl -LsSf https://github.com/atuinsh/atuin/releases/download/v18.3.0/atuin-installer.sh | sh

# theme
git clone --depth 1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Expand All @@ -16,7 +17,7 @@ git clone --depth 1 https://github.com/z-shell/F-Sy-H.git ${ZSH_CUSTOM:-$HOME/.o
### Shell completions
###
# generate containerlab completions
containerlab completion zsh > "/home/vscode/.oh-my-zsh/custom/plugins/zsh-autocomplete/Completions/_containerlab"
/usr/bin/containerlab completion zsh > "/home/vscode/.oh-my-zsh/custom/plugins/zsh-autocomplete/Completions/_containerlab"
# add clab alias to the completions
sed -i 's/compdef _containerlab containerlab/compdef _containerlab containerlab clab/g' /home/vscode/.oh-my-zsh/custom/plugins/zsh-autocomplete/Completions/_containerlab
# generate gnmic completions
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/build-devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ on:
inputs:
CLAB_VERSION:
description: "Containerlab version"
default: "0.59.0"
required: false
type: string

TAG:
description: "Additional container image tag"
required: false
type: string
# trigger on published release event
# to created the devspace container when the packages are published
release:
Expand All @@ -36,6 +39,21 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# https://github.com/devcontainers/ci/issues/268#issuecomment-1976014578
- name: remove existing skopeo
run: |
sudo rm -rf $(which skopeo)
- name: Update skopeo
run: |
REPO_URL="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04"
sudo sh -c "echo 'deb ${REPO_URL}/ /' > /etc/apt/sources.list.d/skopeo.list"
curl -fsSL ${REPO_URL}/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/skopeo.gpg > /dev/null
sudo apt update
sudo apt install skopeo
skopeo --version
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
Expand Down Expand Up @@ -65,3 +83,4 @@ jobs:
imageName: ghcr.io/${{ github.repository }}/clab-devcontainer
imageTag: ${{ steps.extract-tags.outputs.tags }}
push: always
platform: linux/amd64,linux/arm64
8 changes: 8 additions & 0 deletions docs/images/containerlab_dark_no_text.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/images/containerlab_export_white_ink_js.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions docs/images/containerlab_full_white_no_text.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions docs/images/containerlab_white_no_text.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ This short clip briefly demonstrates containerlab features and explains its purp

## Features

* **IaaC approach**
* **Lab as Code (IaC) approach**
Declarative way of defining the labs by means of the topology definition [`clab` files](manual/topo-def-file.md).
* **Network Operating Systems centric**
Focus on containerized Network Operating Systems. The sophisticated startup requirements of various NOS containers are abstracted with [kinds](manual/kinds/index.md) which allows the user to focus on the use cases, rather than infrastructure hurdles.
Expand Down
Loading

0 comments on commit d2f7f58

Please sign in to comment.