5.2.1 • Published 2 years ago

lugger v5.2.1

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
2 years ago

Lugger

Lugger is an automation framework running on customizable Typescript DSL

Here are some characteristics we desire in this framework:

  • Superset of Typescript (normal TS flow should run identically)
  • Provide frequently used toolchains as strongly-typed library
    • SCM (e.g. git), docker (containerized workloads)
    • SSH, Shell scripting
    • Infrastructure automation (e.g. AWS, Azure, GCP, etc.)
  • Ability to define workflow declaratively
  • No need for `await` when using DSL (statements are auto awaited)
  • Easy concurrency (parallel)
  • All DSL processes are serializable (pause, stash, resume workflow)
  • Built-in control against flakiness (e.g. retry, timeout, backoff, repeat, etc.)
import { workflow, params, stage, echo, docker, file } from 'lugger';

class MyCiCdWorkFlow extends Workflow {
    
    setup() {
        git.clone({
            repo: `${env.REPO_URL}`,
            branch: 'mybranch',
            folder: './sourcecode'
        });
        sh `mkdir -p metadata`;
        echo `set-up comeplete`;
    }
    
    @stage
    'Build Docker Images'() {
        docker.pull(`nginx:latest`)
              .try(5).backoff('auto').timeout(10, 'm')
        docker.build(`myapp:${BUILD_NUMBER}`, 'sourcecode/Dockerfile')
              .try(2).timeout(10, 'm')
    }
    
    @stage
    'Run Tests'() {
        chdir(`./sourcecode`);
        parallel; {
            stage('Unit Tests'); {
                sh `python tests/unit_test_entrypont.py`
                echo `Unit Tests ended`
            }
            stage('Integration Tests'); {
                sh `bash tests/integration_suites.sh`
                echo `Integration Tests ended`
            }
        }
    }
    
    @stage
    'Deploy'() {
        const { user, pass } = SecretManager.resolve({
            user: '<secret.docker.deployerAccount.user>',
            pass: '<secret.docker.deployerAccount.pass>',
        })
        const deployedImage = `myregistry.com/myapp:${BUILD_NUMBER}`;
        docker.login('myregistry.com', user, pass)
        docker.tag(`myapp:${BUILD_NUMBER}`, deployedImage)
        docker.push(`myapp:${BUILD_NUMBER}`).try(3)
    }
    
    cleanup() {
        // release resources
    }
    
    success() {
        console.log(`I've succeeded`);
    }
    
    failure() {
        console.log(`I've failed!`);
    }

}

// entrypoint
runWorkflow(MyCiCdWorkFlow)
5.1.4

2 years ago

5.1.3

2 years ago

5.2.1

2 years ago

5.1.2

2 years ago

5.1.1

2 years ago

5.0.16

2 years ago

5.0.6

2 years ago

5.0.5

2 years ago

5.0.4

2 years ago

5.0.10

2 years ago

5.0.11

2 years ago

5.0.12

2 years ago

5.0.13

2 years ago

5.0.14

2 years ago

5.0.15

2 years ago

5.0.9

2 years ago

5.0.8

2 years ago

5.0.7

2 years ago

0.5.27

3 years ago

0.5.25

3 years ago

0.5.26

3 years ago

0.5.23

3 years ago

0.5.24

3 years ago

0.5.21

3 years ago

0.5.10

3 years ago

0.5.22

3 years ago

0.5.11

3 years ago

0.5.20

3 years ago

0.5.8

3 years ago

0.5.7

3 years ago

0.5.9

3 years ago

0.5.18

3 years ago

0.5.19

3 years ago

0.5.16

3 years ago

0.5.14

3 years ago

0.5.15

3 years ago

0.5.12

3 years ago

0.5.13

3 years ago

0.5.4

3 years ago

0.5.3

3 years ago

0.5.6

3 years ago

0.5.5

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago

0.0.0

3 years ago