-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Archlinux gitpod layer #4900
Archlinux gitpod layer #4900
Conversation
/assign @csweichel |
/werft run 👍 started the job as gitpod-build-archlinux-gitpod-layer-fork.0 |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: da-moon The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@csweichel there were a bunch of minor issues that I found in the image and I have addressed them in my latest commits. so far I can get the build working locally. In case the problem persists, I do have some hypotheses on what may be the cause of this problem. possible causes
Additional context
FROM archlinux:base
# ─── INITIAL SETUP ──────────────────────────────────────────────────────────────
USER root
RUN \
pacman-key --init > /dev/null 2>&1 \
&& pacman-key --populate archlinux > /dev/null 2>&1 \
&& pacman -Syyu --noconfirm >/dev/null 2>&1 \
&& pacman -S --noconfirm bash >/dev/null 2>&1
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# ─── INITIAL VALIDATIONS ────────────────────────────────────────────────────────
USER root
# [ NOTE ] in case gitpod user exists and has a uid
# that is not 33333, this run statement will fail.
RUN \
set -xue ; \
if getent passwd "gitpod" > /dev/null 2>&1; then \
[ "$(id -u gitpod)" != "33333" ] \
&& echo >&2 "Error: User 'gitpod' exists but does not have user-id 33333. The user-id is $(id -u)" \
&& exit 1 ; \
else \
exit 0 ; \
fi
# ─── CONFIGURING PACMAN ─────────────────────────────────────────────────────────
USER root
RUN \
set -xue ; \
sed -i \
-e "/ParallelDownloads/d" \
-e '/\[options\]/a ParallelDownloads = 16' \
/etc/pacman.conf \
&& sed -i \
-e "/Color/d" \
-e "/ILoveCandy/d" \
-e '/\[options\]/a Color' \
-e '/\[options\]/a ILoveCandy' \
/etc/pacman.conf ;
# ─── INSTALLING CORE PACKAGES ───────────────────────────────────────────────────
USER root
RUN \
set -xue ; \
[ -r /usr/bin/gp ] && ln -sf /usr/bin/gp /usr/bin/gp-preview ; \
pacman -Sy --noconfirm --needed \
git \
base-devel \
bash-completion \
wget \
curl \
sudo \
> /dev/null 2>&1 ;
# ─── SUDO SETUP ─────────────────────────────────────────────────────────────────
USER root
RUN \
set -xue ; \
! getent group sudo > /dev/null && groupadd sudo \
&& sed -i \
-e '/%wheel.*NOPASSWD:\s*ALL/d' \
-e '/%wheel\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/d' \
/etc/sudoers \
&& ( \
echo "%wheel ALL=(ALL) ALL" ; \
echo "%wheel ALL=(ALL) NOPASSWD: ALL" ; \
) | tee -a /etc/sudoers > /dev/null ;
# ─── USER SETUP ─────────────────────────────────────────────────────────────────
USER root
# [ NOTE ] => user password was generated through the following command
# perl -e 'print crypt($ARGV[0], "password")' "gitpod"
RUN \
set -xue ; \
! getent group "gitpod" > /dev/null \
&& groupadd --gid "33333" "gitpod" > /dev/null > /dev/null ; \
! getent passwd "gitpod" > /dev/null \
&& useradd \
--no-log-init \
--create-home \
--home-dir "/home/gitpod" \
--gid "33333" \
--uid "33333" \
--groups sudo \
--shell "/bin/bash" \
--password "paF0XkFNewMcY" \
"gitpod" && \
cp -R /root/. /home/gitpod ;
RUN \
set -xue ; \
echo "gitpod:gitpod" | chpasswd \
&& chown "$(id -u gitpod):$(id -g gitpod)" /home/gitpod/ -R \
&& usermod -aG wheel,root "gitpod" \
&& passwd -l root || true
# ─── PARU INSTALL ───────────────────────────────────────────────────────────────
USER "gitpod"
# [ NOTE ] => this run statement tries to install paru up to five failures
# as sometimes, aur may be temporarily unavailable
RUN \
set -xue ; \
[ ! -d "/home/gitpod/.cargo" ] && clean_cargo="true" || clean_cargo=="false" ; \
git clone https://aur.archlinux.org/paru.git /tmp/paru \
&& pushd /tmp/paru > /dev/null 2>&1 \
&& for i in {1..5}; do makepkg --noconfirm -sicr > /dev/null 2>&1 && break || sleep 15; done \
&& paru --version > /dev/null 2>&1 \
! cargo --version > /dev/null 2>&1 \
&& popd > /dev/null 2>&1 \
&& [[ "${clean_cargo}" == "true" ]] && rm -r "/home/gitpod/.cargo" ;
# ─── COPY CONFIG AND LAYER SCRIPT ───────────────────────────────────────────────
COPY ./gitpod /var/gitpod
# ─── CONFIGURE USER SHELL ───────────────────────────────────────────────────────
USER "gitpod"
# TODO Remove this in the near future when we do not need ~/.bashrc appends/prepends any more
RUN \
set -xue ; \
BASH_RC=~/.bashrc; \
[ ! -d "/home/gitpod" ] && echo >&2 "'gitpod' user home directory not found" && exit 1 ; \
[ -r "$BASH_RC" ] && cp "$BASH_RC" ~/.bashrc-org || touch ~/.bashrc-org ; \
touch ~/.hushlogin ; \
cat /var/gitpod/.bashrc-prepend > "$BASH_RC" \
&& cat ~/.bashrc-org >> "$BASH_RC" \
&& cat /var/gitpod/.bashrc-append >> "$BASH_RC"
# ─── CLEANUP AND FINALIZATIONS ──────────────────────────────────────────────────
USER root
RUN \
set -xue ; \
chown "$(id -u gitpod):$(id -g gitpod)" "/home/gitpod" -R \
&& pacman -Qdtq | sudo pacman -Rs - > /dev/null 2>&1 || true \
&& pacman --noconfirm -Scc > /dev/null 2>&1 \
&& rm -rf \
/var/cache/pacman/pkg/* \
/tmp/*
# ────────────────────────────────────────────────────────────────────────────────
USER gitpod |
@csweichel Have you had a chance to run the build again with my recent changes ? |
@csweichel based on commit history, it looks like the Gitpod layer has been removed. Are changes in production now? Update : it looks like Gitpod SaaS still has the Gitpod layer stage. Any ETA on when it is GA or deployed on gitpod.io infra? |
@da-moon Sorry for the many delays in having this shipped. We're still not running image-buider-mk3 in production. Currently we're blocked by this issue. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
PULL REQUEST
Description of Request
Reason or Need for Feature
support Alpine.
Design / Proposal
setup a minimal layer for Arch Linux that takes care of the following
of core package changes such as
pacman
orglibc
aur
packages are installedgitpod
user withuid
andgid
of33333
existsgitpod
user belongs tosudo
,wheel
androot
groups.prepend
andappend
bashrc files have been added to gitpod user's~/.bashrc
paru
aur helperAdditional context
example
gitpod image in case you are interested in a more feature packed imageRUN
directives in Gitpod's image repository, such as workspace-full have equivalent AURpkgbuild
or are already in mainline repositories and it is significantly less work to install the exact same set of tools that exists in Ubuntu based images in an Arch based image