dnephin / dobi

A build automation tool for Docker applications
https://dnephin.github.io/dobi/
Apache License 2.0
309 stars 36 forks source link

source/artifacts script #206

Open siredmar opened 3 years ago

siredmar commented 3 years ago

It would be nice if dobi had a way to pass a script that checks own source/artifacts patterns besides the already present local files checks. For example if i use dobi to deploy some deployment to kubernetes, i'd like to check the dependencies for my deployment, e.g. if something like cert-manager is already present. If the cert-manager is already present, the depends section would be skipped for my deployment. The resource would be marked fresh when the script returns 0, otherwise the image/job will be build/triggered.

Proposal: A new property called sources-artifact-job that refers to a dobi job that either fails (returns 1) or succeeds (returns 0).

Example:

meta:
  project: test

image=bash:
    image=bash
    tags: [latest]
    pull: once

image=checkimage:
    image=checkimage
    tags: [latest]
    pull: once

# this job returns either 0 or 1
job=check-dependency-job:
    use: checkimage
    command: /check.sh

job=dependency-job:
    use: bash
    command: /do-something-as-dependency.sh
    sources-artifact-job: check-dependency-job

job=main-job:
    use: bash
    command: /do-something.sh
    depends: [dependency-job]
dnephin commented 3 years ago

I like this idea!