-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2.0.0!
- Loading branch information
Showing
73 changed files
with
10,748 additions
and
11,125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[unstable] | ||
bindeps = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.224.2/containers/rust/.devcontainer/base.Dockerfile | ||
|
||
# [Choice] Debian OS version (use bullseye on local arm64/Apple Silicon): buster, bullseye | ||
ARG VARIANT="buster" | ||
FROM mcr.microsoft.com/vscode/devcontainers/rust:0-${VARIANT} | ||
|
||
RUN apt update && apt install -y libpcap-dev cmake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/rust | ||
{ | ||
"name": "Rust", | ||
"build": { | ||
"args": { | ||
"VARIANT": "bullseye" | ||
}, | ||
"dockerfile": "Dockerfile" | ||
}, | ||
"runArgs": [ | ||
"--cap-add=SYS_PTRACE", | ||
"--security-opt", | ||
"seccomp=unconfined", | ||
"--cap-add=SYS_PTRACE", | ||
"--security-opt", | ||
"seccomp=unconfined" | ||
], | ||
|
||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"lldb.executable": "/usr/bin/lldb", | ||
"files.watcherExclude": { | ||
"**/target/**": true | ||
}, | ||
"rust-analyzer.checkOnSave.command": "clippy" | ||
}, | ||
|
||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"vadimcn.vscode-lldb", | ||
"mutantdino.resourcemonitor", | ||
"matklad.rust-analyzer", | ||
"tamasfe.even-better-toml", | ||
"serayuzgur.crates" | ||
], | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "rustc --version", | ||
|
||
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
// "remoteUser": "vscode" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*/target* | ||
*/.vscode* | ||
*/.git* | ||
*/.github* | ||
*/.devcontainer* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Basic set up for three package managers | ||
|
||
version: 2 | ||
updates: | ||
|
||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "cargo" | ||
directory: "/mirrord-protocol" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,77 @@ | ||
name: Lint | ||
name: CI | ||
|
||
on: | ||
# Trigger the workflow on push or pull request, | ||
# but only for the main branch | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
branches: [main, v2.0] | ||
pull_request: | ||
branches: | ||
- main | ||
branches: [main, v2.0] | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
components: rustfmt, clippy | ||
- uses: Swatinem/rust-cache@v1 | ||
# Needed for agent | ||
- run: sudo apt install libpcap-dev cmake | ||
- run: cargo fmt --all -- --check | ||
- run: cargo clippy -- -D warnings | ||
|
||
test_mirrord_protocol: | ||
strategy: | ||
matrix: | ||
project: ["cli", "vscode-ext", "core"] | ||
os: [ubuntu-latest, ubuntu-18.04, macos-12, macos-11, macos-10.15] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v2 | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
- uses: Swatinem/rust-cache@v1 | ||
with: | ||
key: ${{matrix.os}} | ||
- run: cd mirrord-protocol && cargo test | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v1 | ||
test_agent: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
node-version: 12 | ||
profile: minimal | ||
toolchain: nightly | ||
components: rustfmt | ||
- uses: Swatinem/rust-cache@v1 | ||
- run: sudo apt install -y libpcap-dev cmake | ||
- run: sudo PATH=/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin:/usr/bin:/usr/sbin /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo test -p mirrord-agent | ||
|
||
- name: Install Node.js dependencies | ||
working-directory: ./${{ matrix.project }} | ||
run: npm ci | ||
test_agent_image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build image | ||
run: docker build . --file mirrord-agent/Dockerfile | ||
|
||
- name: Lint | ||
working-directory: ./${{ matrix.project }} | ||
run: npm run lint | ||
test_mirrord_layer: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, ubuntu-18.04, macos-12, macos-11, macos-10.15] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
- uses: Swatinem/rust-cache@v1 | ||
with: | ||
key: ${{matrix.os}} | ||
# For now, just evrify it compiles. | ||
- run: cargo +nightly build --manifest-path=mirrord-layer/Cargo.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,139 @@ | ||
name: Release | ||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- "*.*.*" | ||
tags: | ||
- "*.*.*" | ||
|
||
jobs: | ||
test: | ||
build_binaries: | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-18.04 | ||
extension: so | ||
target: x86_64-unknown-linux-gnu | ||
- os: macos-11 | ||
extension: dylib | ||
target: x86_64-apple-darwin | ||
- os: macos-11 | ||
extension: dylib | ||
target: aarch64-apple-darwin | ||
code-target: darwin-arm64 | ||
runs-on: ${{matrix.os}} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
target: ${{matrix.target}} | ||
- uses: Swatinem/rust-cache@v1 | ||
with: | ||
key: ${{matrix.target}}-${{matrix.os}} | ||
- name: build mirrord-layer and cli | ||
run: cargo +nightly build --release -p mirrord -p mirrord-layer --target=${{matrix.target}} | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{matrix.target}} | ||
path: | | ||
target/${{matrix.target}}/release/mirrord | ||
target/${{matrix.target}}/release/libmirrord_layer.${{matrix.extension}} | ||
if-no-files-found: error | ||
|
||
release_docker_image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Get release version | ||
run: | | ||
echo "::set-output name=version::$(grep -m 1 version Cargo.toml | cut -d' ' -f3 | tr -d '\"')" | ||
id: version | ||
- name: Build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: mirrord-agent/Dockerfile | ||
platforms: linux/amd64 # linux/arm64 arm64 is too slow on github, try to make it work later? | ||
push: true | ||
tags: | | ||
ghcr.io/metalbear-co/mirrord:latest | ||
ghcr.io/metalbear-co/mirrord:${{ steps.version.outputs.version }} | ||
release_vscode_ext: | ||
needs: [build_binaries, release_docker_image] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo just so we can work on other branches | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 17 | ||
cache: "npm" | ||
cache-dependency-path: vscode-ext/package-lock.json | ||
# This downloads all artifacts of the job | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
path: /tmp/artifacts | ||
- name: Get release version | ||
# VSCode doesn't support pre release versions https://github.com/microsoft/vsmarketplace/issues/50#issuecomment-990764201 | ||
run: | | ||
echo "::set-output name=version::$(grep -m 1 version Cargo.toml | cut -d' ' -f3 | tr -d '\"' | cut -d'-' -f1)" | ||
id: version | ||
- run: npm install -g vsce typescript esbuild | ||
- run: cp CHANGELOG.md LICENSE vscode-ext/ | ||
- run: mv /tmp/artifacts/x86_64-unknown-linux-gnu/libmirrord_layer.so vscode-ext/ | ||
- run: cd vscode-ext && npm install && tsc && vsce publish ${{ steps.version.outputs.version }} --allow-star-activation --target linux-x64 | ||
env: | ||
VSCE_PAT: ${{ secrets.VSCE_PAT }} | ||
- run: rm vscode-ext/libmirrord_layer.so | ||
- run: mv /tmp/artifacts/x86_64-apple-darwin/libmirrord_layer.dylib vscode-ext/ | ||
- run: cd vscode-ext && npm install && tsc && vsce publish ${{ steps.version.outputs.version }} --allow-star-activation --target darwin-x64 | ||
env: | ||
VSCE_PAT: ${{ secrets.VSCE_PAT }} | ||
- run: rm vscode-ext/libmirrord_layer.dylib | ||
- run: mv /tmp/artifacts/aarch64-apple-darwin/libmirrord_layer.dylib vscode-ext/ | ||
- run: cd vscode-ext && npm install && tsc && vsce publish ${{ steps.version.outputs.version }} --allow-star-activation --target darwin-arm64 | ||
env: | ||
VSCE_PAT: ${{ secrets.VSCE_PAT }} | ||
|
||
release_gh: | ||
needs: [build_binaries, release_docker_image, release_vscode_ext] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: write | ||
deployments: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
path: /tmp/artifacts | ||
- name: Prepare binaries for upload | ||
run: | | ||
mkdir /tmp/release | ||
mv /tmp/artifacts/x86_64-unknown-linux-gnu/libmirrord_layer.so /tmp/release/libmirrord_layer_linux_x86_64.so | ||
mv /tmp/artifacts/x86_64-unknown-linux-gnu/mirrord /tmp/release/mirrord_linux_x86_64 | ||
mv /tmp/artifacts/x86_64-apple-darwin/libmirrord_layer.dylib /tmp/release/libmirrord_layer_mac_x86_64.dylib | ||
mv /tmp/artifacts/x86_64-apple-darwin/mirrord /tmp/release/mirrord_mac_x86_64 | ||
mv /tmp/artifacts/aarch64-apple-darwin/libmirrord_layer.dylib /tmp/release/libmirrord_layer_mac_aarch64.dylib | ||
mv /tmp/artifacts/aarch64-apple-darwin/mirrord /tmp/release/mirrord_mac_aarch64 | ||
# Consider to add changelog generation.. | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: /tmp/release/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch index.ts", | ||
"type": "pwa-node", | ||
"request": "launch", | ||
"runtimeArgs": [ | ||
"-r", | ||
"ts-node/register" | ||
], | ||
"args": [ | ||
"${workspaceFolder}/cli/src/index.ts", | ||
"nginx-deployment-66b6c48dd5-zshg9" | ||
], | ||
"cwd": "${workspaceFolder}/cli" | ||
}, | ||
{ | ||
"args": [ | ||
"--extensionDevelopmentPath=${workspaceFolder}" | ||
], | ||
"name": "Launch Extension", | ||
"outFiles": [ | ||
"${workspaceFolder}/vscode-ext/out/**/*.js" | ||
], | ||
"request": "launch", | ||
"type": "pwa-extensionHost" | ||
}, | ||
{ | ||
"type": "lldb", | ||
"request": "launch", | ||
"name": "Debug mirrord-layer with app.js", | ||
"program": "node", | ||
"args": ["${workspaceFolder}/sample/app.js"], | ||
|
||
"env": { | ||
"DYLD_INSERT_LIBRARIES": "${workspaceFolder}/target/debug/libmirrord_layer.dylib", | ||
"LD_PRELOAD": "${workspaceFolder}/target/debug/libmirrord_layer.so", | ||
"RUST_LOG": "warn,mirrord=trace", | ||
"MIRRORD_AGENT_IMPERSONATED_POD_NAME": "", | ||
"MIRRORD_AGENT_RUST_LOG": "trace", | ||
}, | ||
} | ||
] | ||
} |
Oops, something went wrong.