Skip to content
Draft
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
52 changes: 33 additions & 19 deletions .github/cisetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,37 @@
# specific language governing permissions and limitations
# under the License.
#
sudo sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
cd $HOME
sudo apt-get -y install curl wget jq
WSK_VERSION=1.2.0
WSK_BASE=https://github.com/apache/openwhisk-cli/releases/download
ARCH=amd64
WSK_URL="$WSK_BASE/$WSK_VERSION/OpenWhisk_CLI-$WSK_VERSION-linux-$ARCH.tgz"
curl -sSL https://install.python-poetry.org | python3.12 -
curl -sSL "$WSK_URL" | tar xzvf - -C ~/.local/bin/
VER="v4.5.4"
ARCH="$(dpkg --print-architecture)"
URL="https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2F$VER/kustomize_${VER}_linux_${ARCH}.tar.gz"
curl -sL $URL | tar tzvf - -C ~/.local/bin
YQ_VER=v4.27.2
YQ_BIN=yq_linux_amd64
sudo wget https://github.com/mikefarah/yq/releases/download/${YQ_VER}/${YQ_BIN} -O /usr/bin/yq && sudo chmod +x /usr/bin/yq
MC_VER=RELEASE.2025-05-21T01-59-54Z
sudo wget https://dl.min.io/client/mc/release/linux-${ARCH}/archive/mc.${MC_VER} -O /usr/bin/mc && sudo chmod +x /usr/bin/mc
#URL="https://dl.k8s.io/release/$VER/bin/linux/$ARCH/kubectl"
#curl -sSL "$URL" | sudo tee /usr/local/bin/kubectl && sudo chmod +x /usr/bin/kubectl
#kubectl version
# ensure local bin exists and is on PATH for this script
mkdir -p "$HOME/.local/bin"
export PATH="$HOME/.local/bin:$PATH"

os="$(uname -s | tr '[:upper:]' '[:lower:]')"
arch="$(uname -m)"
case "$arch" in
x86_64) arch=amd64 ;;
aarch64|arm64) arch=arm64 ;;
armv7l) arch=armv7 ;;
i386|i686) arch=386 ;;
esac
RESOLVED_OPS_BIN="$HOME/.ops/${os}-${arch}/bin"

# install ops, wsk wrapper and task
VER="0.1.0-2501041342.dev";\
URL="https://raw.githubusercontent.com/apache/openserverless-cli/refs/tags/v$VER/install.sh" ;\
curl -sL $URL | VERSION="$VER" bash ;\
echo -e '#!/bin/bash\nops -wsk "$@"' >$HOME/.local/bin/wsk ; chmod +x $HOME/.local/bin/wsk ;\
curl -sL https://taskfile.dev/install.sh | sh -s -- -d -b $HOME/.local/bin; \
task --version; \
echo "Installing ops prereq from $HOME" && ops -t

# install prerequisites to run operator tests
cd $GITHUB_WORKSPACE
echo "Installing operator prereq from $GITHUB_WORKSPACE" && ops -t

# Persist ops path for GitHub Actions steps
echo "$RESOLVED_OPS_BIN" >> "$GITHUB_PATH"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"


23 changes: 12 additions & 11 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# under the License.
#

name: openserverless-operator-check
name: Check OpenServerless Operator
on:
push:
branches: [main]
Expand All @@ -26,6 +26,7 @@ on:
jobs:
check:
name: Check OpenServerless Operator
#runs-on: [ self-hosted, Linux, X64 ]
runs-on: ubuntu-22.04
steps:
- name: Checkout
Expand All @@ -46,24 +47,20 @@ jobs:
if: ${{ github.repository_owner != 'apache'}}
run: |
echo "MY_OPERATOR_IMAGE=${{ vars.MY_OPERATOR_IMAGE }}" >> "$GITHUB_ENV"
- name: Kind
uses: container-tools/kind-action@v2.0.4
with:
version: v0.22.0
cluster_name: nuvolaris
config: .github/kind.yaml
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Setup
run: bash .github/cisetup.sh
- name: Kind
run: |
cd $HOME && ops setup docker create && \
kind export kubeconfig --name nuvolaris
- name: Install
run: task setup
- name: BuildAndLoad
run: task build-and-load TAG="$IMG_TAG"
- name: AddIngress
run: task kind:ingress
- name: Ngrok
if: ${{ env.NGROK == 'on' }}
run: bash .github/debug-github-actions.sh
Expand All @@ -77,5 +74,9 @@ jobs:
run: task utest
continue-on-error: false
- name: Integration Test
run: task itest
continue-on-error: false
run: ops -t && task itest
continue-on-error: false
- name: Cleanup cluster
if: always()
run: |
kind delete cluster --name nuvolaris
21 changes: 8 additions & 13 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ jobs:
image:
name: Build OpenServerless Operator Image
runs-on: ubuntu-22.04
#runs-on: [ self-hosted, Linux, X64 ]
steps:
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Checkout
uses: actions/checkout@v2
with:
Expand All @@ -58,13 +59,12 @@ jobs:
- name: Setup
run: bash .github/cisetup.sh
- name: Kind
uses: container-tools/kind-action@v2.0.4
with:
version: v0.22.0
cluster_name: nuvolaris
config: .github/kind.yaml
run: |
cd $HOME && \
ops setup docker create &&
kind export kubeconfig --name nuvolaris
- name: Install
run: poetry install
run: task setup
- name: BuildAndLoad
run: task build-and-load TAG="$IMG_TAG"
- name: Ngrok
Expand All @@ -76,14 +76,9 @@ jobs:
- name: Wait
if: ${{ env.NGROK == 'on' }}
run: bash .github/wait.sh
- name: AddIngress
run: task kind:ingress
- name: Unit Test
run: task utest
continue-on-error: false
#- name: Integration Test
# run: task itest
# continue-on-error: false
- name: Registry login
uses: docker/login-action@v3
with:
Expand All @@ -97,4 +92,4 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Image
run: task buildx-and-push TAG="$IMG_TAG"
run: task buildx-and-push TAG="$IMG_TAG"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ actions/github/webhook/common
.direnv/
.idea/**
.vscode/**
profile_default/history.sqlite
.venv
2 changes: 1 addition & 1 deletion .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ header:
- '**/license-eye'
- '**/id_rsa*'
- '**/.gitkeep'
- 'poetry.lock'
- 'uv.lock'
- '**/__*'
- '.github/ngrok'
- 'ngrok'
Expand Down
108 changes: 51 additions & 57 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ RUN groupadd --gid 1001 nuvolaris && \

USER nuvolaris
WORKDIR /home/nuvolaris

# install the operator
ADD --chown=nuvolaris:nuvolaris nuvolaris/*.py /home/nuvolaris/nuvolaris/
ADD --chown=nuvolaris:nuvolaris nuvolaris/files /home/nuvolaris/nuvolaris/files
Expand Down Expand Up @@ -52,11 +53,10 @@ ADD --chown=nuvolaris:nuvolaris deploy/postgres-operator-deploy /home/nuvolaris/
ADD --chown=nuvolaris:nuvolaris deploy/ferretdb /home/nuvolaris/deploy/ferretdb
ADD --chown=nuvolaris:nuvolaris deploy/runtimes /home/nuvolaris/deploy/runtimes
ADD --chown=nuvolaris:nuvolaris deploy/postgres-backup /home/nuvolaris/deploy/postgres-backup
ADD --chown=nuvolaris:nuvolaris run.sh dbinit.sh cron.sh pyproject.toml poetry.lock whisk-system.sh /home/nuvolaris/

# prepares the required folders to deploy the whisk-system actions
RUN mkdir /home/nuvolaris/deploy/whisk-system
ADD --chown=nuvolaris:nuvolaris run.sh dbinit.sh cron.sh whisk-system.sh pyproject.toml uv.lock opsfile.yml prereq.yml /home/nuvolaris/
RUN mkdir -p /home/nuvolaris/deploy/whisk-system /home/nuvolaris/profile_default/startup
ADD --chown=nuvolaris:nuvolaris actions /home/nuvolaris/actions
ADD --chown=nuvolaris:nuvolaris profile_default/startup/00-init.ipy /home/nuvolaris/profile_default/startup

# enterprise specific
ADD --chown=nuvolaris:nuvolaris deploy/openwhisk-enterprise /home/nuvolaris/deploy/openwhisk-enterprise
Expand All @@ -73,31 +73,6 @@ ADD --chown=nuvolaris:nuvolaris deploy/registry /home/nuvolaris/deploy/registry
ADD --chown=nuvolaris:nuvolaris deploy/seaweedfs /home/nuvolaris/deploy/seaweedfs
ADD --chown=nuvolaris:nuvolaris quota.sh /home/nuvolaris/

#------------------------------------------------------------------------------
# Python dependencies
FROM python:3.12-slim-bullseye AS deps

# --- Install Poetry ---
ARG POETRY_VERSION=1.8.5
ENV POETRY_HOME=/opt/poetry
ENV POETRY_NO_INTERACTION=1
ENV POETRY_VIRTUALENVS_IN_PROJECT=1
ENV POETRY_VIRTUALENVS_CREATE=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV POETRY_CACHE_DIR=/opt/.cache
ENV PATH=${POETRY_HOME}/bin:$PATH

WORKDIR /home/nuvolaris
COPY --chown=nuvolaris:nuvolaris pyproject.toml poetry.lock /home/nuvolaris/
RUN echo "Installing poetry" && \
# Install minimal dependencies
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && \
apt-get update && apt-get install -y --no-install-recommends \
curl gnupg zip unzip && \
curl -sSL https://install.python-poetry.org | python - && \
cd /home/nuvolaris && poetry install --no-root --no-interaction --no-ansi && rm -rf $POETRY_CACHE_DIR

#------------------------------------------------------------------------------
# Final stage
FROM python:3.12-slim-bullseye
Expand All @@ -110,13 +85,10 @@ ENV INVOKER_IMAGE=ghcr.io/nuvolaris/openwhisk-invoker
ENV INVOKER_TAG=3.1.0-mastrogpt.2402101445
ENV OPERATOR_IMAGE=${OPERATOR_IMAGE_DEFAULT}
ENV OPERATOR_TAG=${OPERATOR_TAG_DEFAULT}

# configure dpkg && timezone
ENV TZ=Europe/London
ENV HOME=/home/nuvolaris
ENV VIRTUAL_ENV=/home/nuvolaris/.venv
ENV POETRY_HOME=/opt/poetry
ENV POETRY_CACHE_DIR=/opt/.cache
ENV PATH=$POETRY_HOME/bin:$HOME/.venv/bin:$HOME/.local/bin:/usr/local/bin:/usr/bin:/sbin:/bin:/usr/sbin/
# configure dpkg && timezone
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
# add nuvolaris user
groupadd --gid 1001 nuvolaris && \
Expand All @@ -125,36 +97,58 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone &
# Install minimal dependencies
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && \
apt-get update && apt-get install -y --no-install-recommends \
curl gnupg zip unzip && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
# install kubectl
KVER="v1.23.0" && \
ARCH="$(dpkg --print-architecture)" && \
curl -sL "https://dl.k8s.io/release/$KVER/bin/linux/$ARCH/kubectl" -o /usr/bin/kubectl && chmod +x /usr/bin/kubectl && \
VER="v4.5.7" && \
curl -sL "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2F$VER/kustomize_${VER}_linux_${ARCH}.tar.gz" | tar xzvf - -C /usr/bin && \
# openwhisk cli
WSK_VERSION=1.2.0 && \
WSK_BASE=https://github.com/apache/openwhisk-cli/releases/download && \
curl -sL "$WSK_BASE/$WSK_VERSION/OpenWhisk_CLI-$WSK_VERSION-linux-$ARCH.tgz" | tar xzvf - -C /usr/bin/ && \
# install minio
MINIO_BASE=https://dl.min.io/client/mc/release/linux && \
MC_VER=RELEASE.2025-05-21T01-59-54Z && \
curl -sL "$MINIO_BASE-$ARCH/archive/mc.${MC_VER}" -o /usr/bin/mc && chmod +x /usr/bin/mc && \
# install taskfile
curl -sL https://taskfile.dev/install.sh | sh -s -- -d -b /usr/bin
curl gnupg zip unzip openssh-client && \
apt-get clean && rm -rf /var/lib/apt/lists/*

USER nuvolaris
WORKDIR /home/nuvolaris
# Copy virtualenv
COPY --from=deps --chown=nuvolaris:nuvolaris ${VIRTUAL_ENV} ${VIRTUAL_ENV}
# Copy poetry
COPY --from=deps --chown=nuvolaris:nuvolaris ${POETRY_HOME} ${POETRY_HOME}

## saving those scripts just in case - now managed by ops prereqs
# ex install openwhisk cli - using the ops wrapper instead
#WSK_VERSION=1.2.0 && \
#WSK_BASE=https://github.com/apache/openwhisk-cli/releases/download && \
# curl -sL "$WSK_BASE/$WSK_VERSION/OpenWhisk_CLI-$WSK_VERSION-linux-$ARCH.tgz" | tar xzvf - -C /usr/bin/ && \
# ex install minio - archived binaries disappered... - installed by ops prereqs
# MINIO_BASE=https://dl.min.io/client/mc/release/linux && \
# MC_VER=RELEASE.2025-05-21T01-59-54Z && \
# curl -sL "$MINIO_BASE-$ARCH/archive/mc.${MC_VER}" -o /usr/bin/mc && chmod +x /usr/bin/mc && \
# ex install kubectl - installed by ops prereq now
#KVER="v1.23.0" && \
#ARCH="$(dpkg --print-architecture)" && \
#curl -sL "https://dl.k8s.io/release/$KVER/bin/linux/$ARCH/kubectl" -o /usr/bin/kubectl && chmod +x /usr/bin/kubectl && \
#VER="v4.5.7" && \
#curl -sL "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2F$VER/kustomize_${VER}_linux_${ARCH}.tar.gz" | tar xzvf - -C /usr/bin && \

RUN \
# install ops, wsk wrapper and task and create the op plugin from the home dir
VER="0.1.0-2501041342.dev";\
URL="https://raw.githubusercontent.com/apache/openserverless-cli/refs/tags/v$VER/install.sh" ;\
curl -sL $URL | VERSION="$VER" bash ;\
echo -e '#!/bin/bash\nops -wsk "$@"' >$HOME/.local/bin/wsk ; chmod +x $HOME/.local/bin/wsk ;\
curl -sL https://taskfile.dev/install.sh | sh -s -- -d -b $HOME/.local/bin

# env with l
ARG TARGETARCH
ENV PATH="$HOME/.local/bin:$HOME/.ops/linux-${TARGETARCH}/bin:$HOME/.venv/bin:/usr/local/bin:/usr/bin:/sbin:/bin:/usr/sbin/"

# later, in a RUN step, create the symlink to the actual arch dir
RUN mkdir -p "$HOME/.ops" && \
mkdir -p "$HOME/.ops/linux-$(dpkg --print-architecture)/bin" && \
ln -sfn "$HOME/.ops/linux-$(dpkg --print-architecture)/bin" "$HOME/.ops/bin"

# Copy the home
COPY --from=sources --chown=nuvolaris:nuvolaris ${HOME} ${HOME}
RUN poetry install --only main --no-interaction --no-ansi && rm -rf ${POETRY_CACHE_DIR}

# prepares the required folders to deploy the whisk-system actions
RUN mkdir -p /home/nuvolaris/deploy/whisk-system && \
./whisk-system.sh && \
cd deploy && tar cvf ../deploy.tar *

# Create the ops op plugin and initialize prerequisites
RUN \
ops -t && ops setup && \
ln -sf "$HOME" "$HOME/.ops/olaris-op" && \
ops op && ops op setup && \
echo quit | ops op cli

CMD ["./run.sh"]
Loading
Loading