Skip to content

Commit

Permalink
feat(capella)!: Provision models via Capella plugin
Browse files Browse the repository at this point in the history
Load models from a directory into a Capella workspace.

This will replace the old read-only image.

In addition, the welcome screen disabling didn't work and has been fixed.

BREAKING CHANGE: Read-only and EASE images have been removed.
  • Loading branch information
MoritzWeber0 committed Apr 22, 2024
1 parent 718fb53 commit db9dd0a
Show file tree
Hide file tree
Showing 34 changed files with 262 additions and 1,167 deletions.
40 changes: 16 additions & 24 deletions .github/workflows/deploy-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ name: Build & push images
on:
push:
pull_request:
branches: ["main"]
branches: ['main']

env:
registry: ghcr.io/dsd-dbs/capella-dockerimages/
images: capella/base capella/remote capella/ease capella/readonly
images: capella/base capella/remote

jobs:
lint:
Expand All @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: '3.11'
- name: Install pre-commit
run: |-
python -m pip install pre-commit
Expand All @@ -32,16 +32,18 @@ jobs:
strategy:
matrix:
capella_version:
- "5.0.0"
- "5.2.0"
- "6.0.0"
- "6.1.0"
- '5.0.0'
- '5.2.0'
- '6.0.0'
- '6.1.0'
dropins:
- name: "without" # without dropins
dropins: ""
- name: "selected"
dropins: "CapellaXHTMLDocGen,DiagramStyler,PVMT,Filtering,Requirements,SubsystemTransition" # selected set of dropins
name: Capella ${{ matrix.capella_version }} with ${{ matrix.dropins.name }} dropins
- name: 'without' # without dropins
dropins: ''
- name: 'selected'
dropins: 'CapellaXHTMLDocGen,DiagramStyler,PVMT,Filtering,Requirements,SubsystemTransition' # selected set of dropins
name:
Capella ${{ matrix.capella_version }} with ${{ matrix.dropins.name }}
dropins
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -50,7 +52,7 @@ jobs:
with:
cache: pip
cache-dependency-path: ./pyproject.toml
python-version: "3.11"
python-version: '3.11'
- name: Login to github container registry
uses: docker/login-action@v3
with:
Expand All @@ -63,6 +65,7 @@ jobs:
echo "branch=$(echo $GITHUB_REF_NAME | sed 's/[^a-zA-Z0-9.]/-/g')" >> "$GITHUB_OUTPUT"
echo "sha=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Build
# prettier-ignore
run: >
make ${{ env.images }}
CAPELLA_VERSIONS="${{ matrix.capella_version }}"
Expand All @@ -71,17 +74,6 @@ jobs:
CAPELLA_DROPINS="${{ matrix.dropins.dropins }}"
DOCKER_TAG_SCHEMA=${{ matrix.capella_version }}-${{ matrix.dropins.name }}-dropins-${{ steps.tag.outputs.branch }}
DOCKER_BUILD_FLAGS="--label git-short-sha=${{ steps.tag.outputs.sha }}"
- name: Install test dependencies
run: |
docker build $DOCKER_BUILD_ARGS -t local-git-server tests/local-git-server
pip install '.[test]'
- name: Run pytest
run: >
DOCKER_PREFIX="${{ env.registry }}"
DOCKER_TAG="${{ matrix.capella_version }}-${{ matrix.dropins.name }}-dropins-${{ steps.tag.outputs.branch }}"
CAPELLA_VERSION="${{ matrix.capella_version }}"
LOCAL_GIT_TAG="latest"
pytest -m "not (t4c_server or t4c)" tests
- name: Push
run: |
for image in ${{ env.images }}
Expand Down
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ t4c/server
t4c/.dockerignore
!t4c/updateSite/*/.gitkeep

# EASE
ease/debug/libs/*
ease/extensions/*/*
!ease/extensions/*/.gitkeep

# Pure::variants
pure-variants/versions/*/*
!pure-variants/versions/*/.gitkeep
Expand Down
82 changes: 8 additions & 74 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ CAPELLA_BUILD_TYPE ?= online
# Set the option to 'false' if you want to run it on arm architectures.
INSTALL_OLD_GTK_VERSION ?= true

EASE_BUILD_TYPE ?= online

PURE_VARIANTS_LICENSE_SERVER ?= http://localhost:8080

# Inject libraries from the capella/libs directory
Expand All @@ -131,10 +129,6 @@ DOCKER_REGISTRY ?= localhost:12345
# Log level when running Docker containers
LOG_LEVEL ?= DEBUG

# Path to a JSON file, which is used as input for the
# make-run/capella/readonly target.
READONLY_JSON_PATH ?= local/readonly.json

# If this option is set to 1, all tests that require a running t4c server
# will be executed. To run these tests, you need a Makefile in
# t4c/server with a target t4c/server/server that builds the t4c server
Expand Down Expand Up @@ -164,11 +158,7 @@ all: \
t4c/client/base \
t4c/client/remote \
t4c/client/remote/pure-variants \
capella/remote/pure-variants \
capella/ease \
t4c/client/ease \
capella/ease/remote \
capella/readonly
capella/remote/pure-variants

base: SHELL=/bin/bash
base:
Expand Down Expand Up @@ -276,26 +266,6 @@ capella/remote/pure-variants: capella/remote
docker build $(DOCKER_BUILD_FLAGS) -t $(DOCKER_PREFIX)$@:$$DOCKER_TAG --build-arg BASE_IMAGE=$(DOCKER_PREFIX)$<:$$DOCKER_TAG pure-variants
$(MAKE) PUSH_IMAGES=$(PUSH_IMAGES) IMAGENAME=$@ .push

capella/ease: SHELL=./capella_loop.sh
capella/ease: capella/base
docker build $(DOCKER_BUILD_FLAGS) -t $(DOCKER_PREFIX)$@:$$DOCKER_TAG --build-arg BASE_IMAGE=$(DOCKER_PREFIX)$<:$$DOCKER_TAG --build-arg BUILD_TYPE=$(EASE_BUILD_TYPE) ease
$(MAKE) PUSH_IMAGES=$(PUSH_IMAGES) IMAGENAME=$@ .push

t4c/client/ease: SHELL=./capella_loop.sh
t4c/client/ease: t4c/client/base
docker build $(DOCKER_BUILD_FLAGS) -t $(DOCKER_PREFIX)$@:$$DOCKER_TAG --build-arg BASE_IMAGE=$(DOCKER_PREFIX)$<:$$DOCKER_TAG --build-arg BUILD_TYPE=$(EASE_BUILD_TYPE) ease
$(MAKE) PUSH_IMAGES=$(PUSH_IMAGES) IMAGENAME=$@ .push

capella/ease/remote: SHELL=./capella_loop.sh
capella/ease/remote: capella/ease
docker build $(DOCKER_BUILD_FLAGS) -t $(DOCKER_PREFIX)$@:$$DOCKER_TAG --build-arg BASE_IMAGE=$(DOCKER_PREFIX)$<:$$DOCKER_TAG remote
$(MAKE) PUSH_IMAGES=$(PUSH_IMAGES) IMAGENAME=$@ .push

capella/readonly: SHELL=./capella_loop.sh
capella/readonly: capella/ease/remote
docker build $(DOCKER_BUILD_FLAGS) -t $(DOCKER_PREFIX)$@:$$DOCKER_TAG --build-arg BASE_IMAGE=$(DOCKER_PREFIX)$<:$$DOCKER_TAG readonly
$(MAKE) PUSH_IMAGES=$(PUSH_IMAGES) IMAGENAME=$@ .push

capella/builder:
docker build $(DOCKER_BUILD_FLAGS) -t $(DOCKER_PREFIX)$@:$(CAPELLA_DOCKERIMAGES_REVISION) builder
docker run -it -e CAPELLA_VERSION=$(CAPELLA_VERSION) -v $$(pwd)/builder/output/$(CAPELLA_VERSION):/output -v $$(pwd)/builder/m2_cache:/root/.m2/repository $(DOCKER_PREFIX)$@:$(CAPELLA_DOCKERIMAGES_REVISION)
Expand All @@ -313,10 +283,15 @@ run-jupyter-notebook: jupyter-notebook
$(DOCKER_PREFIX)$<:$(JUPYTER_NOTEBOOK_REVISION)

run-capella/remote: capella/remote
FLAGS="";
if [ -n "$(WORKSPACE_NAME)" ]; then \
FLAGS="-v $$(pwd)/volumes/workspaces/$(WORKSPACE_NAME):/workspace"; \
fi
docker run $(DOCKER_RUN_FLAGS) \
-v $$(pwd)/volumes/workspaces/$(WORKSPACE_NAME):/workspace \
$$FLAGS \
-e RMT_PASSWORD=$(RMT_PASSWORD) \
-e CONNECTION_METHOD=$(CONNECTION_METHOD) \
-e AUTOSTART_CAPELLA=$(AUTOSTART_CAPELLA) \
-e XPRA_SUBPATH=$(XPRA_SUBPATH) \
-p $(RDP_PORT):3389 \
-p $(WEB_PORT):10000 \
Expand Down Expand Up @@ -362,31 +337,6 @@ run-eclipse/remote/pure-variants: eclipse/remote/pure-variants
$(DOCKER_PREFIX)$<:$(DOCKER_TAG)


run-capella/readonly: capella/readonly
docker run $(DOCKER_RUN_FLAGS) \
-e RMT_PASSWORD=$(RMT_PASSWORD) \
-e GIT_URL=$(GIT_REPO_URL) \
-e GIT_ENTRYPOINT=$(GIT_REPO_ENTRYPOINT) \
-e GIT_REVISION=$(GIT_REPO_BRANCH) \
-e GIT_DEPTH=$(GIT_REPO_DEPTH) \
-e GIT_USERNAME="$(GIT_USERNAME)" \
-e GIT_PASSWORD="$(GIT_PASSWORD)" \
-e CONNECTION_METHOD=$(CONNECTION_METHOD) \
-e XPRA_SUBPATH=$(XPRA_SUBPATH) \
-p $(RDP_PORT):3389 \
-p $(WEB_PORT):10000 \
$(DOCKER_PREFIX)$<:$$(echo "$(DOCKER_TAG_SCHEMA)" | envsubst)

run-capella/readonly-json: capella/readonly
docker run $(DOCKER_RUN_FLAGS) \
-e RMT_PASSWORD=$(RMT_PASSWORD) \
-e GIT_REPOS_JSON="$$(cat $(READONLY_JSON_PATH))" \
-e CONNECTION_METHOD=$(CONNECTION_METHOD) \
-e XPRA_SUBPATH=$(XPRA_SUBPATH) \
-p $(RDP_PORT):3389 \
-p $(WEB_PORT):10000 \
$(DOCKER_PREFIX)$<:$$(echo "$(DOCKER_TAG_SCHEMA)" | envsubst)

run-t4c/client/remote-legacy: t4c/client/remote
docker run $(DOCKER_RUN_FLAGS) \
-v $$(pwd)/volumes/workspaces/$(WORKSPACE_NAME):/workspace \
Expand Down Expand Up @@ -493,22 +443,6 @@ debug-t4c/client/remote/pure-variants: AUTOSTART_CAPELLA=0
debug-t4c/client/remote/pure-variants: DOCKER_RUN_FLAGS=-it --entrypoint="bash"
debug-t4c/client/remote/pure-variants: run-t4c/client/remote/pure-variants

debug-capella/readonly: DOCKER_RUN_FLAGS=-it \
-e DISPLAY=:0 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $$(pwd)/local/scripts:/opt/scripts/debug \
-v $$(pwd)/readonly/load_models.py:/opt/scripts/load_models.py \
--entrypoint="bash"
debug-capella/readonly: run-capella/readonly

debug-capella/readonly-json: DOCKER_RUN_FLAGS=-it \
-e DISPLAY=:0 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $$(pwd)/local/scripts:/opt/scripts/debug \
-v $$(pwd)/readonly/load_models.py:/opt/scripts/load_models.py \
--entrypoint="bash"
debug-capella/readonly-json: run-capella/readonly-json

t4c/server/server: SHELL=./capella_loop.sh
t4c/server/server:
$(MAKE) -C t4c/server PUSH_IMAGES=$(PUSH_IMAGES) CAPELLA_VERSION=$$CAPELLA_VERSION $@
Expand All @@ -532,7 +466,7 @@ test: t4c/client/remote
endif

test: SHELL=./capella_loop.sh
test: capella/readonly
test:
export CAPELLA_VERSION=$$CAPELLA_VERSION
source .venv/bin/activate
cd tests
Expand Down
43 changes: 18 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,27 @@ SPDX-License-Identifier: Apache-2.0

[![REUSE status](https://api.reuse.software/badge/github.com/DSD-DBS/capella-dockerimages)](https://api.reuse.software/info/github.com/DSD-DBS/capella-dockerimages)

## Documentation

The documentation has been moved to
[Github Pages](https://dsd-dbs.github.io/capella-dockerimages/).

## Introduction

This repository provides Docker images for the followings tools:
This repository provides containerized clients for the followings tools:

- [Capella](https://www.eclipse.org/capella/)
- [TeamForCapella client](https://www.obeosoft.com/en/team-for-capella) \
Right now, we don't provide a Docker image for the server.
- [EASE](https://www.eclipse.org/ease/) \
[SWT-Bot](https://www.eclipse.org/swtbot/)
- [TeamForCapella](https://www.obeosoft.com/en/team-for-capella)
- [Eclipse Papyrus](https://eclipse.dev/papyrus/)
- [Eclipse IDE](https://eclipseide.org/)
- [pure::variants](https://www.pure-systems.com/de/purevariants)
- [Jupyter Notebook](https://jupyter.org/)

In general, we are providing images to run applications in a containerized
environment and to automate processes around the tools.

This repository includes Docker files to build the following Docker images:

| Name of the Docker image | Short description |
| ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `base` | This is the base image that has the most important tools pre-installed. |
| `capella/base` | This is the Capella base image. It is a simple container with Capella and the required dependencies installed. No more. |
| `t4c/client/base` | This extends the Capella base image with the T4C client and the dependencies, as well as features to synchronize T4C and Git repositories. |
| `capella/ease`<br>`t4c/client/ease` | This extends the Capella or T4C client base image with EASE and SWTBot functionality. You can mount every Python script and execute it in a container environment. |
| `capella/remote`<br>`t4c/client/remote` | The remote image will add an RDP server on top of any other image. This will provide the user the possibility to connect and work inside the container. |
| `capella/readonly` | This image has capability to clone a Git repository, will load the project into the workspace and also offers RDP. |
| `capella/remote/pure-variants`<br>`t4c/client/remote/pure-variants` | This extends the remote image with pure::variants support. |
| `jupyter-notebook` | A Jupyter notebook image based on the base image. |
The main purposes for containerizing these tools are:

- **Easy to use**: No need to install the tools on your local machine.
- **Reproducibility**: The same environment can be easily reproduced on
different machines.
- **Isolation**: The tools are isolated from the host machine.
- **Documentation**: All configuration options are documented in the
Dockerfiles.
- **Collaboration**: The containers can be used in the
[Collaboration Manager](https://github.com/DSD-DBS/capella-collab-manager)

More information can be found in our
[documentation](https://dsd-dbs.github.io/capella-dockerimages/).
2 changes: 1 addition & 1 deletion builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ENV SHELL=/bin/bash
RUN apt-get update && \
apt-get install -y maven

RUN pip install --break-system-packages --no-cache-dir lxml==4.9.3
RUN pip install --no-cache-dir lxml==4.9.3

COPY inject_architecture_into_pom.py /opt/inject_architecture_into_pom.py
COPY build_capella_from_source.sh /opt/build_capella_from_source.sh
Expand Down
5 changes: 2 additions & 3 deletions capella/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ ARG MEMORY_LIMIT=5500m
RUN echo '-Dorg.eclipse.equinox.p2.transport.ecf.retry=15' >> /opt/capella/capella.ini && \
echo '-Dorg.eclipse.ecf.provider.filetransfer.retrieve.readTimeout=10000' >> /opt/capella/capella.ini && \
sed -i "s/-Xmx[^ ]*/-Xmx$MEMORY_LIMIT/g" /opt/capella/capella.ini
RUN pip install --no-cache-dir PyYAML==6.0.1 && python install_dropins.py
RUN pip install --no-cache-dir lxml==4.9.3 PyYAML==6.0.1 && python install_dropins.py

COPY ./versions/${CAPELLA_VERSION}/patches /opt/patches
RUN PATCH_DIR=/opt/patches /opt/patch.sh
Expand All @@ -143,8 +143,7 @@ RUN mkdir -p /opt/capella/configuration/.settings; \
chown techuser /opt /opt/capella/capella.ini

RUN echo '-Dosgi.configuration.area=file:/opt/capella/configuration' >> /opt/capella/capella.ini
COPY setup_workspace.py /opt/setup/setup_welcome_screen.py
COPY replace_env_variables.sh /opt/setup/replace_env_variables.sh
COPY startup/* /opt/setup/

ENV AUTOSTART_CAPELLA=1
ENV RESTART_CAPELLA=1
Expand Down
8 changes: 5 additions & 3 deletions capella/autostart
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/sh
#!/bin/bash
# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors
# SPDX-License-Identifier: Apache-2.0

# Autostart script for OpenBox

# Autostart script
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Load environment variables from /etc/environment
source /etc/environment

nitrogen --restore &

if [ "$AUTOSTART_CAPELLA" = "1" ];
Expand Down
Loading

0 comments on commit db9dd0a

Please sign in to comment.