Skip to content

WIP - Pin - local pipeline project with Docker Golang API.

Notifications You must be signed in to change notification settings

muhammedikinci/pin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



pin 🔥 pipeline

WIP - Local pipeline project with Docker Golang API.

pingif

terminal from terminalgif.com

🌐 Installation

Download latest release

You can download latest release from here

Install with cloning

Clone the pin

git clone https://github.com/muhammedikinci/pin

Download packages

go mod download

Build executable

go build -o pin ./cmd/cli/.

Or you can run directly

go run ./cmd/cli/. apply -n "test" -f ./testdata/test.yaml

⚙️ Configuration

Sample yaml file

workflow:
  - run

logsWithTime: true

run:
  image: golang:alpine3.15
  copyFiles: true
  soloExecution: true
  script:
    - go mod download
    - go run .
    - ls
  port:
    - 8082:8080

You can create separate jobs like the run stage and if you want to run these jobs in the pipeline you must add its name to workflow.

copyFiles

default: false

If you want to copy all projects filed to the docker container, you must set this configuration to true

soloExecution

default: false

When you add multiple commands to the script field, commands are running in the container as a shell script. If soloExecution is set to true each command works in a different shell script.

soloExecution => false

# shell#1
cd cmd
ls

soloExecution => true

# shell#1
cd cmd
# shell#2
ls

If you want to see all files in the cmd folder you must set soloExecution to false or you can use this:

# shell#1
cd cmd && ls

logsWithTime

default: false

logsWithTime => true

⚉ 2022/05/08 11:36:30 Image is available
⚉ 2022/05/08 11:36:30 Start creating container
⚉ 2022/05/08 11:36:33 Starting the container
⚉ 2022/05/08 11:36:35 Execute command: ls -a

logsWithTime => false

⚉ Image is available
⚉ Start creating container
⚉ Starting the container
⚉ Execute command: ls -a

port

default: empty mapping

You can use this feature for port forwarding from container to your machine with multiple mapping

  port:
    - 8082:8080
    - 8083:8080

copyIgnore

default: empty mapping

You can use this feature to ignore copying the specific files in your project to the container.

Sample configuration yaml

run:
  image: node:current-alpine3.15
  copyFiles: true
  soloExecution: true
  port:
    - 8080:8080
  copyIgnore:
    - server.js
    - props
    - README.md
    - helper/.*/.py

Actual folder structure in project

index.js
server.js
README.md
helper:
    - test.py
    - mock
        test2.py
    - api:
        index.js
    - props:
        index.js

Folder structure in container

index.js
helper:
    - mock (empty)
    - api:
        index.js

parallel

default: false

If you want to run parallel job, you must add parallel field and the stage must be in workflow(position doesn't matter)

workflow:
  - testStage
  - parallelJob
  - run

...

parallelJob:
  image: node:current-alpine3.15
  copyFiles: true
  soloExecution: true
  parallel: true
  script:
    - ls -a

Tests

go test ./...

Checklist

  • Implement web interface
  • Support concurrent jobs ✅Issue#9
  • Add working with remote docker deamon support
  • Change image pulling logs (get only status logs)✅Issue#1
  • Add custom ignore configuration to copyFiles for project files (like gitignore) ✅Issue#7
  • Add shared artifacts support between different jobs
  • Add timestamp to container names ✅Issue#2
  • Create small pieces with extracting codes from runner struct and write unit test:
  • Add port expose support ✅Issue#6
  • Support long living containers
  • Add concurrency between jobs and graceful shutdown with global context ✅Issue#8

Contact

Muhammed İkinci - muhammedikinci@outlook.com