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

Add gitpod development configuration #528

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
84 changes: 84 additions & 0 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
FROM gitpod/workspace-full

# Install go
RUN rm -rf $HOME/go $HOME/go-packages

RUN echo "export GOPATH=/workspace/go" >> ~/.bashrc.d/300-go && \
echo "export GOBIN=\$GOPATH/bin" >> ~/.bashrc.d/300-go && \
echo "export GOROOT=${HOME}/go" >> ~/.bashrc.d/300-go && \
echo "export PATH=\$GOROOT/bin:\$GOBIN:\$PATH" >> ~/.bashrc
RUN bash -c "source ~/.bashrc && source ~/.bashrc.d/300-go"

RUN export CUSTOM_GO_VERSION=$(curl -sSL "https://raw.githubusercontent.com/ComplianceAsCode/compliance-operator/master/go.mod" | awk '/^go/{print $2}') && \
curl -fsSL "https://dl.google.com/go/go${CUSTOM_GO_VERSION}.linux-amd64.tar.gz" | \
tar -xz -C $HOME

# Setup for content build https://github.com/ComplianceAsCode/content/.gitpod.Dockerfile
ENV PYTHONUSERBASE=/workspace/.pip-modules
ENV PATH=$PYTHONUSERBASE/bin:$PATH
ENV PIP_USER=yes
USER gitpod
RUN sudo apt-get update -q && \
sudo apt-get install -yq \
cmake \
ninja-build \
libxml2-utils \
xsltproc \
python3-jinja2 \
python3-yaml \
python3-setuptools \
ansible-lint \
python3-github \
bats \
python3-pytest \
python3-pytest-cov \
libdbus-1-dev libdbus-glib-1-dev libcurl4-openssl-dev \
libgcrypt20-dev libselinux1-dev libxslt1-dev libgconf2-dev libacl1-dev libblkid-dev \
libcap-dev libxml2-dev libldap2-dev libpcre3-dev python3-dev swig libxml-parser-perl \
libxml-xpath-perl libperl-dev libbz2-dev librpm-dev g++ libapt-pkg-dev libyaml-dev \
libxmlsec1-dev libxmlsec1-openssl \
shellcheck \
bats \
yamllint

RUN wget https://github.com/OpenSCAP/openscap/releases/download/1.3.6/openscap-1.3.6.tar.gz

RUN tar -zxvf openscap-1.3.6.tar.gz

RUN cd openscap-1.3.6 && \
mkdir -p build && cd build && \
cmake -DCMAKE_INSTALL_PREFIX=/ .. && \
sudo make install && \
cd ../..

# Setup podman
RUN sudo apt-get install -y podman

RUN cp /usr/share/containers/containers.conf /etc/containers/storage.conf \
# use vfs storage driver add the following line to /etc/containers/storage.conf
# [storage]

# # Default Storage Driver, Must be set for proper operation.
# driver = "vfs"
# rootless_storage_path = "$HOME/.local/share/containers/storage"
echo "[storage]\n driver = \"vfs\"\n rootless_storage_path = \"$HOME/.local/share/containers/storage\"" | sudo tee -a /etc/containers/storage.conf

RUN sudo sed -i 's/^"net.ipv4.ping_group_range=0 0",/# "net.ipv4.ping_group_range=0 0",/' /etc/containers/storage.conf

# OC
ARG REPO_URL="https://github.com/okd-project/okd/releases/download"
ARG RELEASE_TAG="4.13.0-0.okd-2023-05-22-052007"

ARG RELEASE_PKG="openshift-client-linux-4.13.0-0.okd-2023-05-22-052007.tar.gz"
ARG INSTALL_URL="${REPO_URL}/${RELEASE_TAG}/${RELEASE_PKG}"
ARG TEMP_DIR="/tmp/openshift-client"
ARG TEMP_FILE="openshift-client-linux.tar.gz"
RUN bash -c "mkdir -p '${TEMP_DIR}' \
&& wget -nv -O '${TEMP_DIR}/${TEMP_FILE}' '${INSTALL_URL}' \
&& tar zxvf '${TEMP_DIR}/${TEMP_FILE}' -C '${TEMP_DIR}' \
&& sudo mv '${TEMP_DIR}/oc' '/usr/local/bin/' \
&& sudo mv '${TEMP_DIR}/kubectl' '/usr/local/bin/' \
&& rm '${TEMP_DIR}/${TEMP_FILE}' \
&& oc version --client \
&& kubectl version --client \
"
34 changes: 34 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
image:
file: .gitpod.Dockerfile


vscode:
extensions:
- golang.go
- premparihar.gotestexplorer
- eamodio.gitlens # cool git extension with a bunch of extra features
- ggbecker.content-navigator # useful extension for the ComplianceAsCode/content project
- ritwickdey.liveserver # HTML preview
- rogalmic.bash-debug # support bashdb debug configurations
- twxs.cmake # support to CMakeLists.txt syntax highlighting and more
- ms-python.python # running python configurations

tasks:
- name: Setup Env
init: |
rm -rf $HOME/go $HOME/go-packages && \
echo "export GOPATH=/workspace/go" >> ~/.bashrc.d/300-go && \
echo "export GOBIN=\$GOPATH/bin" >> ~/.bashrc.d/300-go && \
echo "export GOROOT=${HOME}/go" >> ~/.bashrc.d/300-go && \
echo "export PATH=\$GOROOT/bin:\$GOBIN:\$PATH" >> ~/.bashrc && \
source ~/.bashrc && \
export CUSTOM_GO_VERSION=$(curl -sSL "https://raw.githubusercontent.com/ComplianceAsCode/compliance-operator/master/go.mod" | awk '/^go/{print $2}') && \
curl -fsSL "https://dl.google.com/go/go${CUSTOM_GO_VERSION}.linux-amd64.tar.gz" | \
tar -xz -C $HOME


additionalRepositories:
- url: https://github.com/ComplianceAsCode/content
checkoutLocation: content

workspaceLocation: compliance-operator/main.code-workspace
12 changes: 12 additions & 0 deletions main.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
// All paths are relative to your main repo
// The additional repos are cloned inside /workspace dir
"folders": [
{
"path": "." // Main repo that you will open in Gitpod
},
{
"path": "../content" // Additional repo
},
]
}
Loading