Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix workspace ownership in codespaces #148

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}

# Install Dependencies
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends socat file gawk wget git diffstat unzip texinfo \
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends socat file gawk wget acl git diffstat unzip texinfo \
gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils \
iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 xterm python3-subunit \
mesa-common-dev zstd liblz4-tool tmux mc skopeo fdisk ruby-full jq \
Expand Down
16 changes: 16 additions & 0 deletions .devcontainer/post-attach.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
sudo chown root:kvm /dev/kvm
sudo chmod 0660 /dev/kvm

function take_workspace_ownership() {
local USER=$1
local DIR=$2
sudo chown -R ${USER} ${DIR}
sudo setfacl -bnR ${DIR}
}

# Optional: Mount Azure Storage as remote sstate-cache to improve build time.
# This is only required if you want to manually upload / sync build artifacts to your remote sstate-cache
# To configure the sstate-cache and upload local build artifacts, the following environment variables need to be set:
Expand All @@ -44,7 +51,16 @@ function azure-mount() {
fi
}



# First arg: local mount point
# Second arg: Name of Azure container
azure-mount "azure-sstate-cache" "yocto-sstate-cache"
azure-mount "azure-downloads-cache" "downloads"

# There is a umask issue in GitHub codespaces
# possibly related to: https://github.com/orgs/community/discussions/26026
# which causes some recipes to fail to build, due to wrong permissions (e.g. gpsd)
if [ -z "$CODESPACE_VSCODE_FOLDER" ]; then
take_dir_ownership $(whoami) ${CODESPACE_VSCODE_FOLDER}
fi