Giter Site home page Giter Site logo

jfhovinne / podmatrix Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 22 KB

Parallel execution of commands within a matrix of Podman containers

License: MIT License

Shell 100.00%
bash bashly ci-cd containers lightweight podman parallel-processing automation test-matrix testing

podmatrix's Introduction

podmatrix

A script which executes commands within a 'matrix' of Podman containers.

One purpose would be to quickly spawn containers and launch an application test suite within those containers, against multiple versions of a specific programming language.

The containers are created in sequence, then commands are executed in parallel.

podmatrix is fast and only requires Bash and rootless Podman.

The script exit code is the sum of executed commands exit codes, which means 0 if everything went fine.

Use echo $? to display it after execution.

Requirements

Install

wget https://raw.githubusercontent.com/jfhovinne/podmatrix/master/podmatrix && chmod +x podmatrix

Usage

$ podmatrix
podmatrix - A script which executes commands within a 'matrix' of Podman containers

Usage:
  podmatrix COMMAND
  podmatrix [COMMAND] --help | -h
  podmatrix --version | -v

Commands:
  exec   Execute a command inside Podman containers

exec command

$ podmatrix exec --help
podmatrix exec - Execute a command inside Podman containers

Alias: e

Usage:
  podmatrix exec COMMAND [OPTIONS]
  podmatrix exec --help | -h

Options:
  --help, -h
    Show this help

  --source, -s SOURCE
    Local source path to copy into containers

  --target, -t TARGET
    Container path to copy source to and where command will be executed

  --image, -i IMAGE (repeatable)
    The container image to run

  --tag TAG (repeatable)
    The container image tag to run
    Default: latest

Arguments:
  COMMAND
    The command to execute

Examples:
  podmatrix exec ./test.sh --source . --target /tmp/src --image python --tag 3.9
  --tag 3.10 --tag 3.11
  podmatrix exec ./test.sh --source . --target /tmp/src --image python --image
  docker.io/pypy --tag 3.8 --tag 3.9

Examples

Current directory contains a Python application and a test.sh script which builds and tests it.

To test it with different Python versions:

podmatrix exec ./test.sh --source . --target /tmp/src --image python \
--tag 3.9 --tag 3.10 --tag 3.11

To test it with different Python versions and flavors:

podmatrix exec ./test.sh --source . --target /tmp/src --image python --image
docker.io/pypy --tag 3.8 --tag 3.9

Test installation of a PHP package with different versions of Composer:

podmatrix exec "composer require monolog/monolog" --image docker.io/composer \
--tag 1.10 --tag 2.2 --tag 2.3 --tag 2.4 --tag 2.5

Compare installation of the curl package in Debian and Ubuntu (why not):

podmatrix exec "apt update && apt install -y curl" \
--image debian --image ubuntu > curl.log

Clone a Python app repository and install its dependencies:

podmatrix exec "git clone https://github.com/jfhovinne/gnrt && cd gnrt && pip install -r requirements.txt" \
--image python --tag 3.11 --tag 3.12.0a4

podmatrix's People

Contributors

jfhovinne avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.