Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ if [ -d /var/cache/bazel ]; then
echo "Bazel Cache: /var/cache/bazel is not owned by ${current_owner_group}. Setting ownership (this may take a few seconds) ..."
sudo chown -R "${current_user_group}" /var/cache/bazel
fi
echo "Bazel Cache: Configuring Bazel to use /var/cache/bazel as cache..."
echo "Bazel Cache: Configuring Bazel to use /var/cache/bazel as cache (= output user root)..."
echo "startup --output_user_root=/var/cache/bazel" >> ~/.bazelrc
echo "Bazel Cache: Configuring Bazel disk cache to be in /var/cache/bazel/diskcache..."
echo "common --disk_cache=/var/cache/bazel/diskcache" >> ~/.bazelrc
else
echo "Bazel Cache: Configuring Bazel disk cache to be in ~/.cache/bazel/_disk_cache..."
# Assuming the default location for the output user root folder is used
# Put disk cache folder within output user root folder
echo "common --disk_cache=~/.cache/bazel/_disk_cache" >> ~/.bazelrc
fi
echo "Bazel Cache: Configuring Bazel disk cache retention time (60 days)..."
echo "common --experimental_disk_cache_gc_max_age=60d" >> ~/.bazelrc
echo "Bazel Cache: Configuring Bazel disk cache max size (50 GB)..."
echo "common --experimental_disk_cache_gc_max_size=50G" >> ~/.bazelrc

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that work with every github runner?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this was meant for local usage. But indeed it might break workflows?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FScholPer Not complaining just asking: How would this break the runner? If the runner uses the container then the container will be the runtime environment environment for the job and in the container I am quite sure the file path ~/.bazelrc is accessible. Or do you mean that the ~ cannot be resolved to the proper home folder location?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the on_create_command to my knowledge is only executed in vscode when choosing the bazel feature to be used. The original/raw container does not even have the bazel stuff in it.
Or can the GHA runner also make use of this devcontainer "feature" functionality too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tools installed via devcontainer features are available. However at least with a simple docker run the startup scripts of these features are not executed:

lure9428@del02614 ~ [1]> docker run ghcr.io/eclipse-score/devcontainer:local-amd64 bash -c "ls -lha /home/vscode/"
total 32K
drwxr-x--- 1 vscode vscode 4.0K Feb  2 10:51 .
drwxr-xr-x 1 root   root   4.0K Feb  2 09:41 ..
-rw-r--r-- 1 vscode vscode  220 Mar 31  2024 .bash_logout
-rw-r--r-- 1 vscode vscode 5.8K Feb  2 09:41 .bashrc
drwxr-xr-x 4 vscode vscode 4.0K Feb  2 10:51 .cache
drwxr-xr-x 2 vscode vscode 4.0K Feb  2 09:41 .config
-rw-r--r-- 1 vscode vscode  807 Mar 31  2024 .profile
lure9428@del02614 ~> docker run ghcr.io/eclipse-score/devcontainer:local-amd64 bash -c "ls -lha /home/vscode/.cache/bazel"
total 12K
drwxr-xr-x 3 vscode vscode 4.0K Feb  2 10:51 .
drwxr-xr-x 4 vscode vscode 4.0K Feb  2 10:51 ..
drwxr-xr-x 4 vscode vscode 4.0K Feb  2 10:51 _bazel_vscode
lure9428@del02614 ~> docker run ghcr.io/eclipse-score/devcontainer:local-amd64 bash -c "type bazel"
bazel is /usr/bin/bazel

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the concern is that the settings might increase disk usage of bazel in runners. I tend to believe that at the moment bazels disk usage is unbounded and with this change I hope that with these settings the size of the bazel cache is limited.

(.ide_support.venv) vscode ➜ /workspaces/score_inc_someip_gateway (add-pre-commit-hooks) $ du -hs /var/cache/bazel/
80G     /var/cache/bazel/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want the full devcontainer running you can do it like this:

uses: devcontainers/ci@v0.3

This should only make use of the image: https://github.com/eclipse-score/reference_integration/blob/a1e29b78844b6258eb6692aabbf349cc83d1f945/.github/workflows/build_and_test_ebclfsa.yml#L32-L33