Skip to content

Commit

Permalink
feat: Make pure::variants workspace configurable
Browse files Browse the repository at this point in the history
The workspace can be configured with the `WORKSPACE_DIR` environment variable.
  • Loading branch information
MoritzWeber0 committed May 6, 2024
1 parent c7516a9 commit ba767ef
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 42 deletions.
18 changes: 13 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ BUILD_ARCHITECTURE ?= amd64

DOCKER_BUILD_FLAGS ?= --platform linux/$(BUILD_ARCHITECTURE)
DOCKER_RUN_FLAGS ?= --add-host=host.docker.internal:host-gateway --rm -it
DOCKER_DEBUG_FLAGS ?= -it --entrypoint="bash" -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$$DISPLAY

# If set to 1, we will push the images to the specified registry
PUSH_IMAGES ?= 0
Expand Down Expand Up @@ -308,6 +309,7 @@ run-papyrus/remote: papyrus/remote
-e RMT_PASSWORD=$(RMT_PASSWORD) \
-e CONNECTION_METHOD=$(CONNECTION_METHOD) \
-e XPRA_SUBPATH=$(XPRA_SUBPATH) \
-e WORKSPACE_DIR=/workspace/papyrus \
-p $(RDP_PORT):3389 \
-p $(WEB_PORT):10000 \
-p $(METRICS_PORT):9118 \
Expand All @@ -319,6 +321,7 @@ run-eclipse/remote: eclipse/remote
-e RMT_PASSWORD=$(RMT_PASSWORD) \
-e CONNECTION_METHOD=$(CONNECTION_METHOD) \
-e XPRA_SUBPATH=$(XPRA_SUBPATH) \
-e WORKSPACE_DIR=/workspace/eclipse \
-p $(RDP_PORT):3389 \
-p $(WEB_PORT):10000 \
-p $(METRICS_PORT):9118 \
Expand All @@ -331,6 +334,7 @@ run-eclipse/remote/pure-variants: eclipse/remote/pure-variants
-e PURE_VARIANTS_LICENSE_SERVER=$(PURE_VARIANTS_LICENSE_SERVER) \
-e CONNECTION_METHOD=$(CONNECTION_METHOD) \
-e XPRA_SUBPATH=$(XPRA_SUBPATH) \
-e WORKSPACE_DIR=/workspace/eclipse_pv \
-v $$(pwd)/volumes/pure-variants:/inputs/pure-variants \
-v $$(pwd)/volumes/workspace:/workspace \
-v $$(pwd)/pure-variants/versions:/opt/versions \
Expand Down Expand Up @@ -382,12 +386,12 @@ run-t4c/client/remote/pure-variants: t4c/client/remote/pure-variants
-e AUTOSTART_CAPELLA=$(AUTOSTART_CAPELLA) \
-e CONNECTION_METHOD=$(CONNECTION_METHOD) \
-e XPRA_SUBPATH=$(XPRA_SUBPATH) \
-e WORKSPACE_DIR=/workspace/capella_pv \
-p $(RDP_PORT):3389 \
-p $(WEB_PORT):10000 \
-p $(METRICS_PORT):9118 \
$(DOCKER_PREFIX)$<:$$(echo "$(DOCKER_TAG_SCHEMA)" | envsubst)


run-t4c/client/backup: t4c/client/base
docker run $(DOCKER_RUN_FLAGS) --rm -it \
-e GIT_REPO_URL="$(GIT_REPO_URL)" \
Expand Down Expand Up @@ -432,20 +436,24 @@ run-t4c/client/exporter: t4c/client/base
-e LOG_LEVEL="$(LOG_LEVEL)" \
$(DOCKER_PREFIX)$<:$$(echo "$(DOCKER_TAG_SCHEMA)" | envsubst) export

debug-capella/base: DOCKER_RUN_FLAGS=-it --entrypoint="bash"
debug-capella/base: DOCKER_RUN_FLAGS=$(DOCKER_DEBUG_FLAGS)
debug-capella/base: run-capella/base

debug-capella/remote: DOCKER_RUN_FLAGS=-it -p $(XPRA_DEBUG_PORT):10001
debug-capella/remote: DOCKER_RUN_FLAGS=$(DOCKER_DEBUG_FLAGS)
debug-capella/remote: run-capella/remote

debug-t4c/client/backup: LOG_LEVEL=DEBUG
debug-t4c/client/backup: DOCKER_RUN_FLAGS=-it --entrypoint="bash" -v $$(pwd)/backups/backup.py:/opt/capella/backup.py
debug-t4c/client/backup: DOCKER_RUN_FLAGS=$(DOCKER_DEBUG_FLAGS) -v $$(pwd)/backups/backup.py:/opt/capella/backup.py
debug-t4c/client/backup: run-t4c/client/backup

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: DOCKER_RUN_FLAGS=$(DOCKER_DEBUG_FLAGS)
debug-t4c/client/remote/pure-variants: run-t4c/client/remote/pure-variants

debug-eclipse/remote/pure-variants: AUTOSTART_ECLIPSE=0
debug-eclipse/remote/pure-variants: DOCKER_RUN_FLAGS=$(DOCKER_DEBUG_FLAGS)
debug-eclipse/remote/pure-variants: run-eclipse/remote/pure-variants

t4c/server/server: SHELL=./capella_loop.sh
t4c/server/server:
$(MAKE) -C t4c/server PUSH_IMAGES=$(PUSH_IMAGES) CAPELLA_VERSION=$$CAPELLA_VERSION $@
Expand Down
1 change: 1 addition & 0 deletions base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ RUN ln -s "$(which python3.11)" /usr/bin/python && \
# Make pre-commit cache persistent
ENV PRE_COMMIT_HOME=/workspace/.pre-commit

ENV WORKSPACE_DIR=/workspace
WORKDIR /workspace

USER techuser
32 changes: 0 additions & 32 deletions docs/docs/pure-variants.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,6 @@ installed in addition.

### Preparation

#### Optional: Download pure::variants dependencies

_This step in only needed if you don't have internet access in your build
environment._

This step is only needed if there is a restricted internet connection in your
build environment.

pure::variants needs a subset of the Eclipse 2020-06 repository. You can find
the directory structure here at the bottom of the page:
<https://download.eclipse.org/releases/2020-06/202006171000/>

Please download all required files. Your tree should look like:

```text
$ tree pure-variants/dependencies
pure-variants/dependencies
├── artifacts.jar
├── content.jar
└── plugins
├── com.google.javascript_0.0.20160315.v20161124-1903.jar
├── com.google.protobuf_2.4.0.v201105131100.jar
├── org.eclipse.wst.common.core_1.3.0.v201903222010.jar
├── org.eclipse.wst.common.environment_1.0.400.v201903222010.jar
├── org.eclipse.wst.common.frameworks_1.2.201.v201903222010.jar
├── org.eclipse.wst.common.project.facet.core_1.4.400.v201903222010.jar
├── org.eclipse.wst.jsdt.core_2.0.303.v202005041016.jar
├── org.eclipse.wst.jsdt.manipulation_1.0.601.v201903222047.jar
├── org.eclipse.wst.jsdt.ui_2.1.0.v202005221335.jar
└── org.eclipse.wst.validation_1.2.800.v201904082137.jar
```

#### Download the `pure::variants` archive

1. Download the pure::variants updateSite from the pure::variants download
Expand Down
Empty file removed eclipse/egit/.gitkeep
Empty file.
4 changes: 2 additions & 2 deletions pure-variants/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ RUN mkdir /tmp/pure-variants && \
unzip /tmp/updateSite/* -d /tmp/pure-variants && \
rm -rf /tmp/updateSite

COPY setup_workspace_purevariants.py /opt/setup/setup_workspace_purevariants.py

USER techuser

RUN installUI=com.ps.consul.eclipse.purevariants.emf.feature.mapping.feature.group,com.ps.consul.eclipse.purevariants.de.enterprise.feature.group; \
Expand All @@ -40,6 +38,8 @@ RUN if [ "$BASE_TYPE" == "capella" ]; \
fi; \
rm -rf /tmp/pure-variants;

COPY setup_workspace_purevariants.py /opt/setup/setup_workspace_purevariants.py

# In some cases, the pure::variants server could not start with the error message:
# Cannot run program `...`, failed to exec spawn helper, exit value: 1
# This fixes the error by switching to the vfork launch mechanism
Expand Down
Empty file.
7 changes: 4 additions & 3 deletions pure-variants/setup_workspace_purevariants.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
logging.basicConfig(level=logging.DEBUG)
LOGGER = logging.getLogger("pure::variants preparation")

eclipse_settings_base_path = pathlib.Path(
"/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings"
WORKSPACE_DIR = os.getenv("WORKSPACE_DIR", "/workspace")
ECLIPSE_SETTINGS_BASE_PATH = pathlib.Path(
f"{WORKSPACE_DIR}/.metadata/.plugins/org.eclipse.core.runtime/.settings"
)


Expand Down Expand Up @@ -71,7 +72,7 @@ def copy_license_file_to_right_location() -> None:
LOGGER.info("Prepare Workspace...")

replace_config(
eclipse_settings_base_path / "com.ps.consul.eclipse.ui.float.prefs",
ECLIPSE_SETTINGS_BASE_PATH / "com.ps.consul.eclipse.ui.float.prefs",
"licenseServerLocation",
os.environ["PURE_VARIANTS_LICENSE_SERVER"],
)
Expand Down

0 comments on commit ba767ef

Please sign in to comment.