Skip to content

wallix/task

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2,697 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Task (WALLIX fork)

Fork of go-task/task (v3.49.1) with opinionated changes focused on build-system reliability: deterministic fingerprinting, distributed caching and locking, and setup tasks.

Source: github.com/wallix/task

Changes from upstream

Removed

  • Remote taskfiles -- http:// and git:// includes are no longer supported. Related CLI flags (--download, --offline, --insecure, --timeout, --clear-cache, --trusted-hosts, --expiry, --remote-cache-dir, --cacert, --cert, --cert-key) have been removed.
  • Timestamp fingerprinting -- only checksum-based fingerprinting remains. The method field on tasks is removed.
  • none fingerprint method -- tasks either use checksum fingerprinting or have no sources.

Added

Setup tasks

A new setup field runs tasks unconditionally and sequentially before deps and fingerprint checks. Setup tasks' sources and commands are merged into the parent task's fingerprint.

tasks:
  enforce-version:
    cmds:
      - date +%Y-%m-%d > version.txt

  build:
    setup:
      - enforce-version
    sources:
      - version.txt
      - src/**/*.go
    generates:
      - bin/app
    cmds:
      - go build -ldflags "-X main.buildDate=$(cat version.txt)" -o bin/app .

Per-task cache block (file:// and redis:// backends)

Cache generated files so that subsequent runs (or other machines) can skip execution entirely. The url and lock fields are shell commands evaluated at runtime; TASK_CACHE_HASH (SHA256 of sources) is injected automatically.

tasks:
  build:
    sources:
      - src/**/*.go
    generates:
      - bin/app
    cache:
      enabled: test -n "$REDIS_URL"           # optional, bool or shell
      url: echo "file:///tmp/cache/$TASK_CACHE_HASH.zip"
      lock: echo "redis://$REDIS_URL/lock:build"
    cmds:
      - go build -o bin/app .

Filesystem-based locking

Tasks with sources and generates automatically acquire a POSIX advisory file lock (stored in .task/) to prevent concurrent execution of the same task.

Redis-based distributed locking

When cache.lock evaluates to a redis:// URL, locking is distributed across machines using Redis SET NX EX with TTL-based heartbeat renewal.

urlsafe template function

{{urlsafe .TASK}} percent-encodes a string for use in URLs, replacing special characters like colons from namespaced task names. Useful in cache URLs:

cache:
  url: echo "redis://$REDIS_URL/cache:{{urlsafe .TASK}}/$TASK_CACHE_HASH"

--status flag

Show fingerprint status of tasks without running them:

task --status build           # human-readable
task --status --json build    # machine-readable

--export-cache and --import-cache

Portable fingerprint state for CI/CD pipelines:

# On build machine
task --export-cache state.zip build test

# On CI machine
task --import-cache state.zip

Exports checksum state and generated files for up-to-date tasks as a ZIP archive.

Improved

  • Richer fingerprints -- checksums now include serialized commands and variable data, not just file contents.
  • Separate staleness reporting -- sources and generates staleness is tracked and reported independently.

Execution pipeline

setup tasks (unconditional, sequential)
  -> merge setup fingerprints into parent sources
  -> acquire lock (file or redis)
  -> run deps (parallel)
  -> check fingerprint
     -> try restore from cache (file:// or redis://)
     -> if miss: execute task, then save to cache
  -> release lock

About

A task runner / simpler Make alternative written in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Go 88.9%
  • Shell 4.7%
  • TypeScript 2.8%
  • Vue 1.8%
  • PowerShell 1.2%
  • CSS 0.5%
  • JavaScript 0.1%