Skip to content
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
47 changes: 47 additions & 0 deletions .devcontainer/alpine/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM alpine:3.22

ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=1000

RUN apk add --no-cache \
bash \
build-base \
ca-certificates \
curl \
git \
musl-dev \
openssl-dev \
openssl-libs-static \
pkgconf \
sudo \
zlib-dev \
zlib-static

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:${PATH}

RUN addgroup -g ${USER_GID} ${USERNAME} && \
adduser -D -u ${USER_UID} -G ${USERNAME} -h /home/${USERNAME} -s /bin/bash ${USERNAME} && \
echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/99-${USERNAME} && \
chmod 0440 /etc/sudoers.d/99-${USERNAME} && \
mkdir -p /home/${USERNAME} /usr/local/cargo /usr/local/rustup /workspaces/cluster-tooling && \
chown -R ${USER_UID}:${USER_GID} /home/${USERNAME} /usr/local/cargo /usr/local/rustup /workspaces/cluster-tooling

ENV HOME=/home/${USERNAME}

USER ${USERNAME}
WORKDIR /workspaces/cluster-tooling

RUN curl -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable && \
rustup component add rustfmt clippy rust-analyzer && \
rustup target add x86_64-unknown-linux-musl aarch64-unknown-linux-musl && \
rustc -V && cargo -V

ENV CARGO_PROFILE_RELEASE_LTO=fat \
CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 \
CARGO_PROFILE_RELEASE_STRIP=true \
PKG_CONFIG_ALL_STATIC=1 \
OPENSSL_STATIC=1 \
LIBZ_SYS_STATIC=1
41 changes: 41 additions & 0 deletions .devcontainer/alpine/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "sarusctl-static (alpine + musl)",
"build": {
"dockerfile": "Containerfile",
"context": "../..",
"args": {
"USERNAME": "${localEnv:USER:vscode}",
"USER_UID": "${localEnv:UID:1000}",
"USER_GID": "${localEnv:GID:1000}"
}
},
"workspaceFolder": "/workspaces/cluster-tooling",
"containerEnv": {
"HOME": "/home/${localEnv:USER:vscode}"
},
"remoteUser": "${localEnv:USER:vscode}",
"updateRemoteUserUID": false,
"runArgs": ["--userns=host"],
"mounts": [
"type=volume,source=sarusctl-static-cargo-registry,target=/usr/local/cargo/registry",
"type=volume,source=sarusctl-static-cargo-git,target=/usr/local/cargo/git",
"type=volume,source=sarusctl-static-rustup,target=/usr/local/rustup"
],
"postCreateCommand": "sh -lc 'sudo mkdir -p /usr/local/cargo/registry /usr/local/cargo/git /usr/local/rustup && sudo chown -R $(id -u):$(id -g) /usr/local/cargo /usr/local/rustup'",
"customizations": {
"vscode": {
"extensions": [
"rust-lang.rust-analyzer",
"tamasfe.even-better-toml",
"fill-labs.dependi",
"vadimcn.vscode-lldb",
"openai.chatgpt",
"anthropic.claude-code"
],
"settings": {
"rust-analyzer.check.command": "clippy",
"editor.formatOnSave": true
}
}
}
}
3 changes: 1 addition & 2 deletions .devcontainer/opensuse/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 opensuse/leap:15.5
FROM opensuse/leap:15.5

# Basic tooling + deps
RUN zypper -n refresh && \
Expand Down Expand Up @@ -72,4 +72,3 @@ USER root

ENV CPATH=/usr/local/include:/usr/local/include/slurm:/usr/include


5 changes: 0 additions & 5 deletions .devcontainer/opensuse/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
"remoteUser": "vscode",
"updateRemoteUserUID": true,

"platform": "linux/amd64",

"runArgs": ["--platform=linux/amd64"],

"mounts": [
"type=volume,source=skybox-target,target=/workspaces/target"
],
Expand All @@ -33,4 +29,3 @@
}
}
}

2 changes: 1 addition & 1 deletion .devcontainer/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 ghcr.io/sarus-suite/cluster-tooling/skybox-dev-base:latest AS base
FROM ghcr.io/sarus-suite/cluster-tooling/skybox-dev-base:latest AS base

FROM base AS chef-planner

Expand Down
3 changes: 0 additions & 3 deletions .devcontainer/ubuntu/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
"remoteUser": "vscode",
"updateRemoteUserUID": true,

"platform": "linux/amd64",
"runArgs": ["--platform=linux/amd64"],

"customizations": {
"vscode": {
"extensions": [
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ devcontainer exec --workspace-folder . --config .devcontainer/opensuse/devcontai

You are now inside the prepared build environment.

### Static `sarusctl` build with Alpine

For a static `musl` build of `sarusctl`, use the Alpine devcontainer instead:

```bash
devcontainer up --workspace-folder . --config .devcontainer/alpine/devcontainer.json
devcontainer exec --workspace-folder . --config .devcontainer/alpine/devcontainer.json -- \
cargo build --locked -p sarusctl --release
```

This devcontainer is intentionally scoped to `sarusctl` portability work. It does not include the Slurm headers and related system setup needed for `skybox`.

### VS Code

Open the repository in VS Code and choose:
Expand Down Expand Up @@ -252,4 +264,3 @@ Then work on a new feature

See LICENSE file for this repository.
See individual crates for their licensing terms.

26 changes: 26 additions & 0 deletions crates/podman-driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,17 @@ mod commands {
cmd
}

pub fn system_reset(podman_ctx: Option<&PodmanCtx>) -> Command {
let mut cmd = commands::base(podman_ctx);

if let Some(ctx) = podman_ctx {
cli_opt(&mut cmd, "--module", ctx.module.as_deref().map(OsStr::new));
}

cmd.args(["system", "reset", "--force"]);
cmd
}

pub fn kube(podman_ctx: Option<&PodmanCtx>) -> Command {
let mut cmd = commands::base(podman_ctx);

Expand Down Expand Up @@ -485,6 +496,12 @@ pub fn info(format: Option<&str>, podman_ctx: Option<&PodmanCtx>) -> Output {
.expect("Failed to execute command")
}

pub fn system_reset(podman_ctx: Option<&PodmanCtx>) -> Output {
commands::system_reset(podman_ctx)
.output()
.expect("Failed to execute command")
}

pub fn kube_play(filepath: &str, podman_ctx: Option<&PodmanCtx>) {
commands::kube_play(filepath, podman_ctx)
.status()
Expand Down Expand Up @@ -742,6 +759,15 @@ pub mod loggable {
}
}

pub fn system_reset(podman_ctx: Option<&PodmanCtx>) -> ExecutedCommand {
let mut cmd = commands::system_reset(podman_ctx);

ExecutedCommand {
command: cmd2string(&cmd),
output: cmd.output().expect("Failed to execute command"),
}
}

fn parallax_execute_command(
parallax_path: &PathBuf,
podman_ctx: &PodmanCtx,
Expand Down
Loading
Loading